[gtk+] GtkDialog: Be more careful in handling the headerbar
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] GtkDialog: Be more careful in handling the headerbar
- Date: Thu, 17 Jul 2014 16:59:16 +0000 (UTC)
commit 24e707315f36ff872b99e9a68cc73ff78e46598a
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Jul 17 12:53:54 2014 -0400
GtkDialog: Be more careful in handling the headerbar
Just because an action widget has a parent thats a headerbar,
it is not guaranteed that it is 'our' headerbar. Add some
assertions to enforce this.
gtk/gtkdialog.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkdialog.c b/gtk/gtkdialog.c
index edd8702..4e6dbc0 100644
--- a/gtk/gtkdialog.c
+++ b/gtk/gtkdialog.c
@@ -356,6 +356,8 @@ apply_response_for_header_bar (GtkDialog *dialog,
GtkDialogPrivate *priv = dialog->priv;
GtkPackType pack;
+ g_assert (gtk_widget_get_parent (child) == priv->headerbar);
+
if (response_id == GTK_RESPONSE_CANCEL || response_id == GTK_RESPONSE_HELP)
pack = GTK_PACK_START;
else
@@ -390,6 +392,8 @@ apply_response_for_action_area (GtkDialog *dialog,
{
GtkDialogPrivate *priv = dialog->priv;
+ g_assert (gtk_widget_get_parent (child) == priv->action_area);
+
if (response_id == GTK_RESPONSE_HELP)
gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (priv->action_area), child, TRUE);
}
@@ -1786,6 +1790,7 @@ gtk_dialog_buildable_custom_finished (GtkBuildable *buildable,
gpointer user_data)
{
GtkDialog *dialog = GTK_DIALOG (buildable);
+ GtkDialogPrivate *priv = dialog->priv;
GSList *l;
ActionWidgetsSubParserData *parser_data;
GObject *object;
@@ -1843,9 +1848,9 @@ gtk_dialog_buildable_custom_finished (GtkBuildable *buildable,
if (is_action)
{
- if (GTK_IS_HEADER_BAR (gtk_widget_get_parent (GTK_WIDGET (object))))
+ if (gtk_widget_get_parent (GTK_WIDGET (object)) == priv->headerbar)
apply_response_for_header_bar (dialog, GTK_WIDGET (object), ad->response_id);
- else
+ else if (gtk_widget_get_parent (GTK_WIDGET (object)) == priv->action_area)
apply_response_for_action_area (dialog, GTK_WIDGET (object), ad->response_id);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]