wok rev 7923

Forgot to add GConf patches.
author Christopher Rogers <slaxemulator@gmail.com>
date Sun Jan 09 22:22:13 2011 +0000 (2011-01-09)
parents 4bfc5c1bf9bb
children f8a3deafc73a
files GConf/stuff/01_xml-gettext-domain.patch GConf/stuff/gconf-reload.patch
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/GConf/stuff/01_xml-gettext-domain.patch	Sun Jan 09 22:22:13 2011 +0000
     1.3 @@ -0,0 +1,362 @@
     1.4 +# Description: Support calling gettext at runtime and putting the gettext domain into the .schemas file instead of replicating translations in /usr/share/gconf/schemas/*.schemas *and* /var/lib/gconf/defaults/%gconf-tree-$LANG.xml. This saves in the order of 90 MB uncompressed/10 MB compressed on hard disks.
     1.5 +# Ubuntu: https://bugs.launchpad.net/bugs/123025
     1.6 +# Upstream: http://bugzilla.gnome.org/show_bug.cgi?id=568845
     1.7 +--- GConf-2.26.0/backends/markup-tree.c.gettext	2009-04-26 23:33:05.258484987 -0400
     1.8 ++++ GConf-2.26.0/backends/markup-tree.c	2009-04-26 23:34:25.026700526 -0400
     1.9 +@@ -52,6 +52,7 @@ struct _MarkupEntry
    1.10 +   char       *schema_name;
    1.11 +   char       *mod_user;
    1.12 +   GTime       mod_time;
    1.13 ++  const char *gettext_domain;
    1.14 + };
    1.15 + 
    1.16 + static LocalSchemaInfo* local_schema_info_new  (void);
    1.17 +@@ -1593,6 +1594,8 @@ markup_entry_set_value (MarkupEntry     
    1.18 +                              gconf_schema_get_type (schema));
    1.19 +       gconf_schema_set_owner (current_schema,
    1.20 +                               gconf_schema_get_owner (schema));
    1.21 ++      gconf_schema_set_gettext_domain (current_schema,
    1.22 ++                              gconf_schema_get_gettext_domain (schema));
    1.23 +     }
    1.24 + 
    1.25 +   /* Update mod time */
    1.26 +@@ -1805,6 +1808,8 @@ markup_entry_get_value (MarkupEntry *ent
    1.27 +       else if (c_local_schema && c_local_schema->long_desc)
    1.28 +         gconf_schema_set_long_desc (schema, c_local_schema->long_desc);
    1.29 + 
    1.30 ++      gconf_schema_set_gettext_domain (schema, entry->gettext_domain);
    1.31 ++
    1.32 +       return retval;
    1.33 +     }
    1.34 + }
    1.35 +@@ -2339,8 +2344,9 @@ parse_value_element (GMarkupParseContext
    1.36 +   const char *ltype;
    1.37 +   const char *list_type;
    1.38 +   const char *owner;
    1.39 ++
    1.40 +   GConfValueType vtype;
    1.41 +-  const char *dummy1, *dummy2, *dummy3, *dummy4;
    1.42 ++  const char *dummy1, *dummy2, *dummy3, *dummy4, *dummy5;
    1.43 +   
    1.44 + #if 0
    1.45 +   g_assert (ELEMENT_IS ("entry") ||
    1.46 +@@ -2377,6 +2383,7 @@ parse_value_element (GMarkupParseContext
    1.47 +                           "muser", &dummy2,
    1.48 +                           "mtime", &dummy3,
    1.49 +                           "schema", &dummy4,
    1.50 ++                          "gettext_domain", &dummy5,
    1.51 + 
    1.52 +                           NULL))
    1.53 +     return;
    1.54 +@@ -2683,6 +2690,7 @@ parse_entry_element (GMarkupParseContext
    1.55 +       const char *mtime;
    1.56 +       const char *schema;
    1.57 +       const char *type;
    1.58 ++      const char *gettext_domain;
    1.59 +       const char *dummy1, *dummy2, *dummy3, *dummy4;
    1.60 +       const char *dummy5, *dummy6, *dummy7;
    1.61 +       GConfValue *value;
    1.62 +@@ -2693,6 +2701,7 @@ parse_entry_element (GMarkupParseContext
    1.63 +       mtime = NULL;
    1.64 +       schema = NULL;
    1.65 +       type = NULL;
    1.66 ++      gettext_domain = NULL;
    1.67 + 
    1.68 +       if (!locate_attributes (context, element_name, attribute_names, attribute_values,
    1.69 +                               error,
    1.70 +@@ -2701,6 +2710,7 @@ parse_entry_element (GMarkupParseContext
    1.71 +                               "mtime", &mtime,
    1.72 +                               "schema", &schema,
    1.73 +                               "type", &type,
    1.74 ++                              "gettext_domain", &gettext_domain,
    1.75 +                           
    1.76 +                               /* These are allowed but we don't use them until
    1.77 +                                * parse_value_element
    1.78 +@@ -2768,6 +2778,9 @@ parse_entry_element (GMarkupParseContext
    1.79 +        */
    1.80 +       if (schema)
    1.81 +         entry->schema_name = g_strdup (schema);
    1.82 ++
    1.83 ++      if (gettext_domain)
    1.84 ++        entry->gettext_domain = g_intern_string (gettext_domain);
    1.85 +     }
    1.86 +   else
    1.87 +     {
    1.88 +@@ -3716,6 +3729,7 @@ write_value_element (GConfValue *value,
    1.89 +         GConfSchema *schema;
    1.90 +         GConfValueType stype;
    1.91 +         const char *owner;
    1.92 ++        const char *gettext_domain;
    1.93 +         
    1.94 +         schema = gconf_value_get_schema (value);
    1.95 + 
    1.96 +@@ -3741,6 +3755,23 @@ write_value_element (GConfValue *value,
    1.97 +             
    1.98 +             g_free (s);
    1.99 +           }
   1.100 ++
   1.101 ++        gettext_domain = gconf_schema_get_gettext_domain (schema);
   1.102 ++        
   1.103 ++        if (gettext_domain)
   1.104 ++          {
   1.105 ++            char *s;
   1.106 ++
   1.107 ++            s = g_markup_escape_text (gettext_domain, -1);
   1.108 ++            
   1.109 ++            if (fprintf (f, " gettext_domain=\"%s\"", s) < 0)
   1.110 ++              {
   1.111 ++                g_free (s);
   1.112 ++                return FALSE;
   1.113 ++              }
   1.114 ++            
   1.115 ++            g_free (s);
   1.116 ++          }
   1.117 +         
   1.118 +         if (stype == GCONF_VALUE_LIST)
   1.119 +           {
   1.120 +diff -up GConf-2.26.0/doc/gconf-1.0.dtd.gettext GConf-2.26.0/doc/gconf-1.0.dtd
   1.121 +--- GConf-2.26.0/doc/gconf-1.0.dtd.gettext	2009-04-26 23:33:17.240736103 -0400
   1.122 ++++ GConf-2.26.0/doc/gconf-1.0.dtd	2009-04-26 23:34:25.027700384 -0400
   1.123 +@@ -7,7 +7,7 @@
   1.124 + <!-- A single schema. What I am trying to say is "this set of
   1.125 + elements, in any order". Duplicate elements (apart from <locale>) are
   1.126 + not allowed). -->
   1.127 +-<!ELEMENT schema  (key|applyto*|owner?|type|(list_type|(car_type,cdr_type))?|default?|locale*)*>
   1.128 ++<!ELEMENT schema  (key|applyto*|owner?|type|(list_type|(car_type,cdr_type))?|default?|locale*|gettext_domain?)*>
   1.129 + 
   1.130 + <!-- The key for this schema (e.g. /schemas/apps/foo/bar) -->
   1.131 + <!ELEMENT key     (#PCDATA)>
   1.132 +diff -up GConf-2.26.0/gconf/gconf-internals.c.gettext GConf-2.26.0/gconf/gconf-internals.c
   1.133 +--- GConf-2.26.0/gconf/gconf-internals.c.gettext	2009-04-26 23:34:10.994700035 -0400
   1.134 ++++ GConf-2.26.0/gconf/gconf-internals.c	2009-04-26 23:34:53.767450191 -0400
   1.135 +@@ -513,6 +513,7 @@ gconf_fill_corba_schema_from_gconf_schem
   1.136 +   cs->short_desc = CORBA_string_dup (gconf_schema_get_short_desc (sc) ? gconf_schema_get_short_desc (sc) : "");
   1.137 +   cs->long_desc = CORBA_string_dup (gconf_schema_get_long_desc (sc) ? gconf_schema_get_long_desc (sc) : "");
   1.138 +   cs->owner = CORBA_string_dup (gconf_schema_get_owner (sc) ? gconf_schema_get_owner (sc) : "");
   1.139 ++  cs->gettext_domain = CORBA_string_dup (gconf_schema_get_gettext_domain (sc) ? gconf_schema_get_gettext_domain (sc) : "");
   1.140 + 
   1.141 +   {
   1.142 +     gchar* encoded;
   1.143 +@@ -600,6 +601,14 @@ gconf_schema_from_corba_schema(const Con
   1.144 +         gconf_schema_set_owner(sc, cs->owner);
   1.145 +     }
   1.146 +       
   1.147 ++  if (*cs->gettext_domain != '\0')
   1.148 ++    {
   1.149 ++      if (!g_utf8_validate (cs->gettext_domain, -1, NULL))
   1.150 ++        gconf_log (GCL_ERR, _("Invalid UTF-8 in gettext domain for schema"));
   1.151 ++      else
   1.152 ++        gconf_schema_set_gettext_domain(sc, cs->gettext_domain);
   1.153 ++    }
   1.154 ++      
   1.155 +   {
   1.156 +     GConfValue* val;
   1.157 + 
   1.158 +diff -up GConf-2.26.0/gconf/gconf-schema.c.gettext GConf-2.26.0/gconf/gconf-schema.c
   1.159 +--- GConf-2.26.0/gconf/gconf-schema.c.gettext	2009-04-26 23:33:26.787483545 -0400
   1.160 ++++ GConf-2.26.0/gconf/gconf-schema.c	2009-04-26 23:35:54.240450142 -0400
   1.161 +@@ -32,9 +32,10 @@ typedef struct {
   1.162 +   GConfValueType car_type; /* Pair car type of the described entry */
   1.163 +   GConfValueType cdr_type; /* Pair cdr type of the described entry */
   1.164 +   gchar* locale;       /* Schema locale */
   1.165 +-  gchar* owner;        /* Name of creating application */
   1.166 ++  const gchar* owner;        /* Name of creating application */
   1.167 +   gchar* short_desc;   /* 40 char or less description, no newlines */
   1.168 +   gchar* long_desc;    /* could be a paragraph or so */
   1.169 ++  const gchar* gettext_domain; /* description gettext domain */
   1.170 +   GConfValue* default_value; /* Default value of the key */
   1.171 + } GConfRealSchema;
   1.172 + 
   1.173 +@@ -63,7 +64,6 @@ gconf_schema_free (GConfSchema* sc)
   1.174 +   g_free (real->locale);
   1.175 +   g_free (real->short_desc);
   1.176 +   g_free (real->long_desc);
   1.177 +-  g_free (real->owner);
   1.178 + 
   1.179 +   if (real->default_value)
   1.180 +     gconf_value_free (real->default_value);
   1.181 +@@ -91,7 +91,9 @@ gconf_schema_copy (const GConfSchema* sc
   1.182 + 
   1.183 +   dest->long_desc = g_strdup (real->long_desc);
   1.184 + 
   1.185 +-  dest->owner = g_strdup (real->owner);
   1.186 ++  dest->gettext_domain = real->gettext_domain;
   1.187 ++
   1.188 ++  dest->owner = real->owner;
   1.189 + 
   1.190 +   dest->default_value = real->default_value ? gconf_value_copy (real->default_value) : NULL;
   1.191 +   
   1.192 +@@ -136,6 +138,17 @@ gconf_schema_set_locale (GConfSchema* sc
   1.193 +     REAL_SCHEMA (sc)->locale = NULL;
   1.194 + }
   1.195 + 
   1.196 ++void
   1.197 ++gconf_schema_set_gettext_domain (GConfSchema* sc, const gchar* domain)
   1.198 ++{
   1.199 ++  g_return_if_fail (domain == NULL || g_utf8_validate (domain, -1, NULL));
   1.200 ++  
   1.201 ++  if (domain)
   1.202 ++    REAL_SCHEMA (sc)->gettext_domain = g_intern_string (domain);
   1.203 ++  else 
   1.204 ++    REAL_SCHEMA (sc)->gettext_domain = NULL;
   1.205 ++}
   1.206 ++
   1.207 + void          
   1.208 + gconf_schema_set_short_desc (GConfSchema* sc, const gchar* desc)
   1.209 + {
   1.210 +@@ -169,11 +182,8 @@ gconf_schema_set_owner (GConfSchema* sc,
   1.211 + {
   1.212 +   g_return_if_fail (owner == NULL || g_utf8_validate (owner, -1, NULL));
   1.213 +   
   1.214 +-  if (REAL_SCHEMA (sc)->owner)
   1.215 +-    g_free (REAL_SCHEMA (sc)->owner);
   1.216 +-
   1.217 +   if (owner)
   1.218 +-    REAL_SCHEMA (sc)->owner = g_strdup (owner);
   1.219 ++    REAL_SCHEMA (sc)->owner = g_intern_string (owner);
   1.220 +   else
   1.221 +     REAL_SCHEMA (sc)->owner = NULL;
   1.222 + }
   1.223 +@@ -228,6 +238,14 @@ gconf_schema_validate (const GConfSchema
   1.224 +       return FALSE;
   1.225 +     }
   1.226 + 
   1.227 ++  if (real->gettext_domain && !g_utf8_validate (real->gettext_domain, -1, NULL))
   1.228 ++    {
   1.229 ++      g_set_error (err, GCONF_ERROR,
   1.230 ++                   GCONF_ERROR_FAILED,
   1.231 ++                   _("Schema contains invalid UTF-8"));
   1.232 ++      return FALSE;
   1.233 ++    }
   1.234 ++
   1.235 +   if (real->owner && !g_utf8_validate (real->owner, -1, NULL))
   1.236 +     {
   1.237 +       g_set_error (err, GCONF_ERROR,
   1.238 +@@ -299,11 +317,32 @@ gconf_schema_get_locale (const GConfSche
   1.239 + }
   1.240 + 
   1.241 + const char*
   1.242 ++gconf_schema_get_gettext_domain (const GConfSchema *schema)
   1.243 ++{
   1.244 ++  g_return_val_if_fail (schema != NULL, NULL);
   1.245 ++
   1.246 ++  return REAL_SCHEMA (schema)->gettext_domain;
   1.247 ++}
   1.248 ++
   1.249 ++static inline const char *
   1.250 ++schema_translate (const GConfSchema *schema,
   1.251 ++                  const char        *string)
   1.252 ++{
   1.253 ++  if (REAL_SCHEMA (schema)->gettext_domain)
   1.254 ++    {
   1.255 ++      bind_textdomain_codeset (REAL_SCHEMA (schema)->gettext_domain, "UTF-8");
   1.256 ++      return g_dgettext(REAL_SCHEMA (schema)->gettext_domain, string);
   1.257 ++    }
   1.258 ++  else
   1.259 ++    return string;
   1.260 ++}
   1.261 ++
   1.262 ++const char*
   1.263 + gconf_schema_get_short_desc (const GConfSchema *schema)
   1.264 + {
   1.265 +   g_return_val_if_fail (schema != NULL, NULL);
   1.266 + 
   1.267 +-  return REAL_SCHEMA (schema)->short_desc;
   1.268 ++ return schema_translate (schema, REAL_SCHEMA (schema)->short_desc);
   1.269 + }
   1.270 + 
   1.271 + const char*
   1.272 +@@ -311,7 +350,7 @@ gconf_schema_get_long_desc (const GConfS
   1.273 + {
   1.274 +   g_return_val_if_fail (schema != NULL, NULL);
   1.275 + 
   1.276 +-  return REAL_SCHEMA (schema)->long_desc;
   1.277 ++ return schema_translate (schema, REAL_SCHEMA (schema)->long_desc);
   1.278 + }
   1.279 + 
   1.280 + const char*
   1.281 +diff -up GConf-2.26.0/gconf/gconf-schema.h.gettext GConf-2.26.0/gconf/gconf-schema.h
   1.282 +--- GConf-2.26.0/gconf/gconf-schema.h.gettext	2009-04-26 23:33:33.979744088 -0400
   1.283 ++++ GConf-2.26.0/gconf/gconf-schema.h	2009-04-26 23:34:25.030737043 -0400
   1.284 +@@ -48,6 +48,8 @@ void gconf_schema_set_cdr_type          
   1.285 +                                             GConfValueType  type);
   1.286 + void gconf_schema_set_locale               (GConfSchema    *sc,
   1.287 +                                             const gchar    *locale);
   1.288 ++void gconf_schema_set_gettext_domain       (GConfSchema    *sc,
   1.289 ++                                            const gchar    *domain);
   1.290 + void gconf_schema_set_short_desc           (GConfSchema    *sc,
   1.291 +                                             const gchar    *desc);
   1.292 + void gconf_schema_set_long_desc            (GConfSchema    *sc,
   1.293 +@@ -65,6 +67,7 @@ GConfValueType gconf_schema_get_list_typ
   1.294 + GConfValueType gconf_schema_get_car_type      (const GConfSchema *schema);
   1.295 + GConfValueType gconf_schema_get_cdr_type      (const GConfSchema *schema);
   1.296 + const char*    gconf_schema_get_locale        (const GConfSchema *schema);
   1.297 ++const char*    gconf_schema_get_gettext_domain(const GConfSchema *schema);
   1.298 + const char*    gconf_schema_get_short_desc    (const GConfSchema *schema);
   1.299 + const char*    gconf_schema_get_long_desc     (const GConfSchema *schema);
   1.300 + const char*    gconf_schema_get_owner         (const GConfSchema *schema);
   1.301 +diff -up GConf-2.26.0/gconf/gconftool.c.gettext GConf-2.26.0/gconf/gconftool.c
   1.302 +--- GConf-2.26.0/gconf/gconftool.c.gettext	2009-04-26 23:33:41.907451190 -0400
   1.303 ++++ GConf-2.26.0/gconf/gconftool.c	2009-04-26 23:34:25.034736752 -0400
   1.304 +@@ -3295,6 +3295,7 @@ struct _SchemaInfo {
   1.305 +   GConfValueType cdr_type;
   1.306 +   GConfValue* global_default;
   1.307 +   GHashTable* hash;
   1.308 ++  gchar* gettext_domain;
   1.309 + };
   1.310 + 
   1.311 + static int
   1.312 +@@ -3547,6 +3548,15 @@ extract_global_info(xmlNodePtr node,
   1.313 +               else
   1.314 +                 g_printerr (_("WARNING: empty <applyto> node"));
   1.315 +             }
   1.316 ++          else if (strcmp((char *)iter->name, "gettext_domain") == 0)
   1.317 ++            {
   1.318 ++              tmp = (char *)xmlNodeGetContent(iter);
   1.319 ++              if (tmp)
   1.320 ++                {
   1.321 ++                  info->gettext_domain = g_strdup(tmp);
   1.322 ++                  xmlFree(tmp);
   1.323 ++                }
   1.324 ++            }
   1.325 +           else
   1.326 +             g_printerr (_("WARNING: node <%s> not understood below <schema>\n"),
   1.327 + 			iter->name);
   1.328 +@@ -3636,6 +3646,9 @@ process_locale_info(xmlNodePtr node, Sch
   1.329 +   if (info->owner != NULL)
   1.330 +     gconf_schema_set_owner(schema, info->owner);
   1.331 + 
   1.332 ++  if (info->gettext_domain != NULL)
   1.333 ++    gconf_schema_set_gettext_domain(schema, info->gettext_domain);
   1.334 ++
   1.335 +   xmlFree(name);
   1.336 + 
   1.337 +   /* Locale-specific info */
   1.338 +@@ -3765,6 +3778,7 @@ get_schema_from_xml(xmlNodePtr node, gch
   1.339 +   info.apply_to = NULL;
   1.340 +   info.owner = NULL;
   1.341 +   info.global_default = NULL;
   1.342 ++  info.gettext_domain = NULL;
   1.343 +   info.hash = g_hash_table_new(g_str_hash, g_str_equal);
   1.344 +   
   1.345 +   extract_global_info(node, &info);
   1.346 +@@ -3801,6 +3815,8 @@ get_schema_from_xml(xmlNodePtr node, gch
   1.347 +             ;  /* nothing */
   1.348 +           else if (strcmp((char *)iter->name, "applyto") == 0)
   1.349 +             ;  /* nothing */
   1.350 ++          else if (strcmp((char *)iter->name, "gettext_domain") == 0)
   1.351 ++            ;  /* nothing */
   1.352 +           else if (strcmp((char *)iter->name, "locale") == 0)
   1.353 +             {
   1.354 +               process_locale_info(iter, &info);
   1.355 +diff -up GConf-2.26.0/gconf/GConfX.idl.gettext GConf-2.26.0/gconf/GConfX.idl
   1.356 +--- GConf-2.26.0/gconf/GConfX.idl.gettext	2009-04-26 23:33:58.457483190 -0400
   1.357 ++++ GConf-2.26.0/gconf/GConfX.idl	2009-04-26 23:34:53.764448732 -0400
   1.358 +@@ -16,6 +16,7 @@ struct ConfigSchema {
   1.359 +   string short_desc;
   1.360 +   string long_desc;
   1.361 +   string owner;
   1.362 ++  string gettext_domain;
   1.363 +   // Work around lack of recursive data types
   1.364 +   string encoded_default_value;
   1.365 + };
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/GConf/stuff/gconf-reload.patch	Sun Jan 09 22:22:13 2011 +0000
     2.3 @@ -0,0 +1,20 @@
     2.4 +--- GConf-2.16.0/gconf/gconftool.c.orig	2006-10-14 17:37:14.000000000 +0000
     2.5 ++++ GConf-2.16.0/gconf/gconftool.c	2006-10-14 17:39:27.000000000 +0000
     2.6 +@@ -963,6 +963,8 @@ main (int argc, char** argv)
     2.7 +       
     2.8 +       gconf_engine_unref (conf);
     2.9 + 
    2.10 ++      g_spawn_command_line_sync ("/usr/bin/killall -q -TERM " GCONF_SERVERDIR "/" GCONFD, NULL, NULL, NULL, NULL);
    2.11 ++
    2.12 +       return retval;
    2.13 +     }
    2.14 + 
    2.15 +@@ -975,6 +977,8 @@ main (int argc, char** argv)
    2.16 +       
    2.17 +       gconf_engine_unref (conf);
    2.18 + 
    2.19 ++      g_spawn_command_line_sync ("/usr/bin/killall -q -TERM " GCONF_SERVERDIR "/" GCONFD, NULL, NULL, NULL, NULL);
    2.20 ++
    2.21 +       return retval;
    2.22 +     }
    2.23 +