[glade] GladeProperty: Otional properties that are enabled are always set now.



commit 222d4ac3dbd13fc65b2c6c69d8c2a4a9f35b4ce8
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Sun Mar 31 23:18:53 2013 +0900

    GladeProperty: Otional properties that are enabled are always set now.
    
    ... Even if they are at the default value, this is more intuitive as
    we safely reload the check mark state, and allows explicit setting
    of properties like hexpand = FALSE or vexpand = FALSE.

 gladeui/glade-property.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gladeui/glade-property.c b/gladeui/glade-property.c
index 08eb6de..1e4265c 100644
--- a/gladeui/glade-property.c
+++ b/gladeui/glade-property.c
@@ -1164,6 +1164,7 @@ glade_property_write (GladeProperty * property,
 {
   GladeXmlNode *prop_node;
   gchar *name, *value;
+  gboolean save_always;
 
   g_return_if_fail (GLADE_IS_PROPERTY (property));
   g_return_if_fail (node != NULL);
@@ -1173,11 +1174,14 @@ glade_property_write (GladeProperty * property,
         glade_xml_node_verify_silent (node, GLADE_XML_TAG_WIDGET)))
     return;
 
+  /* There can be a couple of reasons to forcefully save a property */
+  save_always = (glade_property_class_save_always (property->priv->klass) || property->priv->save_always);
+  save_always = save_always || (glade_property_class_optional (property->priv->klass) && 
property->priv->enabled);
+
   /* Skip properties that are default by original pspec default
    * (excepting those that specified otherwise).
    */
-  if (!(glade_property_class_save_always (property->priv->klass) || property->priv->save_always) &&
-      glade_property_original_default (property))
+  if (!save_always && glade_property_original_default (property))
     return;
 
   /* Escape our string and save with underscores */


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