Mercurial > audlegacy
comparison libaudacious/util.c @ 863:25f42f39c44c trunk
[svn] new xmms_show_message look
author | giacomo |
---|---|
date | Thu, 23 Mar 2006 17:24:41 -0800 |
parents | cb178e5ad177 |
children | 4ecd967bfd8f |
comparison
equal
deleted
inserted
replaced
862:5d3878484c4f | 863:25f42f39c44c |
---|---|
9 GtkWidget * | 9 GtkWidget * |
10 xmms_show_message(const gchar * title, const gchar * text, | 10 xmms_show_message(const gchar * title, const gchar * text, |
11 const gchar * button_text, gboolean modal, | 11 const gchar * button_text, gboolean modal, |
12 GtkSignalFunc button_action, gpointer action_data) | 12 GtkSignalFunc button_action, gpointer action_data) |
13 { | 13 { |
14 /* FIXME: improper border spacing, for some reason vbox and | 14 GtkWidget *dialog; |
15 * action_area not aligned, button_text totally ignored */ | 15 GtkWidget *dialog_vbox, *dialog_hbox, *dialog_bbox; |
16 GtkWidget *dialog_bbox_b1; | |
17 GtkWidget *dialog_textlabel; | |
18 GtkWidget *dialog_icon; | |
16 | 19 |
17 GtkWidget *dialog, *box, *button; | 20 dialog = gtk_window_new(GTK_WINDOW_TOPLEVEL); |
18 GtkWidget *scrolledwindow, *textview; | 21 gtk_window_set_type_hint( GTK_WINDOW(dialog) , GDK_WINDOW_TYPE_HINT_DIALOG ); |
19 GtkTextBuffer *textbuffer; | 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 ); | |
20 | 25 |
21 dialog = gtk_dialog_new(); | 26 dialog_vbox = gtk_vbox_new( FALSE , 0 ); |
22 gtk_window_set_modal(GTK_WINDOW(dialog), modal); | 27 dialog_hbox = gtk_hbox_new( FALSE , 0 ); |
23 gtk_window_set_title(GTK_WINDOW(dialog), title); | |
24 gtk_window_set_default_size(GTK_WINDOW(dialog), 460, 400); | |
25 | 28 |
26 box = GTK_DIALOG(dialog)->vbox; | 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 ); | |
27 | 32 |
28 scrolledwindow = gtk_scrolled_window_new(NULL, NULL); | 33 /* label */ |
29 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow), | 34 dialog_textlabel = gtk_label_new( text ); |
30 GTK_POLICY_AUTOMATIC, | 35 /* gtk_label_set_selectable( GTK_LABEL(dialog_textlabel) , TRUE ); */ |
31 GTK_POLICY_AUTOMATIC); | 36 gtk_box_pack_start( GTK_BOX(dialog_hbox) , dialog_textlabel , TRUE , TRUE , 2 ); |
32 gtk_box_pack_start(GTK_BOX(box), scrolledwindow, TRUE, TRUE, 0); | |
33 | 37 |
34 textview = gtk_text_view_new(); | 38 gtk_box_pack_start( GTK_BOX(dialog_vbox) , dialog_hbox , FALSE , FALSE , 2 ); |
35 gtk_text_view_set_editable(GTK_TEXT_VIEW(textview), FALSE); | 39 gtk_box_pack_start( GTK_BOX(dialog_vbox) , gtk_hseparator_new() , FALSE , FALSE , 4 ); |
36 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolledwindow), | |
37 textview); | |
38 | 40 |
39 textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview)); | 41 dialog_bbox = gtk_hbutton_box_new(); |
40 gtk_text_buffer_set_text(GTK_TEXT_BUFFER(textbuffer), text, -1); | 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 ); | |
41 | 51 |
42 button = gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CLOSE, | 52 gtk_container_add( GTK_CONTAINER(dialog_bbox) , dialog_bbox_b1 ); |
43 GTK_RESPONSE_CLOSE); | 53 gtk_box_pack_start( GTK_BOX(dialog_vbox) , dialog_bbox , FALSE , FALSE , 0 ); |
44 g_signal_connect_swapped(button, "clicked", | |
45 G_CALLBACK(gtk_widget_destroy), dialog); | |
46 if (button_action) | |
47 g_signal_connect(button, "clicked", button_action, action_data); | |
48 | 54 |
49 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); | 55 gtk_container_add( GTK_CONTAINER(dialog) , dialog_vbox ); |
50 gtk_widget_grab_default(button); | 56 gtk_widget_show_all(dialog); |
51 | 57 |
52 gtk_widget_show_all(dialog); | 58 return dialog; |
53 | |
54 return dialog; | |
55 } | 59 } |
56 | 60 |
57 gboolean | 61 gboolean |
58 xmms_check_realtime_priority(void) | 62 xmms_check_realtime_priority(void) |
59 { | 63 { |