From c8df255adc6cc00cee059b758bd7eb4b91e1b14e Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 17 Jan 2014 06:26:45 -0500 Subject: Add a warning if content is added to the action area We also show the action area in this case, to avoid broken situations. --- gtk/gtkdialog.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gtk/gtkdialog.c b/gtk/gtkdialog.c index 834aa86e51..bb0fe97d27 100644 --- a/gtk/gtkdialog.c +++ b/gtk/gtkdialog.c @@ -247,6 +247,7 @@ set_use_header_bar (GtkDialog *dialog, priv->use_header_bar = use_header_bar; } +/* A convenience helper for built-in dialogs */ void gtk_dialog_set_use_header_bar_from_setting (GtkDialog *dialog) { @@ -260,8 +261,15 @@ gtk_dialog_set_use_header_bar_from_setting (GtkDialog *dialog) } static void -add_cb (GtkContainer *container, GtkWidget *widget) +add_cb (GtkContainer *container, + GtkWidget *widget, + GtkDialog *dialog) { + GtkDialogPrivate *priv = dialog->priv; + + if (priv->use_header_bar) + g_warning ("Content added to the action area of a dialog using header bars"); + gtk_widget_show (GTK_WIDGET (container)); } @@ -278,7 +286,7 @@ apply_use_header_bar (GtkDialog *dialog) if (!priv->use_header_bar) gtk_window_set_titlebar (GTK_WINDOW (dialog), NULL); if (priv->use_header_bar) - g_signal_connect (priv->action_area, "add", add_cb, NULL); + g_signal_connect (priv->action_area, "add", G_CALLBACK (add_cb), dialog); } static void -- cgit v1.2.1