Mercurial > pidgin.yaz
diff pidgin/gtkrequest.c @ 21652:eb2d5ba2a50d
Add a utility function pidgin_dialog_add_button to add buttons to a dialog
created by pidgin_create_dialog. This removes a lot of code duplication.
Anyone using this branch should keep an eye on the buttons on the dialogs to
make sure they are enabled/disabled/displayed/hidden/marinated correctly.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Tue, 27 Nov 2007 00:15:49 +0000 |
parents | 2a2496044eef |
children | c88a3f2dbb52 |
line wrap: on
line diff
--- a/pidgin/gtkrequest.c Mon Nov 26 10:23:41 2007 +0000 +++ b/pidgin/gtkrequest.c Tue Nov 27 00:15:49 2007 +0000 @@ -1059,7 +1059,6 @@ GtkWidget *vbox; GtkWidget *vbox2; GtkWidget *hbox; - GtkWidget *bbox; GtkWidget *frame; GtkWidget *label; GtkWidget *table; @@ -1382,34 +1381,16 @@ g_object_unref(sg); - /* Button box. */ - bbox = pidgin_dialog_get_action_area(GTK_DIALOG(win)); - gtk_box_set_spacing(GTK_BOX(bbox), PIDGIN_HIG_BOX_SPACE); - gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END); - /* Cancel button */ - button = gtk_button_new_from_stock(text_to_stock(cancel_text)); - gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); - gtk_widget_show(button); - - g_signal_connect(G_OBJECT(button), "clicked", - G_CALLBACK(multifield_cancel_cb), data); - + button = pidgin_dialog_add_button(GTK_DIALOG(win), text_to_stock(cancel_text), G_CALLBACK(multifield_cancel_cb), data); GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); /* OK button */ - button = gtk_button_new_from_stock(text_to_stock(ok_text)); - gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0); - gtk_widget_show(button); - + button = pidgin_dialog_add_button(GTK_DIALOG(win), text_to_stock(ok_text), G_CALLBACK(multifield_ok_cb), data); data->ok_button = button; - GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); gtk_window_set_default(GTK_WINDOW(win), button); - g_signal_connect(G_OBJECT(button), "clicked", - G_CALLBACK(multifield_ok_cb), data); - if (!purple_request_fields_all_required_filled(fields)) gtk_widget_set_sensitive(button, FALSE);