Mimic the behavior of gtk_dialog_add_action_widget closer, to make

2007-07-03  Johan Dahlin  <jdahlin@async.com.br>

    * gtk/gtkdialog.c (gtk_dialog_buildable_custom_finished): Mimic the behavior
    of gtk_dialog_add_action_widget closer, to make clicking on the buttons
    actually work.


svn path=/trunk/; revision=18349
This commit is contained in:
Johan Dahlin 2007-07-03 03:26:07 +00:00 committed by Johan Dahlin
parent f87424778b
commit 8332387682
2 changed files with 37 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2007-07-03 Johan Dahlin <jdahlin@async.com.br>
* gtk/gtkdialog.c (gtk_dialog_buildable_custom_finished): Mimic the behavior
of gtk_dialog_add_action_widget closer, to make clicking on the buttons
actually work.
2007-07-02 Matthias Clasen <mclasen@redhat.com>
* configure.in: Bump version

View File

@ -1354,11 +1354,14 @@ gtk_dialog_buildable_custom_finished (GtkBuildable *buildable,
GSList *l;
ActionWidgetsSubParserData *parser_data;
GObject *object;
ResponseData* data;
GtkDialog *dialog;
ResponseData *ad;
guint signal_id;
if (strcmp (tagname, "action-widgets"))
return;
dialog = GTK_DIALOG (buildable);
parser_data = (ActionWidgetsSubParserData*)user_data;
parser_data->items = g_slist_reverse (parser_data->items);
@ -1369,14 +1372,36 @@ gtk_dialog_buildable_custom_finished (GtkBuildable *buildable,
object = gtk_builder_get_object (builder, item->widget_name);
if (!object)
{
g_warning ("Unknown object %s specified in action-widgets %s",
g_warning ("Unknown object %s specified in action-widgets of %s",
item->widget_name,
gtk_buildable_get_name (GTK_BUILDABLE (object)));
gtk_buildable_get_name (GTK_BUILDABLE (buildable)));
continue;
}
data = get_response_data (GTK_WIDGET (object), TRUE);
data->response_id = atoi (item->response_id);
ad = get_response_data (GTK_WIDGET (object), TRUE);
ad->response_id = atoi (item->response_id);
if (GTK_IS_BUTTON (object))
signal_id = g_signal_lookup ("clicked", GTK_TYPE_BUTTON);
else
signal_id = GTK_WIDGET_GET_CLASS (object)->activate_signal;
if (signal_id)
{
GClosure *closure;
closure = g_cclosure_new_object (G_CALLBACK (action_widget_activated),
G_OBJECT (dialog));
g_signal_connect_closure_by_id (object,
signal_id,
0,
closure,
FALSE);
}
if (ad->response_id == GTK_RESPONSE_HELP)
gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (dialog->action_area),
GTK_WIDGET (object), TRUE);
g_free (item->widget_name);
g_free (item->response_id);