[glade] GladeProperty: Do not replace - with _



commit 381b6683c22642886b58e382a002aba0c38e1c38
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date:   Thu Jun 18 18:43:14 2020 -0300

    GladeProperty: Do not replace - with _
    
    Remove old libglade underscore properties naming scheme.
    
    https://gitlab.gnome.org/GNOME/glade/-/issues/281

 gladeui/glade-property.c | 10 +++-------
 gladeui/glade-signal.c   |  2 ++
 2 files changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/gladeui/glade-property.c b/gladeui/glade-property.c
index 46ff8684..fbdb684c 100644
--- a/gladeui/glade-property.c
+++ b/gladeui/glade-property.c
@@ -1200,7 +1200,7 @@ glade_property_write (GladeProperty   *property,
                       GladeXmlNode    *node)
 {
   GladeXmlNode *prop_node;
-  gchar *name, *value;
+  gchar *value;
   gboolean save_always;
   gchar *binding_flags = NULL;
   GFlagsClass *flags_class;
@@ -1226,10 +1226,6 @@ glade_property_write (GladeProperty   *property,
   if (!save_always && glade_property_original_default (property) && !property->priv->bind_source)
     return;
 
-  /* Escape our string and save with underscores */
-  name = g_strdup (glade_property_def_id (property->priv->def));
-  glade_util_replace (name, '-', '_');
-
   /* convert the value of this property to a string */
   if (!(value = glade_widget_adaptor_string_from_value
         (glade_property_def_get_adaptor (property->priv->def), property->priv->def,
@@ -1244,7 +1240,8 @@ glade_property_write (GladeProperty   *property,
   glade_xml_node_append_child (node, prop_node);
 
   /* Name and value */
-  glade_xml_node_set_property_string (prop_node, GLADE_XML_TAG_NAME, name);
+  glade_xml_node_set_property_string (prop_node, GLADE_XML_TAG_NAME,
+                                      glade_property_def_id (property->priv->def));
   glade_xml_set_content (prop_node, value);
 
   /* i18n stuff */
@@ -1306,7 +1303,6 @@ glade_property_write (GladeProperty   *property,
           g_free (binding_flags);
         }
     }
-  g_free (name);
   g_free (value);
 }
 
diff --git a/gladeui/glade-signal.c b/gladeui/glade-signal.c
index 44f8edab..028ed132 100644
--- a/gladeui/glade-signal.c
+++ b/gladeui/glade-signal.c
@@ -373,6 +373,8 @@ glade_signal_read (GladeXmlNode *node, GladeWidgetAdaptor *adaptor)
         glade_xml_get_property_string_required (node, GLADE_XML_TAG_NAME,
                                                 NULL)))
     return NULL;
+
+  /* Old files had properties/signals with underscore */
   glade_util_replace (name, '_', '-');
 
   /* Search for a detail, and strip it from the signal name */


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