pidgin: cfd47fe5: A newly created widget for a request fie...

sadrul at pidgin.im sadrul at pidgin.im
Tue Apr 29 15:05:50 EDT 2008


-----------------------------------------------------------------
Revision: cfd47fe5763a354f0c9e938ce1e829c7fb3af714
Ancestor: a43a75447f7cd677cdc63c4bc960190b5802d016
Author: sadrul at pidgin.im
Date: 2008-04-29T18:56:04
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/cfd47fe5763a354f0c9e938ce1e829c7fb3af714

Modified files:
        pidgin/gtkrequest.c

ChangeLog: 

A newly created widget for a request field may want to enable/disable the
default action button. Create the action buttons before the field widgets
to avoid a runtime warning message from that.

-------------- next part --------------
============================================================
--- pidgin/gtkrequest.c	ef21b39ea8d991bf484bc2227f9ea61401fcc8c1
+++ pidgin/gtkrequest.c	bce544647b0db2b7bc2a30962158f6a5b79593af
@@ -1120,6 +1120,16 @@ pidgin_request_fields(const char *title,
 	gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
 	gtk_widget_show(img);
 
+	/* Cancel button */
+	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 = 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);
+
 	/* Setup the vbox */
 	vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER);
 	gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0);
@@ -1393,18 +1403,8 @@ pidgin_request_fields(const char *title,
 
 	g_object_unref(sg);
 
-	/* Cancel button */
-	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 = 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);
-
 	if (!purple_request_fields_all_required_filled(fields))
-		gtk_widget_set_sensitive(button, FALSE);
+		gtk_widget_set_sensitive(data->ok_button, FALSE);
 
 	pidgin_auto_parent_window(win);
 


More information about the Commits mailing list