[glade3/glade-3-8] * plugins/gtk+/glade-gtk.c, plugins/gtk+/gtk+.xml.in: Avoid warnings when loading glade files.



commit 21bb93cf752ad1a2e5a0b20c50cac9390c34fa8b
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Thu Dec 16 02:05:09 2010 +0900

    	* plugins/gtk+/glade-gtk.c, plugins/gtk+/gtk+.xml.in: Avoid warnings when
    	  loading glade files.

 ChangeLog                |    3 ++
 plugins/gtk+/glade-gtk.c |   53 ++++++++++++++++++++++++++++++++++++++++-----
 plugins/gtk+/gtk+.xml.in |    2 +
 3 files changed, 52 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index cd0707d..daad768 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -30,6 +30,9 @@
 	* gladeui/glade-project.c: Fix glade_project_fix_object_props() to copy the
 	  list which risks changing order while iterating.
 
+	* plugins/gtk+/glade-gtk.c, plugins/gtk+/gtk+.xml.in: Avoid warnings when
+	  loading glade files.
+
 2010-12-14  Tristan Van Berkom <tristanvb openismus com>
 
 	* Reverted 3.0 commit, now targetting this branch to the final GTK+ 2.x chapter
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index b344c7f..971e426 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -1392,9 +1392,10 @@ glade_gtk_container_set_child_property (GladeWidgetAdaptor *adaptor,
 					const gchar        *property_name,
 					const GValue       *value)
 {
-	gtk_container_child_set_property (GTK_CONTAINER (container),
-					  GTK_WIDGET (child),
-					  property_name, value);
+	if (gtk_widget_get_parent (GTK_WIDGET (child)) == GTK_WIDGET (container))
+		gtk_container_child_set_property (GTK_CONTAINER (container),
+						  GTK_WIDGET (child),
+						  property_name, value);
 }
 
 void
@@ -1404,9 +1405,10 @@ glade_gtk_container_get_child_property (GladeWidgetAdaptor *adaptor,
 					const gchar        *property_name,
 					GValue             *value)
 {
-	gtk_container_child_get_property (GTK_CONTAINER (container),
-					  GTK_WIDGET (child),
-					  property_name, value);
+	if (gtk_widget_get_parent (GTK_WIDGET (child)) == GTK_WIDGET (container))
+		gtk_container_child_get_property (GTK_CONTAINER (container),
+						  GTK_WIDGET (child),
+						  property_name, value);
 }
 
 
@@ -1721,6 +1723,9 @@ glade_gtk_box_set_child_property (GladeWidgetAdaptor *adaptor,
 
 	g_return_if_fail (GLADE_IS_WIDGET (gbox));
 
+	if (gtk_widget_get_parent (GTK_WIDGET (child)) != GTK_WIDGET (container))
+		return;
+
 	/* Get old position */
 	if ((is_position = (strcmp (property_name, "position") == 0)) != FALSE)
 	{
@@ -5833,6 +5838,25 @@ glade_gtk_file_chooser_widget_post_create (GladeWidgetAdaptor *adaptor,
 			      NULL);
 }
 
+void
+glade_gtk_file_chooser_button_set_property (GladeWidgetAdaptor *adaptor,
+					    GObject            *object, 
+					    const gchar        *id,
+					    const GValue       *value)
+{
+	/* Avoid a warning */
+	if (!strcmp (id, "action"))
+	{
+		if (g_value_get_enum (value) == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER ||
+		    g_value_get_enum (value) == GTK_FILE_CHOOSER_ACTION_SAVE)
+		    return;
+	}
+
+	GWA_GET_CLASS (GTK_TYPE_BOX)->set_property (adaptor,
+						    object,
+						    id, value);
+}
+
 /* ----------------------------- GtkFontButton ------------------------------ */
 /* Use the font-buttons launch dialog to actually set the font-name
  * glade property through the glade-command api.
@@ -8899,6 +8923,13 @@ glade_gtk_combo_box_set_property (GladeWidgetAdaptor *adaptor,
 {
 	if (!strcmp (id, "items"))
 		glade_gtk_combo_box_set_items (object, value);
+	else if (!strcmp (id, "entry-text-column"))
+	{
+		/* Avoid warnings */
+		if (g_value_get_int (value) >= 0)
+			gtk_combo_box_set_entry_text_column (GTK_COMBO_BOX (object),
+							     g_value_get_int (value));
+	}
 	else
 		GWA_GET_CLASS (GTK_TYPE_CONTAINER)->set_property (adaptor,
 								  object,
@@ -8970,6 +9001,16 @@ glade_gtk_spin_button_set_adjustment (GObject *object, const GValue *value)
 	if (adjustment && GTK_IS_ADJUSTMENT (adjustment))
 	{
 		adj = GTK_ADJUSTMENT (adjustment);
+
+		if (gtk_adjustment_get_page_size (adj) > 0)
+		{
+			GladeWidget *gadj = glade_widget_get_from_gobject (adj);
+
+			/* Silently set any spin-button adjustment page size to 0 */
+			glade_widget_property_set (gadj, "page-size", 0.0F);
+			gtk_adjustment_set_page_size (adj, 0);
+		}
+
 		gtk_spin_button_set_adjustment (GTK_SPIN_BUTTON (object), adj);
 		gtk_spin_button_set_value (GTK_SPIN_BUTTON (object),
 					   gtk_adjustment_get_value (adj));
diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in
index 103248d..20b8140 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -1011,6 +1011,7 @@ embedded in another object</_tooltip>
     </glade-widget-class>
 
     <glade-widget-class name="GtkFileChooserButton" generic-name="filechooserbutton" _title="File Chooser Button">
+      <set-property-function>glade_gtk_file_chooser_button_set_property</set-property-function>
 
       <signals>
 	<signal id="file-set" since="2.12"/>
@@ -1033,6 +1034,7 @@ embedded in another object</_tooltip>
 	<property id="preview-widget" parentless-widget="True" libglade-unsupported="True"/>
 	<property id="filter" libglade-unsupported="True"/>
 	<property id="create-folders" since="2.18"/>
+	<property id="select-multiple" disabled="True"/>
       </properties>
     </glade-widget-class>
 



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