[glade] GladeProperty: make i18n_translatable false by default



commit a5ac6a9a2a4b20eebefd7631508ed70aca185683
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date:   Mon Oct 5 20:34:21 2020 -0300

    GladeProperty: make i18n_translatable false by default
    
    Only string properties should be translatable by default.
    
    Fix issue #406 "AtkObject::accessible-role should not be translatable"

 gladeui/glade-property.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/gladeui/glade-property.c b/gladeui/glade-property.c
index 746c1a44..8875a57e 100644
--- a/gladeui/glade-property.c
+++ b/gladeui/glade-property.c
@@ -639,11 +639,21 @@ glade_property_init (GladeProperty *property)
   property->priv->precision = 2;
   property->priv->enabled = TRUE;
   property->priv->sensitive = TRUE;
-  property->priv->i18n_translatable = TRUE;
+  property->priv->i18n_translatable = FALSE;
   property->priv->i18n_comment = NULL;
   property->priv->sync_tolerance = 1;
 }
 
+static void
+glade_property_constructed (GObject *object)
+{
+  GladeProperty *property = GLADE_PROPERTY (object);
+  GParamSpec *pspec = glade_property_def_get_pspec (property->priv->def);
+
+  /* Only string properties are translatable */
+  glade_property_i18n_set_translatable (property, G_IS_PARAM_SPEC_STRING (pspec));
+}
+
 static void
 glade_property_class_init (GladePropertyClass * prop_class)
 {
@@ -652,6 +662,7 @@ glade_property_class_init (GladePropertyClass * prop_class)
   /* GObjectClass */
   object_class->set_property = glade_property_set_real_property;
   object_class->get_property = glade_property_get_real_property;
+  object_class->constructed = glade_property_constructed;
   object_class->finalize = glade_property_finalize;
 
   /* Class methods */
@@ -701,7 +712,7 @@ glade_property_class_init (GladePropertyClass * prop_class)
     g_param_spec_boolean ("i18n-translatable",
                           _("Translatable"),
                           _("Whether this property is translatable"),
-                          TRUE,
+                          FALSE,
                           G_PARAM_READWRITE);
 
   properties[PROP_STATE] =
@@ -773,8 +784,9 @@ glade_property_new (GladePropertyDef *def,
 
   g_return_val_if_fail (GLADE_IS_PROPERTY_DEF (def), NULL);
 
-  property = (GladeProperty *) g_object_new (GLADE_TYPE_PROPERTY, NULL);
-  property->priv->def = def;
+  property = (GladeProperty *) g_object_new (GLADE_TYPE_PROPERTY,
+                                             "class", def,
+                                             NULL);
   property->priv->widget = widget;
   property->priv->value = value;
 


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