[glade] GtkDialog: disabled use-header-bar property untill Glade supports GtkHeaderBar GtkAboutDialog: ignor



commit 11e17de473a8282d9cdcba96cab5465e72c19eb5
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date:   Tue Mar 25 17:26:35 2014 -0300

    GtkDialog: disabled use-header-bar property untill Glade supports GtkHeaderBar
    GtkAboutDialog: ignore construct only use-header-bar property to force it to False in the runtime.

 plugins/gtk+/glade-gtk-about-dialog.c |   41 +++++++++++++++++++++++++++++++++
 plugins/gtk+/gtk+.xml.in              |    3 ++
 2 files changed, 44 insertions(+), 0 deletions(-)
---
diff --git a/plugins/gtk+/glade-gtk-about-dialog.c b/plugins/gtk+/glade-gtk-about-dialog.c
index 8daa0ae..f6fcde8 100644
--- a/plugins/gtk+/glade-gtk-about-dialog.c
+++ b/plugins/gtk+/glade-gtk-about-dialog.c
@@ -27,6 +27,47 @@
 
 #include "glade-gtk.h"
 
+GObject *
+glade_gtk_about_dialog_construct_object (GladeWidgetAdaptor *adaptor,
+                                         guint               n_parameters,
+                                         GParameter         *parameters)
+{
+  GParameter *new_params = g_new0 (GParameter, n_parameters + 1);
+  gboolean use_header_bar_set = FALSE;
+  GObject *retval;
+  gint i;
+
+  /* Here we need to force use-header-bar to FALSE in the runtime because
+   * GtkAboutDialog set it to TRUE in its contructor which then triggers a
+   * warning when glade tries to add placeholders in the action area
+   */
+  for (i = 0; i < n_parameters; i++)
+    {
+      new_params[i] = parameters[i];
+
+      if (!g_strcmp0 (new_params[i].name, "use-header-bar"))
+        {
+          /* force the value to 0 */
+          g_value_set_int (&new_params[i].value, 0);
+          use_header_bar_set = TRUE;
+        }
+    }
+
+  if (!use_header_bar_set)
+    {
+      GParameter *use_header = &new_params[n_parameters++];
+
+      /* append value if it was not part of the parameters */
+      use_header->name = "use-header-bar";
+      g_value_init (&use_header->value, G_TYPE_INT);
+      g_value_set_int (&use_header->value, 0);
+    }
+
+  retval = GWA_GET_CLASS (GTK_TYPE_DIALOG)->construct_object (adaptor, n_parameters, new_params);
+  g_free (new_params);
+  return retval;
+}
+
 void
 glade_gtk_about_dialog_read_widget (GladeWidgetAdaptor * adaptor,
                                    GladeWidget * widget, GladeXmlNode * node)
diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in
index 1e06730..0d03019 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -2147,6 +2147,8 @@
           <property id="default-width"  default="320" optional="True" optional-default="False"/>
           <property id="default-height" default="260" optional="True" optional-default="False"/>
           <property id="type-hint" default="GDK_WINDOW_TYPE_HINT_DIALOG" save-always="True"/>
+          <!-- We disabled this property until Glade supports GtkHeaderBar editing -->
+          <property id="use-header-bar" since="3.12" disabled="True"/>
         </properties>
         
       </glade-widget-class>
@@ -2828,6 +2830,7 @@
       
       <glade-widget-class name="GtkAboutDialog" generic-name="aboutdialog" _title="About Dialog">
         
+        <construct-object-function>glade_gtk_about_dialog_construct_object</construct-object-function>
         <read-widget-function>glade_gtk_about_dialog_read_widget</read-widget-function>
         <set-property-function>glade_gtk_about_dialog_set_property</set-property-function>
         


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