Blame SOURCES/GConf-gettext.patch

6e9cc4
diff -up GConf-2.26.0/backends/markup-tree.c.gettext GConf-2.26.0/backends/markup-tree.c
6e9cc4
--- GConf-2.26.0/backends/markup-tree.c.gettext	2009-04-26 23:33:05.258484987 -0400
6e9cc4
+++ GConf-2.26.0/backends/markup-tree.c	2009-04-26 23:34:25.026700526 -0400
6e9cc4
@@ -52,6 +52,7 @@ struct _MarkupEntry
6e9cc4
   char       *schema_name;
6e9cc4
   char       *mod_user;
6e9cc4
   GTime       mod_time;
6e9cc4
+  const char *gettext_domain;
6e9cc4
 };
6e9cc4
 
6e9cc4
 static LocalSchemaInfo* local_schema_info_new  (void);
6e9cc4
@@ -1593,6 +1594,8 @@ markup_entry_set_value (MarkupEntry     
6e9cc4
                              gconf_schema_get_type (schema));
6e9cc4
       gconf_schema_set_owner (current_schema,
6e9cc4
                               gconf_schema_get_owner (schema));
6e9cc4
+      gconf_schema_set_gettext_domain (current_schema,
6e9cc4
+                              gconf_schema_get_gettext_domain (schema));
6e9cc4
     }
6e9cc4
 
6e9cc4
   /* Update mod time */
6e9cc4
@@ -1805,6 +1808,8 @@ markup_entry_get_value (MarkupEntry *ent
6e9cc4
       else if (c_local_schema && c_local_schema->long_desc)
6e9cc4
         gconf_schema_set_long_desc (schema, c_local_schema->long_desc);
6e9cc4
 
6e9cc4
+      gconf_schema_set_gettext_domain (schema, entry->gettext_domain);
6e9cc4
+
6e9cc4
       return retval;
6e9cc4
     }
6e9cc4
 }
