glade3 r1881 - in trunk: . plugins/gtk+



Author: tvb
Date: Mon Sep  1 18:05:35 2008
New Revision: 1881
URL: http://svn.gnome.org/viewvc/glade3?rev=1881&view=rev

Log:

	* plugins/gtk+/glade-gtk.c, plugins/gtk+/gtk+.xml.in:
	  response-id now only available for buttons that are in the
	  action area of dialogs (bug 464502)



Modified:
   trunk/ChangeLog
   trunk/plugins/gtk+/glade-gtk.c
   trunk/plugins/gtk+/gtk+.xml.in

Modified: trunk/plugins/gtk+/glade-gtk.c
==============================================================================
--- trunk/plugins/gtk+/glade-gtk.c	(original)
+++ trunk/plugins/gtk+/glade-gtk.c	Mon Sep  1 18:05:35 2008
@@ -1935,6 +1935,38 @@
 	return TRUE;
 }
 
+#define RESPID_INSENSITIVE_MSG _("this property is only for use in dialog action buttons")
+
+static void
+fix_response_id_on_child (GladeWidget *gbox,
+			  GObject     *child,
+			  gboolean     add)
+{
+	GladeWidget *gchild;
+	const gchar *internal_name;
+
+	gchild = glade_widget_get_from_gobject (child);
+
+	/* Fix response id property on child buttons */
+	if (gchild && GTK_IS_BUTTON (child))
+	{
+		if (add && (internal_name = glade_widget_get_internal (gbox)) &&
+		    !strcmp (internal_name, "action_area"))
+		{
+			glade_widget_property_set_sensitive (gchild, "response-id", TRUE, NULL);
+			glade_widget_property_set_enabled (gchild, "response-id", TRUE);
+		}
+		else
+		{
+			glade_widget_property_set_sensitive (gchild, "response-id", FALSE, 
+							     RESPID_INSENSITIVE_MSG);
+			glade_widget_property_set_enabled (gchild, "response-id", FALSE);
+
+		}
+	}
+}
+
+
 void
 glade_gtk_box_add_child (GladeWidgetAdaptor *adaptor,
 			 GObject            *object,
@@ -1987,6 +2019,9 @@
 	/* Packing props arent around when parenting during a glade_widget_dup() */
 	if (gchild && gchild->packing_properties)
 		glade_widget_pack_property_set (gchild, "position", num_children - 1);
+
+
+	fix_response_id_on_child (gbox, child, TRUE);
 }
 
 void
@@ -2009,6 +2044,8 @@
 		glade_widget_property_get (gbox, "size", &size);
 		glade_widget_property_set (gbox, "size", size);
 	}
+
+	fix_response_id_on_child (gbox, child, FALSE);
 }
 
 
@@ -2019,6 +2056,7 @@
 			     GObject            *new_widget)
 {
 	GladeWidget  *gchild;
+	GladeWidget  *gbox;
 
 	GWA_GET_CLASS (GTK_TYPE_CONTAINER)->replace_child (adaptor,
 							   container,
@@ -2031,6 +2069,9 @@
 		 */
 		glade_widget_remove_pack_action (gchild, "remove_slot");
 
+	gbox = glade_widget_get_from_gobject (container);
+	fix_response_id_on_child (gbox, current, FALSE);
+	fix_response_id_on_child (gbox, new_widget, TRUE);
 }
 
 
@@ -4977,6 +5018,13 @@
 				  G_CALLBACK (glade_gtk_button_post_create_parse_finished),
 				  button);
 	}
+
+	/* Disabled response-id until its in an action area */
+	glade_widget_property_set_sensitive (gbutton, "response-id", FALSE, 
+					     RESPID_INSENSITIVE_MSG);
+	glade_widget_property_set_enabled (gbutton, "response-id", FALSE);
+	
+
 }
 
 static void

Modified: trunk/plugins/gtk+/gtk+.xml.in
==============================================================================
--- trunk/plugins/gtk+/gtk+.xml.in	(original)
+++ trunk/plugins/gtk+/gtk+.xml.in	Mon Sep  1 18:05:35 2008
@@ -721,7 +721,7 @@
 
 	<property id="response-id" _name="Response ID" default="0" common="False" ignore="True" save-always="True">
 	  <spec>glade_standard_int_spec</spec>
-	  <_tooltip>The response ID of this button in a dialog (it's NOT useful if this button is not in a GtkDialog)</_tooltip>
+	  <_tooltip>The response ID of this button in a dialog</_tooltip>
 	</property>
 
       	<property id="relief">



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