[glade/glade-3-8] Fixed Bug #679589 "Use Action Appearance not supported for GTK 2.12 but added to widgets in Glade 3.



commit 76f410b12de2ce97d2e57ebc366738d8a9303ede
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date:   Fri Jul 13 20:08:24 2012 -0300

    Fixed Bug #679589 "Use Action Appearance not supported for GTK 2.12 but added to widgets in Glade 3.8.2"
    Made sure use-action-appearance is not saved if there is no action defined
    
    Conflicts:
    	plugins/gtk+/glade-gtk-activatable.c
    	plugins/gtk+/glade-gtk.c
    	plugins/gtk+/gtk+.xml.in

 plugins/gtk+/glade-gtk.c |   92 +++++++++++++++++++++++-----------------------
 plugins/gtk+/gtk+.xml.in |   14 +++----
 2 files changed, 52 insertions(+), 54 deletions(-)
---
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index b55df6e..95d443c 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -824,6 +824,7 @@ glade_gtk_widget_write_widget (GladeWidgetAdaptor *adaptor,
 			       GladeXmlNode       *node)
 {
  	GladeProjectFormat  fmt;
+	GObject *obj;
 
 	fmt = glade_project_get_format (widget->project);
 
@@ -833,7 +834,9 @@ glade_gtk_widget_write_widget (GladeWidgetAdaptor *adaptor,
 	/* Make sure use-action-appearance and related-action properties are
 	 * ordered in a sane way */
 	if (fmt == GLADE_PROJECT_FORMAT_GTKBUILDER &&
-	    GTK_IS_ACTIVATABLE (glade_widget_get_object (widget)))
+	    (obj = glade_widget_get_object (widget)) &&
+	    GTK_IS_ACTIVATABLE (obj) &&
+	    gtk_activatable_get_related_action (GTK_ACTIVATABLE (obj)))
 	{
 		GladeProperty *prop =
 			glade_widget_get_property (widget, "use-action-appearance");
@@ -6045,57 +6048,54 @@ evaluate_activatable_property_sensitivity (GObject            *object,
 					   const GValue       *value)
 {
 	GladeWidget *gwidget = glade_widget_get_from_gobject (object);
+	gboolean sensitivity;
+	gchar *msg;
 
 	if (!strcmp (id, "related-action"))
-	{
-		GtkAction *action = g_value_get_object (value);
-
-		if (action)
-		{
-			glade_widget_property_set_sensitive (gwidget, "visible", FALSE, ACTION_APPEARANCE_MSG);
-			glade_widget_property_set_sensitive (gwidget, "sensitive", FALSE, ACTION_APPEARANCE_MSG);
+	  {
+		  GtkAction *action = g_value_get_object (value);
 
-			glade_widget_property_set_sensitive (gwidget, "accel-group", FALSE, ACTION_APPEARANCE_MSG);
-		} else {
-			glade_widget_property_set_sensitive (gwidget, "visible", TRUE, NULL);
-			glade_widget_property_set_sensitive (gwidget, "sensitive", TRUE, NULL);
-			
-			glade_widget_property_set_sensitive (gwidget, "accel-group", TRUE, NULL);
-		}
+		  if (action)
+		    {
+			    sensitivity = FALSE;
+			    msg = ACTION_APPEARANCE_MSG;
+		    }
+		  else
+		    {
+			    sensitivity = TRUE;
+			    msg = NULL;
+		    }
 
-	} 
+		  glade_widget_property_set_sensitive (gwidget, "visible", sensitivity, msg);
+		  glade_widget_property_set_sensitive (gwidget, "sensitive", sensitivity, msg);
+		  glade_widget_property_set_sensitive (gwidget, "accel-group", sensitivity, msg);
+		  glade_widget_property_set_sensitive (gwidget, "use-action-appearance", !sensitivity, sensitivity ? msg : NULL);
+	  }
 	else if (!strcmp (id, "use-action-appearance"))
-	{
-		gboolean use_appearance = g_value_get_boolean (value);
-		
+	  {
+		  if (g_value_get_boolean (value))
+		    {
+			    sensitivity = FALSE;
+			    msg = ACTION_APPEARANCE_MSG;
+		    }
+		  else
+		    {
+			    sensitivity = TRUE;
+			    msg = NULL;
+		    }
 
-		if (use_appearance)
-		{
-			glade_widget_property_set_sensitive (gwidget, "label", FALSE, ACTION_APPEARANCE_MSG);
-			glade_widget_property_set_sensitive (gwidget, "use-underline", FALSE, ACTION_APPEARANCE_MSG);
-			glade_widget_property_set_sensitive (gwidget, "stock", FALSE, ACTION_APPEARANCE_MSG);
-			//glade_widget_property_set_sensitive (gwidget, "use-stock", FALSE, ACTION_APPEARANCE_MSG);
-			glade_widget_property_set_sensitive (gwidget, "image", FALSE, ACTION_APPEARANCE_MSG);
-			glade_widget_property_set_sensitive (gwidget, "custom-child", FALSE, ACTION_APPEARANCE_MSG);	
-			glade_widget_property_set_sensitive (gwidget, "stock-id", FALSE, ACTION_APPEARANCE_MSG);
-			glade_widget_property_set_sensitive (gwidget, "label-widget", FALSE, ACTION_APPEARANCE_MSG);
-			glade_widget_property_set_sensitive (gwidget, "icon-name", FALSE, ACTION_APPEARANCE_MSG);
-			glade_widget_property_set_sensitive (gwidget, "icon-widget", FALSE, ACTION_APPEARANCE_MSG);
-			glade_widget_property_set_sensitive (gwidget, "icon", FALSE, ACTION_APPEARANCE_MSG);
-	} else {
-			glade_widget_property_set_sensitive (gwidget, "label", TRUE, NULL);
-			glade_widget_property_set_sensitive (gwidget, "use-underline", TRUE, NULL);
-			glade_widget_property_set_sensitive (gwidget, "stock", TRUE, NULL);
-			//glade_widget_property_set_sensitive (gwidget, "use-stock", TRUE, NULL);
-			glade_widget_property_set_sensitive (gwidget, "image", TRUE, NULL);
-			glade_widget_property_set_sensitive (gwidget, "custom-child", TRUE, NULL);	
-			glade_widget_property_set_sensitive (gwidget, "stock-id", TRUE, NULL);
-			glade_widget_property_set_sensitive (gwidget, "label-widget", TRUE, NULL);
-			glade_widget_property_set_sensitive (gwidget, "icon-name", TRUE, NULL);
-			glade_widget_property_set_sensitive (gwidget, "icon-widget", TRUE, NULL);
-			glade_widget_property_set_sensitive (gwidget, "icon", TRUE, NULL);
-		}
-	}
+		  glade_widget_property_set_sensitive (gwidget, "label", sensitivity, msg);
+		  glade_widget_property_set_sensitive (gwidget, "use-underline", sensitivity, msg);
+		  glade_widget_property_set_sensitive (gwidget, "stock", sensitivity, msg);
+		  //glade_widget_property_set_sensitive (gwidget, "use-stock", sensitivity, msg);
+		  glade_widget_property_set_sensitive (gwidget, "image", sensitivity, msg);
+		  glade_widget_property_set_sensitive (gwidget, "custom-child", sensitivity, msg);
+		  glade_widget_property_set_sensitive (gwidget, "stock-id", sensitivity, msg);
+		  glade_widget_property_set_sensitive (gwidget, "label-widget", sensitivity, msg);
+		  glade_widget_property_set_sensitive (gwidget, "icon-name", sensitivity, msg);
+		  glade_widget_property_set_sensitive (gwidget, "icon-widget", sensitivity, msg);
+		  glade_widget_property_set_sensitive (gwidget, "icon", sensitivity, msg);
+	  }
 }
 
 /* ----------------------------- GtkButton ------------------------------ */
diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in
index b8537a3..97190c0 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -465,9 +465,8 @@ embedded in another object</_tooltip>
         <property id="use-underline" _name="Use Underline" gtkbuilder-since="2.16"/>
 
 	<!-- GtkActivatable -->
-      	<property id="related-action" _name="Related Action" custom-layout="True" since="2.16" save="False"/>
-      	<property id="use-action-appearance" _name="Use Action Appearance" save="False"
-		  custom-layout="True" needs-sync="True" default="False" since="2.16"/>
+      	<property id="related-action" _name="Related Action" custom-layout="True" since="2.16" save="False" needs-sync="True"/>
+      	<property id="use-action-appearance" _name="Use Action Appearance" save="False" custom-layout="True" needs-sync="True" since="2.16"/>
 
 	<!-- Atk click property -->
 	<property id="atk-click" _name="Click" ignore="True" atk-property="True" save="False">
@@ -682,9 +681,8 @@ embedded in another object</_tooltip>
 
       <properties>
 	<!-- GtkActivatable -->
-      	<property id="related-action" _name="Related Action" custom-layout="True" since="2.16" save="False"/>
-      	<property id="use-action-appearance" _name="Use Action Appearance" custom-layout="True" 
-		  default="False" since="2.16" save="False"/>
+      	<property id="related-action" _name="Related Action" custom-layout="True" since="2.16" save="False" needs-sync="True"/>
+      	<property id="use-action-appearance" _name="Use Action Appearance" custom-layout="True" save="False" needs-sync="True" since="2.16"/>
       </properties>
 
     </glade-widget-class>
@@ -1001,8 +999,8 @@ embedded in another object</_tooltip>
 	</property>
 
 	<!-- GtkActivatable -->
-      	<property id="related-action" _name="Related Action" custom-layout="True" since="2.16" save="False"/>
-      	<property id="use-action-appearance" _name="Use Action Appearance" custom-layout="True" default="False" since="2.16" save="False"/>
+      	<property id="related-action" _name="Related Action" custom-layout="True" since="2.16" save="False" needs-sync="True"/>
+      	<property id="use-action-appearance" _name="Use Action Appearance" custom-layout="True" save="False" needs-sync="True" since="2.16"/>
 
 	<!-- Atk click property -->
 	<property id="atk-click" _name="Click" ignore="True" atk-property="True" save="False">



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