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



commit bfaac8e6fd61a346b9001e72bf4625783342c1ff
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

 plugins/gtk+/glade-gtk-activatable.c |    6 +++++-
 plugins/gtk+/glade-gtk.c             |   10 +++++++---
 plugins/gtk+/gtk+.xml.in             |   18 ++++++++----------
 3 files changed, 20 insertions(+), 14 deletions(-)
---
diff --git a/plugins/gtk+/glade-gtk-activatable.c b/plugins/gtk+/glade-gtk-activatable.c
index b2bfef2..cb903e5 100644
--- a/plugins/gtk+/glade-gtk-activatable.c
+++ b/plugins/gtk+/glade-gtk-activatable.c
@@ -34,7 +34,10 @@ glade_gtk_activatable_parse_finished (GladeProject *project,
 
   glade_widget_property_get (widget, "related-action", &related_action);
   if (related_action == NULL)
-    glade_widget_property_set (widget, "use-action-appearance", FALSE);
+    {
+      glade_widget_property_set_sensitive (widget, "use-action-appearance", FALSE, ACTION_APPEARANCE_MSG);
+      glade_widget_property_set (widget, "use-action-appearance", FALSE);
+    }
 }
 
 void
@@ -64,6 +67,7 @@ glade_gtk_activatable_evaluate_property_sensitivity (GObject *object,
       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"))
     {
diff --git a/plugins/gtk+/glade-gtk.c b/plugins/gtk+/glade-gtk.c
index 33e3631..c5f068f 100644
--- a/plugins/gtk+/glade-gtk.c
+++ b/plugins/gtk+/glade-gtk.c
@@ -618,15 +618,19 @@ glade_gtk_widget_write_widget (GladeWidgetAdaptor * adaptor,
                                GladeWidget * widget,
                                GladeXmlContext * context, GladeXmlNode * node)
 {
-  GladeProperty *prop;
+  GObject *obj;
 
   if (!glade_xml_node_verify (node, GLADE_XML_TAG_WIDGET))
     return;
 
   /* Make sure use-action-appearance and related-action properties are
-   * ordered in a sane way */
-  if (GTK_IS_ACTIVATABLE (glade_widget_get_object (widget)))
+   * ordered in a sane way and are only saved if there is an action */
+  if ((obj = glade_widget_get_object (widget)) &&
+      GTK_IS_ACTIVATABLE (obj) &&
+      gtk_activatable_get_related_action (GTK_ACTIVATABLE (obj)))
     {
+      GladeProperty *prop;
+
       prop = glade_widget_get_property (widget, "use-action-appearance");
       if (prop)
 	glade_property_write (prop, context, node);
diff --git a/plugins/gtk+/gtk+.xml.in b/plugins/gtk+/gtk+.xml.in
index e139afb..4d41dc4 100644
--- a/plugins/gtk+/gtk+.xml.in
+++ b/plugins/gtk+/gtk+.xml.in
@@ -526,9 +526,8 @@ embedded in another object</_tooltip>
         <property id="use-underline" _name="Use Underline" 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" 
@@ -748,9 +747,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"/>
+      	<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>
@@ -1041,8 +1039,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" multiline="True">
@@ -1122,13 +1120,13 @@ embedded in another object</_tooltip>
       <create-editable-function>glade_gtk_switch_create_editable</create-editable-function>
       <properties>
         <!-- GtkActivatable -->
-        <property id="related-action" _name="Related Action" custom-layout="True" save="False">
+        <property id="related-action" _name="Related Action" custom-layout="True" save="False" needs-sync="True">
       	  <parameter-spec>
 	    <type>GParamObject</type>
 	    <value-type>GtkToggleAction</value-type>
           </parameter-spec>
         </property>
-        <property id="use-action-appearance" _name="Use Action Appearance" custom-layout="True" default="False" save="False"/>
+        <property id="use-action-appearance" _name="Use Action Appearance" custom-layout="True" save="False" needs-sync="True"/>
       </properties>
     </glade-widget-class>
 



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