Mercurial > pidgin.yaz
diff pidgin/gtkutils.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/gtkutils.c Mon Nov 26 10:23:41 2007 +0000 +++ b/pidgin/gtkutils.c Tue Nov 27 00:15:49 2007 +0000 @@ -189,6 +189,18 @@ 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) {