im.pidgin.pidgin.next.minor: fc3ac49080bc1d251523759b0c774906c90f142c
sadrul at pidgin.im
sadrul at pidgin.im
Mon Nov 26 19:20:54 EST 2007
-----------------------------------------------------------------
Revision: fc3ac49080bc1d251523759b0c774906c90f142c
Ancestor: 67f728447ef19d5a594cbbd8bd9e7b8f3df6778c
Author: sadrul at pidgin.im
Date: 2007-11-27T00:15:49
Branch: im.pidgin.pidgin.next.minor
Modified files:
ChangeLog.API pidgin/gtkaccount.c pidgin/gtkcertmgr.c
pidgin/gtkft.c pidgin/gtkpounce.c pidgin/gtkprefs.c
pidgin/gtkprivacy.c pidgin/gtkrequest.c pidgin/gtkroomlist.c
pidgin/gtksavedstatuses.c pidgin/gtkutils.c
pidgin/gtkutils.h
ChangeLog:
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.
-------------- next part --------------
============================================================
--- ChangeLog.API fb2040b2a1d8bbf99ec3d6deecc5e5ca7ca7ab55
+++ ChangeLog.API 52bdd2272f65bbc2ede73e6cb2e86b84faa45021
@@ -11,6 +11,8 @@ version 2.4.0 (??/??/????):
added utility functions pidgin_dialog_get_vbox_with_properties,
pidgin_dialog_get_vbox, pidgin_dialog_get_action_area to access the
contents in the created dialog. (Peter 'fmoo' Ruibal)
+ * pidgin_dialog_add_button to add buttons to a dialog created by
+ pidgin_create_dialog.
* GTK_IMHTML_NO_SMILEY for GtkIMHtmlOptions means not to look for
smileys in the text. (Florian 'goutnet' Delizy)
============================================================
--- pidgin/gtkaccount.c f42d18b07e3fc1c52f2d7af8ec5497a67e53c92d
+++ pidgin/gtkaccount.c 027bb9fba5b855f5a4f4baaf1b9037253fb2152f
@@ -1437,7 +1437,6 @@ pidgin_account_dialog_show(PidginAccount
GtkWidget *win;
GtkWidget *main_vbox;
GtkWidget *vbox;
- GtkWidget *bbox;
GtkWidget *dbox;
GtkWidget *notebook;
GtkWidget *button;
@@ -1509,8 +1508,6 @@ pidgin_account_dialog_show(PidginAccount
if (!dialog->prpl_info || !dialog->prpl_info->register_user)
gtk_widget_hide(button);
-
-
/* Setup the page with 'Advanced'. */
dialog->bottom_vbox = dbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER);
gtk_container_set_border_width(GTK_CONTAINER(dbox), PIDGIN_HIG_BORDER);
@@ -1522,28 +1519,13 @@ pidgin_account_dialog_show(PidginAccount
add_protocol_options(dialog, dbox);
add_proxy_options(dialog, dbox);
- /* Setup the 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(GTK_STOCK_CANCEL);
- gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
- gtk_widget_show(button);
+ pidgin_dialog_add_button(GTK_DIALOG(win), GTK_STOCK_CANCEL, G_CALLBACK(cancel_account_prefs_cb), dialog);
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(cancel_account_prefs_cb), dialog);
-
/* Save button */
- button = gtk_button_new_from_stock(GTK_STOCK_SAVE);
- gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
-
+ button = pidgin_dialog_add_button(GTK_DIALOG(win), GTK_STOCK_SAVE, G_CALLBACK(ok_account_prefs_cb), dialog);
if (dialog->account == NULL)
gtk_widget_set_sensitive(button, FALSE);
-
- gtk_widget_show(button);
-
dialog->ok_button = button;
/* Set up DND */
@@ -1557,9 +1539,6 @@ pidgin_account_dialog_show(PidginAccount
g_signal_connect(G_OBJECT(dialog->window), "drag_data_received",
G_CALLBACK(account_dnd_recv), dialog);
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(ok_account_prefs_cb), dialog);
-
/* Show the window. */
gtk_widget_show(win);
}
@@ -2309,7 +2288,6 @@ pidgin_accounts_window_show(void)
AccountsWindow *dialog;
GtkWidget *win;
GtkWidget *vbox;
- GtkWidget *bbox;
GtkWidget *sw;
GtkWidget *button;
int width, height;
@@ -2340,47 +2318,22 @@ pidgin_accounts_window_show(void)
gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);
gtk_widget_show(sw);
- /* 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);
-
/* Add button */
- button = gtk_button_new_from_stock(GTK_STOCK_ADD);
- gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
- gtk_widget_show(button);
+ pidgin_dialog_add_button(GTK_DIALOG(win), GTK_STOCK_ADD, G_CALLBACK(add_account_cb), dialog);
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(add_account_cb), dialog);
-
/* Modify button */
- button = gtk_button_new_from_stock(PIDGIN_STOCK_MODIFY);
+ button = pidgin_dialog_add_button(GTK_DIALOG(win), PIDGIN_STOCK_MODIFY, G_CALLBACK(modify_account_cb), dialog);
dialog->modify_button = button;
- gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
gtk_widget_set_sensitive(button, FALSE);
- gtk_widget_show(button);
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(modify_account_cb), dialog);
-
/* Delete button */
- button = gtk_button_new_from_stock(GTK_STOCK_DELETE);
+ button = pidgin_dialog_add_button(GTK_DIALOG(win), GTK_STOCK_DELETE, G_CALLBACK(ask_delete_account_cb), dialog);
dialog->delete_button = button;
- gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
gtk_widget_set_sensitive(button, FALSE);
- gtk_widget_show(button);
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(ask_delete_account_cb), dialog);
-
/* Close button */
- button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
- gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
- gtk_widget_show(button);
+ pidgin_dialog_add_button(GTK_DIALOG(win), GTK_STOCK_CLOSE, G_CALLBACK(close_accounts_cb), dialog);
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(close_accounts_cb), dialog);
-
purple_signal_connect(pidgin_account_get_handle(), "account-modified",
accounts_window,
PURPLE_CALLBACK(account_modified_cb), accounts_window);
============================================================
--- pidgin/gtkcertmgr.c a2d0d5d401df6fca525cb869c349f79a5a0b4594
+++ pidgin/gtkcertmgr.c 92983dc52c9ebb8de4e725619b31acb5974d1ddb
@@ -559,7 +559,6 @@ pidgin_certmgr_show(void)
CertMgrDialog *dlg;
GtkWidget *win;
GtkWidget *vbox;
- GtkWidget *bbox;
/* Enumerate all the certificates on file */
{
@@ -620,17 +619,9 @@ pidgin_certmgr_show(void)
0);
gtk_widget_show(dlg->notebook);
- /* Box for the close button */
- 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);
-
/* Close button */
- dlg->closebutton = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
- gtk_box_pack_start(GTK_BOX(bbox), dlg->closebutton, FALSE, FALSE, 0);
- gtk_widget_show(dlg->closebutton);
- g_signal_connect(G_OBJECT(dlg->closebutton), "clicked",
- G_CALLBACK(certmgr_close_cb), dlg);
+ dlg->closebutton = pidgin_dialog_add_button(GTK_DIALOG(win), GTK_STOCK_CLOSE,
+ G_CALLBACK(certmgr_close_cb), dlg);
/* Add the defined certificate managers */
/* TODO: Find a way of determining whether each is shown or not */
============================================================
--- pidgin/gtkft.c 715a12d1604f320d362964832a53379c312951e8
+++ pidgin/gtkft.c a572f6de2488e0e5190efab93748b3c564d0cd92
@@ -745,7 +745,6 @@ pidgin_xfer_dialog_new(void)
PidginXferDialog *dialog;
GtkWidget *window;
GtkWidget *vbox1, *vbox2;
- GtkWidget *bbox;
GtkWidget *sw;
GtkWidget *button;
GtkWidget *expander;
@@ -810,69 +809,35 @@ pidgin_xfer_dialog_new(void)
gtk_container_add(GTK_CONTAINER(expander), table);
gtk_widget_show(table);
- /* Now the button box for the buttons */
- bbox = pidgin_dialog_get_action_area(GTK_DIALOG(window));
- gtk_box_set_spacing(GTK_BOX(bbox), PIDGIN_HIG_BOX_SPACE);
- gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
-
/* Open button */
- button = gtk_button_new_from_stock(GTK_STOCK_OPEN);
+ button = pidgin_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_OPEN, G_CALLBACK(open_button_cb), dialog);
gtk_widget_set_sensitive(button, FALSE);
- gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
- gtk_widget_show(button);
dialog->open_button = button;
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(open_button_cb), dialog);
-
/* Pause button */
- button = gtk_button_new_with_mnemonic(_("_Pause"));
+ button = pidgin_dialog_add_button(GTK_DIALOG(window), _("_Pause"), G_CALLBACK(pause_button_cb), dialog);
gtk_widget_set_sensitive(button, FALSE);
- gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
- gtk_widget_show(button);
dialog->pause_button = button;
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(pause_button_cb), dialog);
-
/* Resume button */
- button = gtk_button_new_with_mnemonic(_("_Resume"));
+ button = pidgin_dialog_add_button(GTK_DIALOG(window), _("_Resume"), G_CALLBACK(resume_button_cb), dialog);
gtk_widget_set_sensitive(button, FALSE);
- gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
- gtk_widget_show(button);
dialog->resume_button = button;
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(resume_button_cb), dialog);
-
/* Remove button */
- button = gtk_button_new_from_stock(GTK_STOCK_REMOVE);
- gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
+ button = pidgin_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_REMOVE, G_CALLBACK(remove_button_cb), dialog);
gtk_widget_hide(button);
dialog->remove_button = button;
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(remove_button_cb), dialog);
-
/* Stop button */
- button = gtk_button_new_from_stock(GTK_STOCK_STOP);
- gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
- gtk_widget_show(button);
+ button = pidgin_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_STOP, G_CALLBACK(stop_button_cb), dialog);
gtk_widget_set_sensitive(button, FALSE);
dialog->stop_button = button;
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(stop_button_cb), dialog);
-
/* Close button */
- button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
- gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
- gtk_widget_show(button);
+ button = pidgin_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_CLOSE, G_CALLBACK(close_button_cb), dialog);
dialog->close_button = button;
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(close_button_cb), dialog);
-
#ifdef _WIN32
g_signal_connect(G_OBJECT(dialog->window), "show",
G_CALLBACK(winpidgin_ensure_onscreen), dialog->window);
============================================================
--- pidgin/gtkpounce.c 600e82c7ee27c82c8dc29ae1df3bdebe20f31854
+++ pidgin/gtkpounce.c 31c2ff93021037416850247ff685f8fd368d3799
@@ -1317,7 +1317,6 @@ pidgin_pounces_manager_show(void)
pidgin_pounces_manager_show(void)
{
PouncesManager *dialog;
- GtkWidget *bbox;
GtkWidget *button;
GtkWidget *list;
GtkWidget *vbox;
@@ -1349,52 +1348,28 @@ pidgin_pounces_manager_show(void)
list = create_pounces_list(dialog);
gtk_box_pack_start(GTK_BOX(vbox), list, TRUE, TRUE, 0);
- /* 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);
-
/* Add button */
- button = gtk_button_new_from_stock(GTK_STOCK_ADD);
- gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
+ button = pidgin_dialog_add_button(GTK_DIALOG(win), GTK_STOCK_ADD, G_CALLBACK(pounces_manager_add_cb), dialog);
gtk_widget_set_sensitive(button, (purple_accounts_get_all() != NULL));
+
purple_signal_connect(purple_connections_get_handle(), "signed-on",
pounces_manager, PURPLE_CALLBACK(pounces_manager_connection_cb), button);
purple_signal_connect(purple_connections_get_handle(), "signed-off",
pounces_manager, PURPLE_CALLBACK(pounces_manager_connection_cb), button);
- gtk_widget_show(button);
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(pounces_manager_add_cb), dialog);
-
/* Modify button */
- button = gtk_button_new_from_stock(PIDGIN_STOCK_MODIFY);
- dialog->modify_button = button;
- gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
+ button = pidgin_dialog_add_button(GTK_DIALOG(win), PIDGIN_STOCK_MODIFY, G_CALLBACK(pounces_manager_modify_cb), dialog);
gtk_widget_set_sensitive(button, FALSE);
- gtk_widget_show(button);
+ dialog->modify_button = button;
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(pounces_manager_modify_cb), dialog);
-
/* Delete button */
- button = gtk_button_new_from_stock(GTK_STOCK_DELETE);
- dialog->delete_button = button;
- gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
+ button = pidgin_dialog_add_button(GTK_DIALOG(win), GTK_STOCK_DELETE, G_CALLBACK(pounces_manager_delete_cb), dialog);
gtk_widget_set_sensitive(button, FALSE);
- gtk_widget_show(button);
+ dialog->delete_button = button;
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(pounces_manager_delete_cb), dialog);
-
/* Close button */
- button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
- gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
- gtk_widget_show(button);
+ pidgin_dialog_add_button(GTK_DIALOG(win), GTK_STOCK_CLOSE, G_CALLBACK(pounces_manager_close_cb), dialog);
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(pounces_manager_close_cb), dialog);
-
gtk_widget_show(win);
}
============================================================
--- pidgin/gtkprefs.c d9e28ce358e5d3a949a9c2af92a6a9f63a04ae58
+++ pidgin/gtkprefs.c 3e975952acebf1968149ec71911fb95c2a151420
@@ -2149,7 +2149,6 @@ void pidgin_prefs_show(void)
void pidgin_prefs_show(void)
{
GtkWidget *vbox;
- GtkWidget *bbox;
GtkWidget *notebook;
GtkWidget *button;
@@ -2176,16 +2175,9 @@ void pidgin_prefs_show(void)
gtk_box_pack_start (GTK_BOX (vbox), notebook, FALSE, FALSE, 0);
gtk_widget_show(prefsnotebook);
- /* The buttons to press! */
- bbox = pidgin_dialog_get_action_area(GTK_DIALOG(prefs));
- gtk_box_set_spacing(GTK_BOX(bbox), PIDGIN_HIG_BOX_SPACE);
- gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
-
- button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
+ button = pidgin_dialog_add_button(GTK_DIALOG(prefs), GTK_STOCK_CLOSE, NULL, NULL);
g_signal_connect_swapped(G_OBJECT(button), "clicked",
G_CALLBACK(gtk_widget_destroy), prefs);
- gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
- gtk_widget_show(button);
prefs_notebook_init();
============================================================
--- pidgin/gtkprivacy.c 97e5e3761fea66095ad8d7d2363b9ce7c9b220b3
+++ pidgin/gtkprivacy.c 87598088896025efadf81ce9eb2748ca54dde583
@@ -45,6 +45,7 @@ typedef struct
GtkWidget *add_button;
GtkWidget *remove_button;
GtkWidget *clear_button;
+ GtkWidget *close_button;
GtkWidget *button_box;
GtkWidget *allow_widget;
@@ -259,19 +260,22 @@ type_changed_cb(GtkOptionMenu *optmenu,
gtk_widget_hide(dialog->allow_widget);
gtk_widget_hide(dialog->block_widget);
- gtk_widget_hide(dialog->button_box);
+ gtk_widget_hide_all(dialog->button_box);
if (new_type == PURPLE_PRIVACY_ALLOW_USERS) {
gtk_widget_show(dialog->allow_widget);
- gtk_widget_show(dialog->button_box);
+ gtk_widget_show_all(dialog->button_box);
dialog->in_allow_list = TRUE;
}
else if (new_type == PURPLE_PRIVACY_DENY_USERS) {
gtk_widget_show(dialog->block_widget);
- gtk_widget_show(dialog->button_box);
+ gtk_widget_show_all(dialog->button_box);
dialog->in_allow_list = FALSE;
}
+ gtk_widget_show_all(dialog->close_button);
+ gtk_widget_show(dialog->button_box);
+
purple_blist_schedule_save();
pidgin_blist_refresh(purple_get_blist());
}
@@ -355,7 +359,6 @@ privacy_dialog_new(void)
privacy_dialog_new(void)
{
PidginPrivacyDialog *dialog;
- GtkWidget *bbox;
GtkWidget *hbox;
GtkWidget *vbox;
GtkWidget *button;
@@ -431,50 +434,27 @@ privacy_dialog_new(void)
gtk_box_pack_start(GTK_BOX(vbox), dialog->block_widget, TRUE, TRUE, 0);
/* Add the button box for Add, Remove, Clear */
- dialog->button_box = bbox = gtk_hbutton_box_new();
- gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_SPREAD);
- gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
+ dialog->button_box = pidgin_dialog_get_action_area(GTK_DIALOG(dialog->win));
/* Add button */
- button = gtk_button_new_from_stock(GTK_STOCK_ADD);
+ button = pidgin_dialog_add_button(GTK_DIALOG(dialog->win), GTK_STOCK_ADD, G_CALLBACK(add_cb), dialog);
dialog->add_button = button;
- gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
- gtk_widget_show(button);
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(add_cb), dialog);
-
/* Remove button */
- button = gtk_button_new_from_stock(GTK_STOCK_REMOVE);
+ button = pidgin_dialog_add_button(GTK_DIALOG(dialog->win), GTK_STOCK_REMOVE, G_CALLBACK(remove_cb), dialog);
dialog->remove_button = button;
gtk_widget_set_sensitive(button, FALSE);
- gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
- gtk_widget_show(button);
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(remove_cb), dialog);
-
/* Clear button */
- button = gtk_button_new_from_stock(GTK_STOCK_CLEAR);
+ button = pidgin_dialog_add_button(GTK_DIALOG(dialog->win), GTK_STOCK_CLEAR, G_CALLBACK(clear_cb), dialog);
dialog->clear_button = button;
- gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
- gtk_widget_show(button);
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(clear_cb), dialog);
-
- /* Another button box. */
- bbox = pidgin_dialog_get_action_area(GTK_DIALOG(dialog->win));
- gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
-
/* Close button */
- button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
- gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
- gtk_widget_show(button);
+ button = pidgin_dialog_add_button(GTK_DIALOG(dialog->win), GTK_STOCK_CLOSE, G_CALLBACK(close_cb), dialog);
+ dialog->close_button = button;
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(close_cb), dialog);
-
+ type_changed_cb(GTK_OPTION_MENU(dialog->type_menu), dialog);
+#if 0
if (dialog->account->perm_deny == PURPLE_PRIVACY_ALLOW_USERS) {
gtk_widget_show(dialog->allow_widget);
gtk_widget_show(dialog->button_box);
@@ -485,7 +465,7 @@ privacy_dialog_new(void)
gtk_widget_show(dialog->button_box);
dialog->in_allow_list = FALSE;
}
-
+#endif
return dialog;
}
============================================================
--- pidgin/gtkrequest.c 176b4189c55972b3135b81829aebd2f735ac9e10
+++ pidgin/gtkrequest.c 72f053d9098adc6c1cc9cc0ac25607db12c64405
@@ -1059,7 +1059,6 @@ pidgin_request_fields(const char *title,
GtkWidget *vbox;
GtkWidget *vbox2;
GtkWidget *hbox;
- GtkWidget *bbox;
GtkWidget *frame;
GtkWidget *label;
GtkWidget *table;
@@ -1382,34 +1381,16 @@ pidgin_request_fields(const char *title,
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);
============================================================
--- pidgin/gtkroomlist.c c082c6c9955eda74216a67816c83004556846d3b
+++ pidgin/gtkroomlist.c a58bf2307f9abe23ebfbde8539f003b4738e1439
@@ -741,12 +741,9 @@ pidgin_roomlist_dialog_new_with_account(
gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
/* stop button */
- dialog->stop_button = gtk_button_new_from_stock(GTK_STOCK_STOP);
- gtk_box_pack_start(GTK_BOX(bbox), dialog->stop_button, FALSE, FALSE, 0);
- g_signal_connect(G_OBJECT(dialog->stop_button), "clicked",
+ dialog->stop_button = pidgin_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_STOP,
G_CALLBACK(stop_button_cb), dialog);
gtk_widget_set_sensitive(dialog->stop_button, FALSE);
- gtk_widget_show(dialog->stop_button);
/* list button */
dialog->list_button = pidgin_pixbuf_button_from_stock(_("_Get List"), GTK_STOCK_REFRESH,
@@ -775,11 +772,8 @@ pidgin_roomlist_dialog_new_with_account(
gtk_widget_show(dialog->join_button);
/* close button */
- dialog->close_button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
- gtk_box_pack_start(GTK_BOX(bbox), dialog->close_button, FALSE, FALSE, 0);
- g_signal_connect(G_OBJECT(dialog->close_button), "clicked",
+ dialog->close_button = pidgin_dialog_add_button(GTK_DIALOG(window), GTK_STOCK_CLOSE,
G_CALLBACK(close_button_cb), dialog);
- gtk_widget_show(dialog->close_button);
/* show the dialog window and return the dialog */
gtk_widget_show(dialog->window);
============================================================
--- pidgin/gtksavedstatuses.c 315dd6ef4bae54f87240df231b13f65e0e408170
+++ pidgin/gtksavedstatuses.c 58b34ddffa3910c02d0de6f0de8b45d59879cf1f
@@ -611,9 +611,6 @@ pidgin_status_window_show(void)
/* 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);
- gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, TRUE, 0);
/* Use button */
button = pidgin_pixbuf_button_from_stock(_("_Use"), GTK_STOCK_EXECUTE,
@@ -626,37 +623,24 @@ pidgin_status_window_show(void)
G_CALLBACK(status_window_use_cb), dialog);
/* Add button */
- button = gtk_button_new_from_stock(GTK_STOCK_ADD);
- gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
+ pidgin_dialog_add_button(GTK_DIALOG(win), GTK_STOCK_ADD,
+ G_CALLBACK(status_window_add_cb), dialog);
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(status_window_add_cb), dialog);
-
/* Modify button */
- button = gtk_button_new_from_stock(PIDGIN_STOCK_MODIFY);
+ button = pidgin_dialog_add_button(GTK_DIALOG(win), PIDGIN_STOCK_MODIFY,
+ G_CALLBACK(status_window_modify_cb), dialog);
dialog->modify_button = button;
- gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
- gtk_widget_set_sensitive(button, FALSE);
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(status_window_modify_cb), dialog);
-
/* Delete button */
- button = gtk_button_new_from_stock(GTK_STOCK_DELETE);
+ button = pidgin_dialog_add_button(GTK_DIALOG(win), GTK_STOCK_DELETE,
+ G_CALLBACK(status_window_delete_cb), dialog);
dialog->delete_button = button;
- gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
gtk_widget_set_sensitive(button, FALSE);
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(status_window_delete_cb), dialog);
-
/* Close button */
- button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
- gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
+ pidgin_dialog_add_button(GTK_DIALOG(win), GTK_STOCK_CLOSE,
+ G_CALLBACK(status_window_close_cb), dialog);
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(status_window_close_cb), dialog);
-
purple_signal_connect(purple_savedstatuses_get_handle(),
"savedstatus-changed", status_window,
PURPLE_CALLBACK(current_status_changed), dialog);
@@ -1260,17 +1244,13 @@ pidgin_status_editor_show(gboolean edit,
gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
/* Cancel button */
- button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
- gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
+ pidgin_dialog_add_button(GTK_DIALOG(win), GTK_STOCK_CANCEL,
+ G_CALLBACK(status_editor_cancel_cb), dialog);
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(status_editor_cancel_cb), dialog);
-
/* Use button */
button = pidgin_pixbuf_button_from_stock(_("_Use"), GTK_STOCK_EXECUTE,
PIDGIN_BUTTON_HORIZONTAL);
gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
-
g_signal_connect(G_OBJECT(button), "clicked",
G_CALLBACK(status_editor_ok_cb), dialog);
@@ -1281,20 +1261,16 @@ pidgin_status_editor_show(gboolean edit,
gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
if (dialog->original_title == NULL)
gtk_widget_set_sensitive(button, FALSE);
-
g_signal_connect(G_OBJECT(button), "clicked",
G_CALLBACK(status_editor_ok_cb), dialog);
/* Save button */
- button = gtk_button_new_from_stock(GTK_STOCK_SAVE);
- dialog->save_button = GTK_BUTTON(button);
- gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
+ button = pidgin_dialog_add_button(GTK_DIALOG(win), GTK_STOCK_SAVE,
+ G_CALLBACK(status_editor_ok_cb), dialog);
if (dialog->original_title == NULL)
gtk_widget_set_sensitive(button, FALSE);
+ dialog->save_button = GTK_BUTTON(button);
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(status_editor_ok_cb), dialog);
-
gtk_widget_show_all(win);
g_object_unref(sg);
}
@@ -1444,8 +1420,6 @@ edit_substatus(StatusEditor *status_edit
char *tmp;
SubStatusEditor *dialog;
GtkSizeGroup *sg;
- GtkWidget *bbox;
- GtkWidget *button;
GtkWidget *combo;
GtkWidget *hbox;
GtkWidget *frame;
@@ -1539,25 +1513,14 @@ edit_substatus(StatusEditor *status_edit
dialog->toolbar = GTK_IMHTMLTOOLBAR(toolbar);
gtk_box_pack_start(GTK_BOX(hbox), frame, TRUE, TRUE, 0);
- /* 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(GTK_STOCK_CANCEL);
- gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
+ pidgin_dialog_add_button(GTK_DIALOG(win), GTK_STOCK_CANCEL,
+ G_CALLBACK(substatus_editor_cancel_cb), dialog);
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(substatus_editor_cancel_cb), dialog);
-
/* OK button */
- button = gtk_button_new_from_stock(GTK_STOCK_OK);
- gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
+ pidgin_dialog_add_button(GTK_DIALOG(win), GTK_STOCK_OK,
+ G_CALLBACK(substatus_editor_ok_cb), dialog);
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(substatus_editor_ok_cb), dialog);
-
/* Seed the input widgets with the current values */
/* Only look at the saved status if we can't find it in the parent status dialog's substatuses model */
============================================================
--- pidgin/gtkutils.c 55c05eec8fcd5de9c56899c97f6f9f522f53e440
+++ pidgin/gtkutils.c 0d9cb43e8df70ba43c59d2b83535c04ea6ef7f79
@@ -189,6 +189,18 @@ GtkWidget *pidgin_dialog_get_action_area
return GTK_DIALOG(dialog)->action_area;
}
+GtkWidget *pidgin_dialog_add_button(GtkDialog *dialog, const char *label,
+ GCallback callback, gpointer callbackdata)
+{
+ GtkWidget *button = gtk_button_new_from_stock(label);
+ GtkWidget *bbox = pidgin_dialog_get_action_area(dialog);
+ gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
+ if (callback)
+ g_signal_connect(G_OBJECT(button), "clicked", callback, callbackdata);
+ gtk_widget_show(button);
+ return button;
+}
+
GtkWidget *
pidgin_create_imhtml(gboolean editable, GtkWidget **imhtml_ret, GtkWidget **toolbar_ret, GtkWidget **sw_ret)
{
============================================================
--- pidgin/gtkutils.h f6fcb381a4d69e4e71de38f652fe6411f5276b44
+++ pidgin/gtkutils.h 7c98029c3be852990b736ce6ee3b988c534ad943
@@ -153,6 +153,20 @@ GtkWidget *pidgin_dialog_get_vbox(GtkDia
GtkWidget *pidgin_dialog_get_vbox(GtkDialog *dialog);
/**
+ * Add a button to a dialog created by #pidgin_create_dialog.
+ *
+ * @param dialog The dialog window
+ * @param label The stock-id or the label for the button
+ * @param callback The callback function for the button
+ * @param callbackdata The user data for the callback function
+ *
+ * @return The created button.
+ * @since 2.4.0
+ */
+GtkWidget *pidgin_dialog_add_button(GtkDialog *dialog, const char *label,
+ GCallback callback, gpointer callbackdata);
+
+/**
* Retrieves the action area (button box) from a pidgin dialog window
*
* @param dialog The dialog window
More information about the Commits
mailing list