6e9cc4
@@ -2339,8 +2344,9 @@ parse_value_element (GMarkupParseContext
6e9cc4
   const char *ltype;
6e9cc4
   const char *list_type;
6e9cc4
   const char *owner;
6e9cc4
+
6e9cc4
   GConfValueType vtype;
6e9cc4
-  const char *dummy1, *dummy2, *dummy3, *dummy4;
6e9cc4
+  const char *dummy1, *dummy2, *dummy3, *dummy4, *dummy5;
6e9cc4
   
6e9cc4
 #if 0
6e9cc4
   g_assert (ELEMENT_IS ("entry") ||
6e9cc4
@@ -2377,6 +2383,7 @@ parse_value_element (GMarkupParseContext
6e9cc4
                           "muser", &dummy2,
6e9cc4
                           "mtime", &dummy3,
6e9cc4
                           "schema", &dummy4,
6e9cc4
+                          "gettext_domain", &dummy5,
6e9cc4
 
6e9cc4
                           NULL))
6e9cc4
     return;
6e9cc4
@@ -2683,6 +2690,7 @@ parse_entry_element (GMarkupParseContext
6e9cc4
       const char *mtime;
6e9cc4
       const char *schema;
6e9cc4
       const char *type;
6e9cc4
+      const char *gettext_domain;
6e9cc4
       const char *dummy1, *dummy2, *dummy3, *dummy4;
6e9cc4
       const char *dummy5, *dummy6, *dummy7;
6e9cc4
       GConfValue *value;
6e9cc4
@@ -2693,6 +2701,7 @@ parse_entry_element (GMarkupParseContext
6e9cc4
       mtime = NULL;
6e9cc4
       schema = NULL;
6e9cc4
       type = NULL;
6e9cc4
+      gettext_domain = NULL;
6e9cc4
 
6e9cc4
       if (!locate_attributes (context, element_name, attribute_names, attribute_values,
6e9cc4
                               error,
6e9cc4
@@ -2701,6 +2710,7 @@ parse_entry_element (GMarkupParseContext
6e9cc4
                               "mtime", &mtime,
6e9cc4
                               "schema", &schema,
6e9cc4
                               "type", &type,
6e9cc4
+                              "gettext_domain", &gettext_domain,
6e9cc4
                           
6e9cc4
                               /* These are allowed but we don't use them until
6e9cc4
                                * parse_value_element
6e9cc4
@@ -2768,6 +2778,9 @@ parse_entry_element (GMarkupParseContext
6e9cc4
        */
6e9cc4
       if (schema)
6e9cc4
         entry->schema_name = g_strdup (schema);
6e9cc4
+
6e9cc4
+      if (gettext_domain)
6e9cc4
+        entry->gettext_domain = g_intern_string (gettext_domain);
6e9cc4
     }
6e9cc4
   else
6e9cc4
     {
6e9cc4
@@ -3716,6 +3729,7 @@ write_value_element (GConfValue *value,
6e9cc4
         GConfSchema *schema;
6e9cc4
         GConfValueType stype;
6e9cc4
         const char *owner;
6e9cc4
+        const char *gettext_domain;
6e9cc4
         
6e9cc4
         schema = gconf_value_get_schema (value);
6e9cc4
 
6e9cc4
@@ -3741,6 +3755,23 @@ write_value_element (GConfValue *value,
6e9cc4
             
6e9cc4
             g_free (s);
6e9cc4
           }
6e9cc4
+
6e9cc4
+        gettext_domain = gconf_schema_get_gettext_domain (schema);
6e9cc4
+        
6e9cc4
+        if (gettext_domain)
6e9cc4
+          {
6e9cc4
+            char *s;
6e9cc4
+
6e9cc4
+            s = g_markup_escape_text (gettext_domain, -1);
6e9cc4
+            
6e9cc4
+            if (fprintf (f, " gettext_domain=\"%s\"", s) < 0)
6e9cc4
+              {
6e9cc4
+                g_free (s);
6e9cc4
+                return FALSE;
6e9cc4
+              }
6e9cc4
+            
6e9cc4
+            g_free (s);
6e9cc4
+          }
6e9cc4
         
6e9cc4
         if (stype == GCONF_VALUE_LIST)
6e9cc4
           {
6e9cc4
diff -up GConf-2.26.0/doc/gconf-1.0.dtd.gettext GConf-2.26.0/doc/gconf-1.0.dtd
6e9cc4
--- GConf-2.26.0/doc/gconf-1.0.dtd.gettext	2009-04-26 23:33:17.240736103 -0400
6e9cc4
+++ GConf-2.26.0/doc/gconf-1.0.dtd	2009-04-26 23:34:25.027700384 -0400
6e9cc4
@@ -7,7 +7,7 @@
6e9cc4
 
6e9cc4
 elements, in any order". Duplicate elements (apart from <locale>) are
6e9cc4
 not allowed). -->
6e9cc4
-
6e9cc4
+
6e9cc4
 
6e9cc4
 
6e9cc4
 
6e9cc4
diff -up GConf-2.26.0/gconf/gconf-internals.c.gettext GConf-2.26.0/gconf/gconf-internals.c
6e9cc4
--- GConf-2.26.0/gconf/gconf-internals.c.gettext	2009-04-26 23:34:10.994700035 -0400
6e9cc4
+++ GConf-2.26.0/gconf/gconf-internals.c	2009-04-26 23:34:53.767450191 -0400
6e9cc4
@@ -513,6 +513,7 @@ gconf_fill_corba_schema_from_gconf_schem
6e9cc4
   cs->short_desc = CORBA_string_dup (gconf_schema_get_short_desc (sc) ? gconf_schema_get_short_desc (sc) : "");
6e9cc4
   cs->long_desc = CORBA_string_dup (gconf_schema_get_long_desc (sc) ? gconf_schema_get_long_desc (sc) : "");
6e9cc4
   cs->owner = CORBA_string_dup (gconf_schema_get_owner (sc) ? gconf_schema_get_owner (sc) : "");
6e9cc4
+  cs->gettext_domain = CORBA_string_dup (gconf_schema_get_gettext_domain (sc) ? gconf_schema_get_gettext_domain (sc) : "");
6e9cc4
 
6e9cc4
   {
6e9cc4
     gchar* encoded;
6e9cc4
@@ -600,6 +601,14 @@ gconf_schema_from_corba_schema(const Con
6e9cc4
         gconf_schema_set_owner(sc, cs->owner);
6e9cc4
     }
6e9cc4
       
6e9cc4
+  if (*cs->gettext_domain != '\0')
6e9cc4
+    {
6e9cc4
+      if (!g_utf8_validate (cs->gettext_domain, -1, NULL))
6e9cc4
+        gconf_log (GCL_ERR, _("Invalid UTF-8 in gettext domain for schema"));
6e9cc4
+      else
6e9cc4
+        gconf_schema_set_gettext_domain(sc, cs->gettext_domain);
6e9cc4
+    }
6e9cc4
+      
6e9cc4
   {
6e9cc4
     GConfValue* val;
6e9cc4
 
6e9cc4
diff -up GConf-2.26.0/gconf/gconf-schema.c.gettext GConf-2.26.0/gconf/gconf-schema.c
6e9cc4
--- GConf-2.26.0/gconf/gconf-schema.c.gettext	2009-04-26 23:33:26.787483545 -0400
6e9cc4
+++ GConf-2.26.0/gconf/gconf-schema.c	2009-04-26 23:35:54.240450142 -0400
6e9cc4
@@ -32,9 +32,10 @@ typedef struct {
6e9cc4
   GConfValueType car_type; /* Pair car type of the described entry */
6e9cc4
   GConfValueType cdr_type; /* Pair cdr type of the described entry */
6e9cc4
   gchar* locale;       /* Schema locale */
6e9cc4
-  gchar* owner;        /* Name of creating application */
6e9cc4
+  const gchar* owner;        /* Name of creating application */
6e9cc4
   gchar* short_desc;   /* 40 char or less description, no newlines */
6e9cc4
   gchar* long_desc;    /* could be a paragraph or so */
6e9cc4
+  const gchar* gettext_domain; /* description gettext domain */
6e9cc4
   GConfValue* default_value; /* Default value of the key */
6e9cc4
 } GConfRealSchema;
6e9cc4
 
6e9cc4
@@ -63,7 +64,6 @@ gconf_schema_free (GConfSchema* sc)
6e9cc4
   g_free (real->locale);
6e9cc4
   g_free (real->short_desc);
6e9cc4
   g_free (real->long_desc);
6e9cc4
-  g_free (real->owner);
6e9cc4
 
6e9cc4
   if (real->default_value)
6e9cc4
     gconf_value_free (real->default_value);
6e9cc4
@@ -91,7 +91,9 @@ gconf_schema_copy (const GConfSchema* sc
6e9cc4
 
6e9cc4
   dest->long_desc = g_strdup (real->long_desc);
6e9cc4
 
6e9cc4
-  dest->owner = g_strdup (real->owner);
6e9cc4
+  dest->gettext_domain = real->gettext_domain;
6e9cc4
+
6e9cc4
+  dest->owner = real->owner;
6e9cc4
 
6e9cc4
   dest->default_value = real->default_value ? gconf_value_copy (real->default_value) : NULL;
6e9cc4
   
6e9cc4
@@ -136,6 +138,17 @@ gconf_schema_set_locale (GConfSchema* sc
6e9cc4
     REAL_SCHEMA (sc)->locale = NULL;
6e9cc4
 }
6e9cc4
 
6e9cc4
+void
6e9cc4
+gconf_schema_set_gettext_domain (GConfSchema* sc, const gchar* domain)
6e9cc4
+{
6e9cc4
+  g_return_if_fail (domain == NULL || g_utf8_validate (domain, -1, NULL));
6e9cc4
+  
6e9cc4
+  if (domain)
6e9cc4
+    REAL_SCHEMA (sc)->gettext_domain = g_intern_string (domain);
6e9cc4
+  else 
6e9cc4
+    REAL_SCHEMA (sc)->gettext_domain = NULL;
6e9cc4
+}
6e9cc4
+
6e9cc4
 void          
6e9cc4
 gconf_schema_set_short_desc (GConfSchema* sc, const gchar* desc)
6e9cc4
 {
6e9cc4
@@ -169,11 +182,8 @@ gconf_schema_set_owner (GConfSchema* sc,
6e9cc4
 {
6e9cc4
   g_return_if_fail (owner == NULL || g_utf8_validate (owner, -1, NULL));
6e9cc4
   
6e9cc4
-  if (REAL_SCHEMA (sc)->owner)
6e9cc4
-    g_free (REAL_SCHEMA (sc)->owner);
6e9cc4
-
6e9cc4
   if (owner)
6e9cc4
-    REAL_SCHEMA (sc)->owner = g_strdup (owner);
6e9cc4
+    REAL_SCHEMA (sc)->owner = g_intern_string (owner);
6e9cc4
   else
6e9cc4
     REAL_SCHEMA (sc)->owner = NULL;
6e9cc4
 }
6e9cc4
@@ -228,6 +238,14 @@ gconf_schema_validate (const GConfSchema
6e9cc4
       return FALSE;
6e9cc4
     }
6e9cc4
 
6e9cc4
+  if (real->gettext_domain && !g_utf8_validate (real->gettext_domain, -1, NULL))
6e9cc4
+    {
6e9cc4
+      g_set_error (err, GCONF_ERROR,
6e9cc4
+                   GCONF_ERROR_FAILED,
6e9cc4
+                   _("Schema contains invalid UTF-8"));
6e9cc4
+      return FALSE;
6e9cc4
+    }
6e9cc4
+
6e9cc4
   if (real->owner && !g_utf8_validate (real->owner, -1, NULL))
6e9cc4
     {
6e9cc4
       g_set_error (err, GCONF_ERROR,
6e9cc4
@@ -299,11 +317,32 @@ gconf_schema_get_locale (const GConfSche
6e9cc4
 }
6e9cc4
 
6e9cc4
 const char*
6e9cc4
+gconf_schema_get_gettext_domain (const GConfSchema *schema)
6e9cc4
+{
6e9cc4
+  g_return_val_if_fail (schema != NULL, NULL);
6e9cc4
+
6e9cc4
+  return REAL_SCHEMA (schema)->gettext_domain;
6e9cc4
+}
6e9cc4
+
6e9cc4
+static inline const char *
6e9cc4
+schema_translate (const GConfSchema *schema,
6e9cc4
+                  const char        *string)
6e9cc4
+{
6e9cc4
+  if (REAL_SCHEMA (schema)->gettext_domain)
6e9cc4
+    {
6e9cc4
+      bind_textdomain_codeset (REAL_SCHEMA (schema)->gettext_domain, "UTF-8");
6e9cc4
+      return g_dgettext(REAL_SCHEMA (schema)->gettext_domain, string);
6e9cc4
+    }
6e9cc4
+  else
6e9cc4
+    return string;
6e9cc4
+}
6e9cc4
+
6e9cc4
+const char*
6e9cc4
 gconf_schema_get_short_desc (const GConfSchema *schema)
6e9cc4
 {
6e9cc4
   g_return_val_if_fail (schema != NULL, NULL);
6e9cc4
 
6e9cc4
-  return REAL_SCHEMA (schema)->short_desc;
6e9cc4
+ return schema_translate (schema, REAL_SCHEMA (schema)->short_desc);
6e9cc4
 }
6e9cc4
 
6e9cc4
 const char*
6e9cc4
@@ -311,7 +350,7 @@ gconf_schema_get_long_desc (const GConfS
6e9cc4
 {
6e9cc4
   g_return_val_if_fail (schema != NULL, NULL);
6e9cc4
 
6e9cc4
-  return REAL_SCHEMA (schema)->long_desc;
6e9cc4
+ return schema_translate (schema, REAL_SCHEMA (schema)->long_desc);
6e9cc4
 }
6e9cc4
 
6e9cc4
 const char*
6e9cc4
diff -up GConf-2.26.0/gconf/gconf-schema.h.gettext GConf-2.26.0/gconf/gconf-schema.h
6e9cc4
--- GConf-2.26.0/gconf/gconf-schema.h.gettext	2009-04-26 23:33:33.979744088 -0400
6e9cc4
+++ GConf-2.26.0/gconf/gconf-schema.h	2009-04-26 23:34:25.030737043 -0400
6e9cc4
@@ -48,6 +48,8 @@ void gconf_schema_set_cdr_type          
6e9cc4
                                             GConfValueType  type);
6e9cc4
 void gconf_schema_set_locale               (GConfSchema    *sc,
6e9cc4
                                             const gchar    *locale);
6e9cc4
+void gconf_schema_set_gettext_domain       (GConfSchema    *sc,
6e9cc4
+                                            const gchar    *domain);
6e9cc4
 void gconf_schema_set_short_desc           (GConfSchema    *sc,
6e9cc4
                                             const gchar    *desc);
6e9cc4
 void gconf_schema_set_long_desc            (GConfSchema    *sc,
6e9cc4
@@ -65,6 +67,7 @@ GConfValueType gconf_schema_get_list_typ
6e9cc4
 GConfValueType gconf_schema_get_car_type      (const GConfSchema *schema);
6e9cc4
 GConfValueType gconf_schema_get_cdr_type      (const GConfSchema *schema);
6e9cc4
 const char*    gconf_schema_get_locale        (const GConfSchema *schema);
6e9cc4
+const char*    gconf_schema_get_gettext_domain(const GConfSchema *schema);
6e9cc4
 const char*    gconf_schema_get_short_desc    (const GConfSchema *schema);
6e9cc4
 const char*    gconf_schema_get_long_desc     (const GConfSchema *schema);
6e9cc4
 const char*    gconf_schema_get_owner         (const GConfSchema *schema);
6e9cc4
diff -up GConf-2.26.0/gconf/gconftool.c.gettext GConf-2.26.0/gconf/gconftool.c
6e9cc4
--- GConf-2.26.0/gconf/gconftool.c.gettext	2009-04-26 23:33:41.907451190 -0400
6e9cc4
+++ GConf-2.26.0/gconf/gconftool.c	2009-04-26 23:34:25.034736752 -0400
6e9cc4
@@ -3295,6 +3295,7 @@ struct _SchemaInfo {
6e9cc4
   GConfValueType cdr_type;
6e9cc4
   GConfValue* global_default;
6e9cc4
   GHashTable* hash;
6e9cc4
+  gchar* gettext_domain;
6e9cc4
 };
6e9cc4
 
6e9cc4
 static int
6e9cc4
@@ -3547,6 +3548,15 @@ extract_global_info(xmlNodePtr node,
6e9cc4
               else
6e9cc4
                 g_printerr (_("WARNING: empty <applyto> node"));
6e9cc4
             }
6e9cc4
+          else if (strcmp((char *)iter->name, "gettext_domain") == 0)
6e9cc4
+            {
6e9cc4
+              tmp = (char *)xmlNodeGetContent(iter);
6e9cc4
+              if (tmp)
6e9cc4
+                {
6e9cc4
+                  info->gettext_domain = g_strdup(tmp);
6e9cc4
+                  xmlFree(tmp);
6e9cc4
+                }
6e9cc4
+            }
6e9cc4
           else
6e9cc4
             g_printerr (_("WARNING: node <%s> not understood below <schema>\n"),
6e9cc4
 			iter->name);
6e9cc4
@@ -3636,6 +3646,9 @@ process_locale_info(xmlNodePtr node, Sch
6e9cc4
   if (info->owner != NULL)
6e9cc4
     gconf_schema_set_owner(schema, info->owner);
6e9cc4
 
6e9cc4
+  if (info->gettext_domain != NULL)
6e9cc4
+    gconf_schema_set_gettext_domain(schema, info->gettext_domain);
6e9cc4
+
6e9cc4
   xmlFree(name);
6e9cc4
 
6e9cc4
   /* Locale-specific info */
6e9cc4
@@ -3765,6 +3778,7 @@ get_schema_from_xml(xmlNodePtr node, gch
6e9cc4
   info.apply_to = NULL;
6e9cc4
   info.owner = NULL;
6e9cc4
   info.global_default = NULL;
6e9cc4
+  info.gettext_domain = NULL;
6e9cc4
   info.hash = g_hash_table_new(g_str_hash, g_str_equal);
6e9cc4
   
6e9cc4
   extract_global_info(node, &info;;
6e9cc4
@@ -3801,6 +3815,8 @@ get_schema_from_xml(xmlNodePtr node, gch
6e9cc4
             ;  /* nothing */
6e9cc4
           else if (strcmp((char *)iter->name, "applyto") == 0)
6e9cc4
             ;  /* nothing */
6e9cc4
+          else if (strcmp((char *)iter->name, "gettext_domain") == 0)
6e9cc4
+            ;  /* nothing */
6e9cc4
           else if (strcmp((char *)iter->name, "locale") == 0)
6e9cc4
             {
6e9cc4
               process_locale_info(iter, &info;;
6e9cc4
diff -up GConf-2.26.0/gconf/GConfX.idl.gettext GConf-2.26.0/gconf/GConfX.idl
6e9cc4
--- GConf-2.26.0/gconf/GConfX.idl.gettext	2009-04-26 23:33:58.457483190 -0400
6e9cc4
+++ GConf-2.26.0/gconf/GConfX.idl	2009-04-26 23:34:53.764448732 -0400
6e9cc4
@@ -16,6 +16,7 @@ struct ConfigSchema {
6e9cc4
   string short_desc;
6e9cc4
   string long_desc;
6e9cc4
   string owner;
6e9cc4
+  string gettext_domain;
6e9cc4
   // Work around lack of recursive data types
6e9cc4
   string encoded_default_value;
6e9cc4
 };