diff options
author | Matthias Clasen <mclasen@redhat.com> | 2014-06-06 13:00:06 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2014-06-06 13:00:06 -0400 |
commit | 02a44c454c7ed85e9ef1c4c379cb13e9a74cde1d (patch) | |
tree | e97877854db5ff82ba01a9b31c07a983de0f8d39 /gtk/gtkdialog.c | |
parent | 9c6c4fdeb844310ed77104d8f4640c619c46326c (diff) | |
download | gtk+-02a44c454c7ed85e9ef1c4c379cb13e9a74cde1d.tar.gz |
GtkDialog: Be a little more careful about button placement
We were applying response based heuristics, even if the button
is explicitly put in the headerbar. That broke button placement
in some epiphany dialogs, such as the Cookies one. Therefore,
restrict the heuristics to action widgets that are added through
gtk_widget_add_action_widget() or <child type="action">, where it
is not possible to specify placement explicitly.
Diffstat (limited to 'gtk/gtkdialog.c')
-rw-r--r-- | gtk/gtkdialog.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/gtk/gtkdialog.c b/gtk/gtkdialog.c index a97282bc33..4ab47fb4ab 100644 --- a/gtk/gtkdialog.c +++ b/gtk/gtkdialog.c @@ -1859,6 +1859,7 @@ gtk_dialog_buildable_custom_finished (GtkBuildable *buildable, for (l = parser_data->items; l; l = l->next) { ActionWidgetInfo *item = l->data; + gboolean is_action; object = gtk_builder_get_object (builder, item->widget_name); if (!object) @@ -1869,6 +1870,14 @@ gtk_dialog_buildable_custom_finished (GtkBuildable *buildable, continue; } + /* If the widget already has reponse data at this point, it + * was either added by gtk_dialog_add_action_widget(), or via + * <child type="action"> or by moving an action area child + * to the header bar. In these cases, apply placement heuristics + * based on the response id. + */ + is_action = get_response_data (GTK_WIDGET (object), FALSE) != NULL; + ad = get_response_data (GTK_WIDGET (object), TRUE); ad->response_id = item->response_id; @@ -1886,10 +1895,13 @@ gtk_dialog_buildable_custom_finished (GtkBuildable *buildable, g_signal_connect_closure_by_id (object, signal_id, 0, closure, FALSE); } - if (GTK_IS_HEADER_BAR (gtk_widget_get_parent (GTK_WIDGET (object)))) - apply_response_for_header_bar (dialog, GTK_WIDGET (object), ad->response_id); - else - apply_response_for_action_area (dialog, GTK_WIDGET (object), ad->response_id); + if (is_action) + { + if (GTK_IS_HEADER_BAR (gtk_widget_get_parent (GTK_WIDGET (object)))) + apply_response_for_header_bar (dialog, GTK_WIDGET (object), ad->response_id); + else + apply_response_for_action_area (dialog, GTK_WIDGET (object), ad->response_id); + } if (item->is_default) gtk_widget_grab_default (GTK_WIDGET (object)); |