0
|
1 #ifdef HAVE_CONFIG_H
|
|
2 # include "config.h"
|
|
3 #endif
|
|
4
|
|
5 #include <glib.h>
|
|
6 #include <gtk/gtk.h>
|
|
7
|
|
8
|
|
9 GtkWidget *
|
|
10 xmms_show_message(const gchar * title, const gchar * text,
|
|
11 const gchar * button_text, gboolean modal,
|
|
12 GtkSignalFunc button_action, gpointer action_data)
|
|
13 {
|
863
|
14 GtkWidget *dialog;
|
|
15 GtkWidget *dialog_vbox, *dialog_hbox, *dialog_bbox;
|
|
16 GtkWidget *dialog_bbox_b1;
|
|
17 GtkWidget *dialog_textlabel;
|
|
18 GtkWidget *dialog_icon;
|
0
|
19
|
863
|
20 dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
|
21 gtk_window_set_type_hint( GTK_WINDOW(dialog) , GDK_WINDOW_TYPE_HINT_DIALOG );
|
|
22 gtk_window_set_modal( GTK_WINDOW(dialog) , modal );
|
|
23 gtk_window_set_title( GTK_WINDOW(dialog) , title );
|
|
24 gtk_container_set_border_width( GTK_CONTAINER(dialog) , 10 );
|
0
|
25
|
863
|
26 dialog_vbox = gtk_vbox_new( FALSE , 0 );
|
|
27 dialog_hbox = gtk_hbox_new( FALSE , 0 );
|
0
|
28
|
863
|
29 /* icon */
|
|
30 dialog_icon = gtk_image_new_from_stock( GTK_STOCK_DIALOG_INFO , GTK_ICON_SIZE_DIALOG );
|
|
31 gtk_box_pack_start( GTK_BOX(dialog_hbox) , dialog_icon , FALSE , FALSE , 2 );
|
0
|
32
|
863
|
33 /* label */
|
|
34 dialog_textlabel = gtk_label_new( text );
|
|
35 /* gtk_label_set_selectable( GTK_LABEL(dialog_textlabel) , TRUE ); */
|
|
36 gtk_box_pack_start( GTK_BOX(dialog_hbox) , dialog_textlabel , TRUE , TRUE , 2 );
|
0
|
37
|
863
|
38 gtk_box_pack_start( GTK_BOX(dialog_vbox) , dialog_hbox , FALSE , FALSE , 2 );
|
|
39 gtk_box_pack_start( GTK_BOX(dialog_vbox) , gtk_hseparator_new() , FALSE , FALSE , 4 );
|
0
|
40
|
863
|
41 dialog_bbox = gtk_hbutton_box_new();
|
|
42 gtk_button_box_set_layout( GTK_BUTTON_BOX(dialog_bbox) , GTK_BUTTONBOX_END );
|
|
43 dialog_bbox_b1 = gtk_button_new_with_label( button_text );
|
|
44 g_signal_connect_swapped( G_OBJECT(dialog_bbox_b1) , "clicked" ,
|
|
45 G_CALLBACK(gtk_widget_destroy) , dialog );
|
|
46 if ( button_action )
|
|
47 g_signal_connect( G_OBJECT(dialog_bbox_b1) , "clicked" ,
|
|
48 button_action , action_data );
|
|
49 GTK_WIDGET_SET_FLAGS( dialog_bbox_b1 , GTK_CAN_DEFAULT);
|
|
50 gtk_widget_grab_default( dialog_bbox_b1 );
|
0
|
51
|
863
|
52 gtk_container_add( GTK_CONTAINER(dialog_bbox) , dialog_bbox_b1 );
|
|
53 gtk_box_pack_start( GTK_BOX(dialog_vbox) , dialog_bbox , FALSE , FALSE , 0 );
|
0
|
54
|
863
|
55 gtk_container_add( GTK_CONTAINER(dialog) , dialog_vbox );
|
|
56 gtk_widget_show_all(dialog);
|
0
|
57
|
863
|
58 return dialog;
|
0
|
59 }
|
|
60
|
|
61 gboolean
|
|
62 xmms_check_realtime_priority(void)
|
|
63 {
|
|
64 return FALSE;
|
|
65 }
|
|
66
|
|
67 void
|
|
68 xmms_usleep(gint usec)
|
|
69 {
|
|
70 g_usleep(usec);
|
|
71 }
|