1 /* wavbreaker - A tool to split a wave file up into multiple waves.
2  * Copyright (C) 2002-2003 Timothy Robinson
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18 
19 #include <gtk/gtk.h>
20 #include "wavbreaker.h"
21 
popupmessage_hide(GtkDialog * dialog,int response_id,gpointer user_data)22 void popupmessage_hide( GtkDialog *dialog, int response_id, gpointer user_data)
23 {
24     gtk_widget_destroy( GTK_WIDGET(user_data));
25 }
26 
popupmessage_show(GtkWidget * main_window,const char * message,const char * description)27 void popupmessage_show( GtkWidget *main_window, const char *message, const char *description)
28 {
29     GtkWidget *dialog;
30     gint buttons_type = GTK_BUTTONS_OK;
31 
32     if( main_window == NULL) {
33         main_window = wavbreaker_get_main_window();
34         buttons_type = GTK_BUTTONS_CLOSE;
35     }
36 
37     dialog = gtk_message_dialog_new( GTK_WINDOW(main_window),
38                                      GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
39                                      GTK_MESSAGE_INFO,
40                                      buttons_type,
41                                      "%s", message);
42 
43     gtk_message_dialog_format_secondary_text( GTK_MESSAGE_DIALOG(dialog), "%s", description);
44     gtk_window_set_title( GTK_WINDOW(dialog), message);
45 
46     g_signal_connect( G_OBJECT(dialog), "response", (GCallback)popupmessage_hide, dialog);
47 
48     gtk_widget_show_all( GTK_WIDGET(dialog));
49 }
50 
51