[gtk+/dialogs] Add a warning if content is added to the action area



commit c8df255adc6cc00cee059b758bd7eb4b91e1b14e
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jan 17 06:26:45 2014 -0500

    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 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkdialog.c b/gtk/gtkdialog.c
index 834aa86..bb0fe97 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]