# HG changeset patch # User Sean Egan # Date 1187825258 0 # Node ID bd18c02bba9f9e8d38d2a3145ec7850a00d9ffc2 # Parent 756dad225d9062cfd4d5c7d382282e3233f3403e Use GtkDialog more often. Thanks nix_nix. Fixes #2618 diff -r 756dad225d90 -r bd18c02bba9f pidgin/gtknotify.c --- a/pidgin/gtknotify.c Wed Aug 22 23:16:28 2007 +0000 +++ b/pidgin/gtknotify.c Wed Aug 22 23:27:38 2007 +0000 @@ -589,16 +589,16 @@ char label_text[2048]; char *linked_text, *primary_esc, *secondary_esc; - window = pidgin_create_window(title, PIDGIN_HIG_BORDER, NULL, TRUE); - gtk_window_set_type_hint(GTK_WINDOW(window), GDK_WINDOW_TYPE_HINT_DIALOG); + window = gtk_dialog_new(); + gtk_window_set_title(GTK_WINDOW(window), title); + gtk_container_set_border_width(GTK_CONTAINER(window), PIDGIN_HIG_BORDER); + gtk_window_set_resizable(GTK_WINDOW(window), TRUE); g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(formatted_close_cb), NULL); /* Setup the main vbox */ - vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER); - gtk_container_add(GTK_CONTAINER(window), vbox); - gtk_widget_show(vbox); + vbox = GTK_DIALOG(window)->vbox; /* Setup the descriptive label */ primary_esc = g_markup_escape_text(primary, -1); @@ -630,9 +630,7 @@ gtk_widget_show(frame); /* Add the Close button. */ - button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); - gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0); - gtk_widget_show(button); + button = gtk_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE); gtk_widget_grab_focus(button); g_signal_connect_swapped(G_OBJECT(button), "clicked", @@ -708,7 +706,6 @@ guint i; GtkWidget *vbox; - GtkWidget *button_area; GtkWidget *label; GtkWidget *sw; PidginNotifySearchResultsData *data; @@ -723,16 +720,16 @@ data->results = results; /* Create the window */ - window = pidgin_create_window(title ? title :_("Search Results"), PIDGIN_HIG_BORDER, NULL, TRUE); - gtk_window_set_type_hint(GTK_WINDOW(window), GDK_WINDOW_TYPE_HINT_DIALOG); + window = gtk_dialog_new(); + gtk_window_set_title(GTK_WINDOW(window), title ? title :_("Search Results")); + gtk_container_set_border_width(GTK_CONTAINER(window), PIDGIN_HIG_BORDER); + gtk_window_set_resizable(GTK_WINDOW(window), TRUE); g_signal_connect_swapped(G_OBJECT(window), "delete_event", G_CALLBACK(searchresults_close_cb), data); /* Setup the main vbox */ - vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER); - gtk_container_add(GTK_CONTAINER(window), vbox); - gtk_widget_show(vbox); + vbox = GTK_DIALOG(window)->vbox; /* Setup the descriptive label */ primary_esc = (primary != NULL) ? g_markup_escape_text(primary, -1) : NULL; @@ -796,13 +793,6 @@ renderer, "text", i, NULL); } - /* Setup the button area */ - button_area = gtk_hbutton_box_new(); - gtk_box_pack_start(GTK_BOX(vbox), button_area, FALSE, FALSE, 0); - gtk_button_box_set_layout(GTK_BUTTON_BOX(button_area), GTK_BUTTONBOX_END); - gtk_box_set_spacing(GTK_BOX(button_area), PIDGIN_HIG_BORDER); - gtk_widget_show(button_area); - for (i = 0; i < g_list_length(results->buttons); i++) { PurpleNotifySearchButton *b = g_list_nth_data(results->buttons, i); GtkWidget *button = NULL; @@ -815,22 +805,22 @@ } break; case PURPLE_NOTIFY_BUTTON_CONTINUE: - button = gtk_button_new_from_stock(GTK_STOCK_GO_FORWARD); + button = gtk_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_GO_FORWARD, GTK_RESPONSE_NONE); break; case PURPLE_NOTIFY_BUTTON_ADD: - button = gtk_button_new_from_stock(GTK_STOCK_ADD); + button = gtk_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_ADD, GTK_RESPONSE_NONE); break; case PURPLE_NOTIFY_BUTTON_INFO: - button = gtk_button_new_from_stock(PIDGIN_STOCK_TOOLBAR_USER_INFO); + button = gtk_dialog_add_button(GTK_DIALOG(window), PIDGIN_STOCK_TOOLBAR_USER_INFO, GTK_RESPONSE_NONE); break; case PURPLE_NOTIFY_BUTTON_IM: - button = gtk_button_new_from_stock(PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW); + button = gtk_dialog_add_button(GTK_DIALOG(window), PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW, GTK_RESPONSE_NONE); break; case PURPLE_NOTIFY_BUTTON_JOIN: - button = gtk_button_new_from_stock(PIDGIN_STOCK_CHAT); + button = gtk_dialog_add_button(GTK_DIALOG(window), PIDGIN_STOCK_CHAT, GTK_RESPONSE_NONE); break; case PURPLE_NOTIFY_BUTTON_INVITE: - button = gtk_button_new_from_stock(PIDGIN_STOCK_INVITE); + button = gtk_dialog_add_button(GTK_DIALOG(window), PIDGIN_STOCK_INVITE, GTK_RESPONSE_NONE); break; default: purple_debug_warning("gtknotify", "Incorrect button type: %d\n", b->type); @@ -838,9 +828,6 @@ if (button != NULL) { PidginNotifySearchResultsButtonData *bd; - gtk_box_pack_start(GTK_BOX(button_area), button, FALSE, FALSE, 0); - gtk_widget_show(button); - bd = g_new0(PidginNotifySearchResultsButtonData, 1); bd->button = b; bd->data = data; @@ -852,9 +839,7 @@ } /* Add the Close button */ - close_button = gtk_button_new_from_stock(GTK_STOCK_CLOSE); - gtk_box_pack_start(GTK_BOX(button_area), close_button, FALSE, FALSE, 0); - gtk_widget_show(close_button); + close_button = gtk_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE); g_signal_connect_swapped(G_OBJECT(close_button), "clicked", G_CALLBACK(searchresults_close_cb), data); diff -r 756dad225d90 -r bd18c02bba9f pidgin/gtkpounce.c --- a/pidgin/gtkpounce.c Wed Aug 22 23:16:28 2007 +0000 +++ b/pidgin/gtkpounce.c Wed Aug 22 23:27:38 2007 +0000 @@ -467,7 +467,6 @@ PidginPounceDialog *dialog; GtkWidget *window; GtkWidget *label; - GtkWidget *bbox; GtkWidget *vbox1, *vbox2; GtkWidget *hbox; GtkWidget *button; @@ -513,17 +512,16 @@ sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL); /* Create the window. */ - dialog->window = window = pidgin_create_window((cur_pounce == NULL ? _("New Buddy Pounce") : _("Edit Buddy Pounce")), - PIDGIN_HIG_BORDER, "buddy_pounce", FALSE) ; - gtk_window_set_type_hint(GTK_WINDOW(window), GDK_WINDOW_TYPE_HINT_DIALOG); + dialog->window = window = gtk_dialog_new(); + gtk_window_set_title(GTK_WINDOW(window), (cur_pounce == NULL ? _("New Buddy Pounce") : _("Edit Buddy Pounce"))); + gtk_window_set_role(GTK_WINDOW(window), "buddy_pounce"); + gtk_container_set_border_width(GTK_CONTAINER(dialog->window), PIDGIN_HIG_BORDER); g_signal_connect(G_OBJECT(window), "delete_event", G_CALLBACK(delete_win_cb), dialog); /* Create the parent vbox for everything. */ - vbox1 = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER); - gtk_container_add(GTK_CONTAINER(window), vbox1); - gtk_widget_show(vbox1); + vbox1 = GTK_DIALOG(window)->vbox; /* Create the vbox that will contain all the prefs stuff. */ vbox2 = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); @@ -808,26 +806,13 @@ gtk_widget_show(dialog->on_away); gtk_widget_show(dialog->save_pounce); - /* Now the button box! */ - bbox = gtk_hbutton_box_new(); - gtk_box_set_spacing(GTK_BOX(bbox), PIDGIN_HIG_BOX_SPACE); - gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); - gtk_box_pack_end(GTK_BOX(vbox1), bbox, FALSE, FALSE, 0); - gtk_widget_show(bbox); - /* Cancel button */ - button = gtk_button_new_from_stock(GTK_STOCK_CANCEL); - gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); - gtk_widget_show(button); - + button = gtk_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(cancel_cb), dialog); /* Save button */ - dialog->save_button = button = gtk_button_new_from_stock(GTK_STOCK_SAVE); - gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); - gtk_widget_show(button); - + dialog->save_button = button = gtk_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_SAVE, GTK_RESPONSE_OK); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(save_pounce_cb), dialog);