[glade] Make n-row and n-column save false. Fixes bug #660607 "Warnings when using GtkGrid created in Glade



commit 2d29c14479ad06f19d6c961479fcfcc0577880cd
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date:   Thu Oct 6 15:09:10 2011 -0300

    Make n-row and n-column save false.
    Fixes bug #660607 "Warnings when using GtkGrid created in Glade 3.10"

 ChangeLog                     |   37 ++++++++++++++++++++++++-------------
 gladeui/glade-project.c       |    6 +++---
 plugins/gtk+/glade-gtk-grid.c |   34 ++++++++++++++++++++++++++++++++++
 plugins/gtk+/gtk+.xml.in      |    4 ++--
 4 files changed, 63 insertions(+), 18 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c7c7cd1..e5706da 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-10-06  Juan Pablo Ugarte <juanpablougarte gmail com>
+
+	* plugins/gtk+/gtk+.xml.in: Make n-row and n-column save false.
+	  Fixes bug #660607 "Warnings when using GtkGrid created in Glade 3.10"
+
+	* gladeui/glade-project.c:
+	  Emit parse-finished signal before setting loading state to false.
+
+	* plugins/gtk+/glade-gtk-grid.c: infer n-row and n-column virtual
+	  properties value from children packing props. 
+
 2011-10-05  Tristan Van Berkom <tvb gnome org>
 
 	* plugins/gtk+/glade-gtk-grid.c: Update placeholders when a grid child's
@@ -11,27 +22,27 @@
 2011-10-04  Juan Pablo Ugarte <juanpablougarte gmail com>
 
         * gladeui/glade-previewer.c:
-          o Fixed bug #660874 "glade-previewer fails to open UI files without top windows"
-          o Fixed bug 660872 "glade-previewer crashes on non-existent files"
-          o Fixed runtime warnings in option parsing.
+	  o Fixed bug #660874 "glade-previewer fails to open UI files without top windows"
+	  o Fixed bug #660872 "glade-previewer crashes on non-existent files"
+	  o Fixed runtime warnings in option parsing.
 
-        * gladeui/glade-base-editor.c, gladeui/glade-project.c: fixed spelling errors
+	* gladeui/glade-base-editor.c, gladeui/glade-project.c: fixed spelling errors
 
 2011-09-19  Juan Pablo Ugarte <juanpablougarte gmail com>
 
-        * gladeui/glade-object-stub.[ch]: Added new object type used to remember
-          unknown objects in xml files.
+	* gladeui/glade-object-stub.[ch]: Added new object type used to remember
+	  unknown objects in xml files.
 
-        * gladeui/glade-utils.c: made glade_util_ui_message () accept markup strings.
+	* gladeui/glade-utils.c: made glade_util_ui_message () accept markup strings.
         
-        * gladeui/glade-xml-utils.[ch]: added new function glade_xml_node_copy()
+	* gladeui/glade-xml-utils.[ch]: added new function glade_xml_node_copy()
 
-        * gladeui/glade-widget.c:
-          o glade_widget_read() create object stub if class is unknown.
-          o glade_widget_write() used saved xml to dump stub objects.
+	* gladeui/glade-widget.c:
+	  o glade_widget_read() create object stub if class is unknown.
+	  o glade_widget_write() used saved xml to dump stub objects.
         
-        * glade/gladeui/glade-project.c: make GladeProject remember unknown catalogs
-          to avoid loosing requirements when loading/saving a file with unknown objects. 
+	* glade/gladeui/glade-project.c: make GladeProject remember unknown catalogs
+	  to avoid loosing requirements when loading/saving a file with unknown objects. 
 
 2011-09-19 Ignacio Casal Quinteiro <icq gnome org>
 
diff --git a/gladeui/glade-project.c b/gladeui/glade-project.c
index 29df1bb..75965d6 100644
--- a/gladeui/glade-project.c
+++ b/gladeui/glade-project.c
@@ -1641,15 +1641,15 @@ glade_project_load_internal (GladeProject *project)
    */
   glade_project_fix_object_props (project);
 
+  /* Emit "parse-finished" signal */
+  g_signal_emit (project, glade_project_signals[PARSE_FINISHED], 0);
+
   /* Reset project status here too so that you get a clean
    * slate after calling glade_project_open().
    */
   priv->modified = FALSE;
   priv->loading = FALSE;
 
-  /* Emit "parse-finished" signal */
-  g_signal_emit (project, glade_project_signals[PARSE_FINISHED], 0);
-
   /* Update ui with versioning info
    */
   glade_project_verify_project_for_ui (project);
diff --git a/plugins/gtk+/glade-gtk-grid.c b/plugins/gtk+/glade-gtk-grid.c
index b8a247a..7fe1b77 100644
--- a/plugins/gtk+/glade-gtk-grid.c
+++ b/plugins/gtk+/glade-gtk-grid.c
@@ -419,6 +419,35 @@ glade_gtk_grid_configure_end (GladeFixed * fixed,
   return TRUE;
 }
 
+static void
+glade_gtk_grid_parse_finished (GladeProject *project, GObject *container)
+{
+  GladeWidget *gwidget = glade_widget_get_from_gobject (container);
+  GladeGridAttachments attach;
+  GList *list, *children;
+  gint row = 0, column = 0, n_row = 0, n_column = 0;
+
+  children = gtk_container_get_children (GTK_CONTAINER (container));
+
+  for (list = children; list; list = list->next)
+    {
+      GtkWidget *widget = list->data;
+
+      glade_gtk_grid_get_child_attachments (GTK_WIDGET (container), widget, &attach);
+
+      n_row = attach.top_attach + attach.height;
+      n_column = attach.left_attach + attach.width;
+      
+      if (row < n_row) row = n_row;
+      if (column < n_column) column = n_column;
+    }
+
+  if (n_column) glade_widget_property_set (gwidget, "n-columns", n_column);
+  if (n_row) glade_widget_property_set (gwidget, "n-rows", n_row);
+
+  g_list_free (children);
+}
+
 void
 glade_gtk_grid_post_create (GladeWidgetAdaptor * adaptor,
                              GObject * container, GladeCreateReason reason)
@@ -433,6 +462,11 @@ glade_gtk_grid_post_create (GladeWidgetAdaptor * adaptor,
 
   g_signal_connect (G_OBJECT (gwidget), "configure-end",
                     G_CALLBACK (glade_gtk_grid_configure_end), container);
+
+  if (reason == GLADE_CREATE_LOAD)
+    g_signal_connect (glade_widget_get_project (gwidget), "parse-finished",
+		      G_CALLBACK (glade_gtk_grid_parse_finished),
+		      container);
 }
 
 static gboolean
diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in
index 3b8d897..4103a46 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -1470,13 +1470,13 @@ embedded in another object</_tooltip>
       </packing-actions>
 
       <properties>
-	<property id="n-rows" _name="Rows" default="3" query="True" needs-sync="True">
+	<property id="n-rows" _name="Rows" default="3" query="True" needs-sync="True" save="False">
 	  <parameter-spec>
 	    <type>GParamUInt</type>
 	  </parameter-spec>
 	  <_tooltip>The number of rows for this grid</_tooltip>
 	</property>
-	<property id="n-columns" _name="Columns" default="3" query="True" needs-sync="True">
+	<property id="n-columns" _name="Columns" default="3" query="True" needs-sync="True" save="False">
 	  <parameter-spec>
 	    <type>GParamUInt</type>
 	  </parameter-spec>



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