[glade3] * gladeui/glade-editor-property.c, gladeui/glade-property.c, gladeui/glade-widget.c, plugins/gtk



commit 0de9fa5f81efd122f1de029270898704af2ec8a2
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Mon Dec 20 18:47:56 2010 +0900

    	* gladeui/glade-editor-property.c, gladeui/glade-property.c, gladeui/glade-widget.c,
    	  plugins/gtk+/glade-gtk.c: Fixing some discrepincies searching for properties as
    	  regular properties or packing properties. Now the conflicting "position" property
    	  on a GtkPaned widget packed into a GtkBox widget works properly (bug 637475).

 ChangeLog                       |    5 +++++
 gladeui/glade-editor-property.c |    7 ++++++-
 gladeui/glade-property.c        |    7 ++++---
 gladeui/glade-widget.c          |    3 +--
 plugins/gtk+/glade-gtk.c        |    3 +--
 5 files changed, 17 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 528e349..434cf67 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,11 @@
 	* gladeui/glade-editor.c: Fixed class header of GladeEditor to update when
 	  widgets unload (patch by Marco Diego Aurélio Mesquita, bug 637541).
 
+	* gladeui/glade-editor-property.c, gladeui/glade-property.c, gladeui/glade-widget.c,
+	  plugins/gtk+/glade-gtk.c: Fixing some discrepincies searching for properties as
+	  regular properties or packing properties. Now the conflicting "position" property
+	  on a GtkPaned widget packed into a GtkBox widget works properly (bug 637475).
+
 2010-12-19  Tristan Van Berkom <tristanvb openismus com>
 
 	* plugins/gtk+/glade-gtk.c: Fix alpha_sort_box_children() to give a consistent
diff --git a/gladeui/glade-editor-property.c b/gladeui/glade-editor-property.c
index 2fc8422..ffc545d 100644
--- a/gladeui/glade-editor-property.c
+++ b/gladeui/glade-editor-property.c
@@ -3765,12 +3765,17 @@ glade_editor_property_load_by_widget (GladeEditorProperty *eprop,
 	if (widget)
 	{
 		/* properties are allowed to be missing on some internal widgets */
-		property = glade_widget_get_property (widget, eprop->klass->id);
+		if (eprop->klass->packing)
+			property = glade_widget_get_pack_property (widget, eprop->klass->id);
+		else
+			property = glade_widget_get_property (widget, eprop->klass->id);
 
 		glade_editor_property_load (eprop, property);
 
 		if (property) 
 		{
+			g_assert (eprop->klass == property->klass);
+
 			gtk_widget_show (GTK_WIDGET (eprop));
 			gtk_widget_show (GTK_WIDGET (eprop->item_label));
 		}
diff --git a/gladeui/glade-property.c b/gladeui/glade-property.c
index 2e881c8..7bb0c17 100644
--- a/gladeui/glade-property.c
+++ b/gladeui/glade-property.c
@@ -245,7 +245,8 @@ glade_property_set_value_impl (GladeProperty *property, const GValue *value)
 #if 0
 	{
 		g_print ("***************************************************\n"); 
-		g_print ("Setting property %s on %s ..\n", 
+		g_print ("Setting %s property %s on %s ..\n", 
+			 property->klass->packing ? "packing" : "normal",
 			 property->klass->id,
 			 property->widget ? property->widget->name : "unknown");
 
@@ -351,8 +352,8 @@ glade_property_sync_impl (GladeProperty *property)
 	 * (other properties may be used for convenience in the plugin).
 	 */
 	if ((property->klass->packing && 
-	     property != glade_widget_get_pack_property (property->widget, property->klass->id)) ||
-	    property != glade_widget_get_property (property->widget, property->klass->id))
+	     !glade_widget_get_pack_property (property->widget, property->klass->id)) ||
+	    !glade_widget_get_property (property->widget, property->klass->id))
 		return;
 
 	property->syncing++;
diff --git a/gladeui/glade-widget.c b/gladeui/glade-widget.c
index 132a4d1..faa4bae 100644
--- a/gladeui/glade-widget.c
+++ b/gladeui/glade-widget.c
@@ -1335,8 +1335,7 @@ glade_widget_copy_packing_props (GladeWidget *parent,
 	for (l = child->packing_properties; l && l->data; l = l->next)
 	{
 		dup_prop  = GLADE_PROPERTY(l->data);
-		orig_prop =
-			glade_widget_get_property (template_widget, dup_prop->klass->id);
+		orig_prop = glade_widget_get_pack_property (template_widget, dup_prop->klass->id);
 		glade_property_set_value (dup_prop, orig_prop->value);
 	}
 }
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index 55625b2..d360eeb 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -1744,7 +1744,6 @@ glade_gtk_box_set_child_property (GladeWidgetAdaptor *adaptor,
 		
 		/* Get the real value */
 		new_position = g_value_get_int (value);
-
 	}
 
 	if (is_position && recursion == FALSE)
@@ -1862,7 +1861,7 @@ glade_gtk_box_get_first_blank (GtkBox *box)
 		{
 			gint gwidget_position;
 			GladeProperty *property =
-				glade_widget_get_property (gwidget, "position");
+				glade_widget_get_pack_property (gwidget, "position");
 			gwidget_position = g_value_get_int (property->value);
 
 			if (gwidget_position > position)



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