[glade] gtk+: Keep internationalization context in Atk properties



commit 61516306c7d9a3c4bdb2f0ed77d9e0dbf678508f
Author: Corentin Noël <corentin elementary io>
Date:   Wed Sep 11 19:16:41 2019 +0000

    gtk+: Keep internationalization context in Atk properties
    
    Fixes https://gitlab.gnome.org/GNOME/glade/issues/356

 plugins/gtk+/glade-gtk-widget.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/plugins/gtk+/glade-gtk-widget.c b/plugins/gtk+/glade-gtk-widget.c
index 9bcfcd82..23c68927 100644
--- a/plugins/gtk+/glade-gtk-widget.c
+++ b/plugins/gtk+/glade-gtk-widget.c
@@ -150,7 +150,7 @@ glade_gtk_parse_atk_props (GladeWidget *widget, GladeXmlNode *node)
   GladeXmlNode *prop;
   GladeProperty *property;
   GValue *gvalue;
-  gchar *value, *name, *id, *comment;
+  gchar *value, *name, *id, *context, *comment;
   gint translatable;
   gboolean is_action;
 
@@ -215,12 +215,15 @@ glade_gtk_parse_atk_props (GladeWidget *widget, GladeXmlNode *node)
           /* Deal with i18n... ... XXX Do i18n context !!! */
           translatable = glade_xml_get_property_boolean
               (prop, GLADE_TAG_TRANSLATABLE, FALSE);
+          context = glade_xml_get_property_string (prop, GLADE_TAG_CONTEXT);
           comment = glade_xml_get_property_string (prop, GLADE_TAG_COMMENT);
 
           glade_property_i18n_set_translatable (property, translatable);
+          glade_property_i18n_set_context (property, context);
           glade_property_i18n_set_comment (property, comment);
 
           g_free (comment);
+          g_free (context);
           g_free (value);
         }
 
@@ -351,6 +354,7 @@ glade_gtk_widget_write_atk_property (GladeProperty   *property,
     {
       GladePropertyDef *pdef = glade_property_get_def (property);
       GladeXmlNode *prop_node = glade_xml_node_new (context, GLADE_TAG_A11Y_PROPERTY);
+      const gchar *comment, *context;
 
       glade_xml_node_append_child (node, prop_node);
 
@@ -364,15 +368,17 @@ glade_gtk_widget_write_atk_property (GladeProperty   *property,
                                             GLADE_TAG_TRANSLATABLE,
                                             GLADE_XML_TAG_I18N_TRUE);
 
-      if (glade_property_i18n_get_comment (property))
+      comment = glade_property_i18n_get_comment (property);
+      if (comment)
         glade_xml_node_set_property_string (prop_node,
                                             GLADE_TAG_COMMENT,
-                                            glade_property_i18n_get_comment (property));
+                                            comment);
 
-      if (glade_property_i18n_get_context (property))
+      context = glade_property_i18n_get_context (property);
+      if (context)
         glade_xml_node_set_property_string (prop_node,
                                             GLADE_TAG_CONTEXT,
-                                            glade_property_i18n_get_context (property));
+                                            context);
     }
 
   g_free (value);


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