comparison pidgin/gtkrequest.c @ 22785:d6220093543b

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.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Tue, 29 Apr 2008 18:56:04 +0000
parents 9df0a8c7c9b7
children 862382aa6086
comparison
equal deleted inserted replaced
22784:cf88a302fa88 22785:d6220093543b
1117 img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_QUESTION, 1117 img = gtk_image_new_from_stock(PIDGIN_STOCK_DIALOG_QUESTION,
1118 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_HUGE)); 1118 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_HUGE));
1119 gtk_misc_set_alignment(GTK_MISC(img), 0, 0); 1119 gtk_misc_set_alignment(GTK_MISC(img), 0, 0);
1120 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0); 1120 gtk_box_pack_start(GTK_BOX(hbox), img, FALSE, FALSE, 0);
1121 gtk_widget_show(img); 1121 gtk_widget_show(img);
1122
1123 /* Cancel button */
1124 button = pidgin_dialog_add_button(GTK_DIALOG(win), text_to_stock(cancel_text), G_CALLBACK(multifield_cancel_cb), data);
1125 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
1126
1127 /* OK button */
1128 button = pidgin_dialog_add_button(GTK_DIALOG(win), text_to_stock(ok_text), G_CALLBACK(multifield_ok_cb), data);
1129 data->ok_button = button;
1130 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
1131 gtk_window_set_default(GTK_WINDOW(win), button);
1122 1132
1123 /* Setup the vbox */ 1133 /* Setup the vbox */
1124 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER); 1134 vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER);
1125 gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0); 1135 gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 0);
1126 gtk_widget_show(vbox); 1136 gtk_widget_show(vbox);
1391 } 1401 }
1392 } 1402 }
1393 1403
1394 g_object_unref(sg); 1404 g_object_unref(sg);
1395 1405
1396 /* Cancel button */
1397 button = pidgin_dialog_add_button(GTK_DIALOG(win), text_to_stock(cancel_text), G_CALLBACK(multifield_cancel_cb), data);
1398 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
1399
1400 /* OK button */
1401 button = pidgin_dialog_add_button(GTK_DIALOG(win), text_to_stock(ok_text), G_CALLBACK(multifield_ok_cb), data);
1402 data->ok_button = button;
1403 GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
1404 gtk_window_set_default(GTK_WINDOW(win), button);
1405
1406 if (!purple_request_fields_all_required_filled(fields)) 1406 if (!purple_request_fields_all_required_filled(fields))
1407 gtk_widget_set_sensitive(button, FALSE); 1407 gtk_widget_set_sensitive(data->ok_button, FALSE);
1408 1408
1409 pidgin_auto_parent_window(win); 1409 pidgin_auto_parent_window(win);
1410 1410
1411 gtk_widget_show(win); 1411 gtk_widget_show(win);
1412 1412