glade3 r1818 - in trunk: . gladeui



Author: tvb
Date: Sun May 11 15:04:45 2008
New Revision: 1818
URL: http://svn.gnome.org/viewvc/glade3?rev=1818&view=rev

Log:

	* gladeui/glade-widget.c: Applied patch from Pavel Kostyuchenko to prevent
	  hangs in anjuta (bug 531585).

	* gladeui/glade-property.c, gladeui/glade-property-class.c: Applied patch from 
	  Pavel Kostyuchenko to unify duplicate implementation property comparisons (bug 532013)



Modified:
   trunk/ChangeLog
   trunk/gladeui/glade-property-class.c
   trunk/gladeui/glade-property-class.h
   trunk/gladeui/glade-property.c
   trunk/gladeui/glade-widget.c

Modified: trunk/gladeui/glade-property-class.c
==============================================================================
--- trunk/gladeui/glade-property-class.c	(original)
+++ trunk/gladeui/glade-property-class.c	Sun May 11 15:04:45 2008
@@ -1592,8 +1592,8 @@
  */
 gint
 glade_property_class_compare (GladePropertyClass *klass,
-			      GValue             *value1,
-			      GValue             *value2)
+			      const GValue       *value1,
+			      const GValue       *value2)
 {
 	gint retval;
 	
@@ -1616,7 +1616,24 @@
 		g_free (val2);
 	}
 	else
+	{
+		if (G_IS_PARAM_SPEC_STRING (klass->pspec))
+		{
+			const gchar *value_str1, *value_str2;
+
+			/* in string specs; NULL and '\0' are 
+			 * treated as equivalent.
+			 */
+			value_str1 = g_value_get_string (value1);
+			value_str2 = g_value_get_string (value2);
+
+			if (value_str1 == NULL && value_str2 && value_str2[0] == '\0')
+				return 0;
+			else if (value_str2 == NULL && value_str1 && value_str1[0] == '\0')
+				return 0;
+		}
 		retval = g_param_values_cmp (klass->pspec, value1, value2);
+	}
 	
 	return retval;
 }

Modified: trunk/gladeui/glade-property-class.h
==============================================================================
--- trunk/gladeui/glade-property-class.h	(original)
+++ trunk/gladeui/glade-property-class.h	Sun May 11 15:04:45 2008
@@ -215,8 +215,9 @@
 								  GValue             *value);
 
 gint                glade_property_class_compare                 (GladePropertyClass *klass,
-								  GValue             *value1,
-								  GValue             *value2);
+								  const GValue       *value1,
+								  const GValue       *value2);
+
 G_END_DECLS
 
 #endif /* __GLADE_PROPERTY_CLASS_H__ */

Modified: trunk/gladeui/glade-property.c
==============================================================================
--- trunk/gladeui/glade-property.c	(original)
+++ trunk/gladeui/glade-property.c	Sun May 11 15:04:45 2008
@@ -111,24 +111,8 @@
 glade_property_equals_value_impl (GladeProperty *property,
 				  const GValue  *value)
 {
-	if (G_IS_PARAM_SPEC_STRING (property->klass->pspec))
-	{
-		const gchar *prop_str, *value_str;
-
-		/* in string specs; NULL and '\0' are 
-		 * treated as equivalent.
-		 */
-		prop_str = g_value_get_string (property->value);
-		value_str = g_value_get_string (value);
-
-		if (prop_str == NULL && value_str && value_str[0] == '\0')
-			return TRUE;
-		else if (value_str == NULL && prop_str && prop_str[0] == '\0')
-			return TRUE;
-	}
-
-	return !g_param_values_cmp (property->klass->pspec,
-				    property->value, value);
+	return !glade_property_class_compare (property->klass,
+					      property->value, value);
 }
 
 

Modified: trunk/gladeui/glade-widget.c
==============================================================================
--- trunk/gladeui/glade-widget.c	(original)
+++ trunk/gladeui/glade-widget.c	Sun May 11 15:04:45 2008
@@ -1831,14 +1831,15 @@
 	glade_widget_debug_real (widget, 0);
 }
 
-static gboolean
-glade_widget_show_idle (GladeWidget *widget)
+static void
+glade_widget_add_to_layout (GladeWidget *widget, GtkWidget *layout)
 {
-	/* This could be dangerous */ 
-	if (GLADE_IS_WIDGET (widget))
-		glade_widget_show (widget);
+	if (gtk_bin_get_child (GTK_BIN (layout)) != NULL)
+		gtk_container_remove (GTK_CONTAINER (layout), gtk_bin_get_child (GTK_BIN (layout)));
 
-	return FALSE;
+	gtk_container_add (GTK_CONTAINER (layout), GTK_WIDGET (widget->object));
+
+	gtk_widget_show_all (GTK_WIDGET (widget->object));
 }
 
 /**
@@ -1861,22 +1862,14 @@
 		view = glade_design_view_get_from_project (glade_widget_get_project (widget));
 		layout = GTK_WIDGET (glade_design_view_get_layout (view));
 
-		/* This case causes a black window */
-		if (layout && !GTK_WIDGET_REALIZED (layout))
-		{
-			/* XXX Dangerous !!! give her a little kick */
-			g_idle_add ((GSourceFunc)glade_widget_show_idle, widget);
+		if (!layout)
 			return;
-		}
-		else if (!layout)
-			return;
-		
-		if (gtk_bin_get_child (GTK_BIN (layout)) != NULL)
-			gtk_container_remove (GTK_CONTAINER (layout), gtk_bin_get_child (GTK_BIN (layout)));
 		
-		gtk_container_add (GTK_CONTAINER (layout), GTK_WIDGET (widget->object));
-
-		gtk_widget_show_all (GTK_WIDGET (widget->object));
+		if (GTK_WIDGET_REALIZED (layout))
+			glade_widget_add_to_layout (widget, layout);
+		else
+			g_signal_connect_data (layout, "map", (GCallback) glade_widget_add_to_layout, 
+					       widget, NULL, G_CONNECT_AFTER | G_CONNECT_SWAPPED);
 
 	} else if (GTK_IS_WIDGET (widget->object))
 	{



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