| 1 |
diff -up GConf-2.26.0/backends/markup-tree.c.gettext GConf-2.26.0/backends/markup-tree.c
|
| 2 |
--- GConf-2.26.0/backends/markup-tree.c.gettext 2009-04-26 23:33:05.258484987 -0400
|
| 3 |
+++ GConf-2.26.0/backends/markup-tree.c 2009-04-26 23:34:25.026700526 -0400
|
| 4 |
@@ -52,6 +52,7 @@ struct _MarkupEntry
|
| 5 |
char *schema_name;
|
| 6 |
char *mod_user;
|
| 7 |
GTime mod_time;
|
| 8 |
+ const char *gettext_domain;
|
| 9 |
};
|
| 10 |
|
| 11 |
static LocalSchemaInfo* local_schema_info_new (void);
|
| 12 |
@@ -1593,6 +1594,8 @@ markup_entry_set_value (MarkupEntry
|
| 13 |
gconf_schema_get_type (schema));
|
| 14 |
gconf_schema_set_owner (current_schema,
|
| 15 |
gconf_schema_get_owner (schema));
|
| 16 |
+ gconf_schema_set_gettext_domain (current_schema,
|
| 17 |
+ gconf_schema_get_gettext_domain (schema));
|
| 18 |
}
|
| 19 |
|
| 20 |
/* Update mod time */
|
| 21 |
@@ -1805,6 +1808,8 @@ markup_entry_get_value (MarkupEntry *ent
|
| 22 |
else if (c_local_schema && c_local_schema->long_desc)
|
| 23 |
gconf_schema_set_long_desc (schema, c_local_schema->long_desc);
|
| 24 |
|
| 25 |
+ gconf_schema_set_gettext_domain (schema, entry->gettext_domain);
|
| 26 |
+
|
| 27 |
return retval;
|
| 28 |
}
|
| 29 |
}
|
| 30 |
@@ -2339,8 +2344,9 @@ parse_value_element (GMarkupParseContext
|
| 31 |
const char *ltype;
|
| 32 |
const char *list_type;
|
| 33 |
const char *owner;
|
| 34 |
+
|
| 35 |
GConfValueType vtype;
|
| 36 |
- const char *dummy1, *dummy2, *dummy3, *dummy4;
|
| 37 |
+ const char *dummy1, *dummy2, *dummy3, *dummy4, *dummy5;
|
| 38 |
|
| 39 |
#if 0
|
| 40 |
g_assert (ELEMENT_IS ("entry") ||
|
| 41 |
@@ -2377,6 +2383,7 @@ parse_value_element (GMarkupParseContext
|
| 42 |
"muser", &dummy2,
|
| 43 |
"mtime", &dummy3,
|
| 44 |
"schema", &dummy4,
|
| 45 |
+ "gettext_domain", &dummy5,
|
| 46 |
|
| 47 |
NULL))
|
| 48 |
return;
|
| 49 |
@@ -2683,6 +2690,7 @@ parse_entry_element (GMarkupParseContext
|
| 50 |
const char *mtime;
|
| 51 |
const char *schema;
|
| 52 |
const char *type;
|
| 53 |
+ const char *gettext_domain;
|
| 54 |
const char *dummy1, *dummy2, *dummy3, *dummy4;
|
| 55 |
const char *dummy5, *dummy6, *dummy7;
|
| 56 |
GConfValue *value;
|
| 57 |
@@ -2693,6 +2701,7 @@ parse_entry_element (GMarkupParseContext
|
| 58 |
mtime = NULL;
|
| 59 |
schema = NULL;
|
| 60 |
type = NULL;
|
| 61 |
+ gettext_domain = NULL;
|
| 62 |
|
| 63 |
if (!locate_attributes (context, element_name, attribute_names, attribute_values,
|
| 64 |
error,
|
| 65 |
@@ -2701,6 +2710,7 @@ parse_entry_element (GMarkupParseContext
|
| 66 |
"mtime", &mtime,
|
| 67 |
"schema", &schema,
|
| 68 |
"type", &type,
|
| 69 |
+ "gettext_domain", &gettext_domain,
|
| 70 |
|
| 71 |
/* These are allowed but we don't use them until
|
| 72 |
* parse_value_element
|
| 73 |
@@ -2768,6 +2778,9 @@ parse_entry_element (GMarkupParseContext
|
| 74 |
*/
|
| 75 |
if (schema)
|
| 76 |
entry->schema_name = g_strdup (schema);
|
| 77 |
+
|
| 78 |
+ if (gettext_domain)
|
| 79 |
+ entry->gettext_domain = g_intern_string (gettext_domain);
|
| 80 |
}
|
| 81 |
else
|
| 82 |
{
|
| 83 |
@@ -3716,6 +3729,7 @@ write_value_element (GConfValue *value,
|
| 84 |
GConfSchema *schema;
|
| 85 |
GConfValueType stype;
|
| 86 |
const char *owner;
|
| 87 |
+ const char *gettext_domain;
|
| 88 |
|
| 89 |
schema = gconf_value_get_schema (value);
|
| 90 |
|
| 91 |
@@ -3741,6 +3755,23 @@ write_value_element (GConfValue *value,
|
| 92 |
|
| 93 |
g_free (s);
|
| 94 |
}
|
| 95 |
+
|
| 96 |
+ gettext_domain = gconf_schema_get_gettext_domain (schema);
|
| 97 |
+
|
| 98 |
+ if (gettext_domain)
|
| 99 |
+ {
|
| 100 |
+ char *s;
|
| 101 |
+
|
| 102 |
+ s = g_markup_escape_text (gettext_domain, -1);
|
| 103 |
+
|
| 104 |
+ if (fprintf (f, " gettext_domain=\"%s\"", s) < 0)
|
| 105 |
+ {
|
| 106 |
+ g_free (s);
|
| 107 |
+ return FALSE;
|
| 108 |
+ }
|
| 109 |
+
|
| 110 |
+ g_free (s);
|
| 111 |
+ }
|
| 112 |
|
| 113 |
if (stype == GCONF_VALUE_LIST)
|
| 114 |
{
|
| 115 |
diff -up GConf-2.26.0/doc/gconf-1.0.dtd.gettext GConf-2.26.0/doc/gconf-1.0.dtd
|
| 116 |
--- GConf-2.26.0/doc/gconf-1.0.dtd.gettext 2009-04-26 23:33:17.240736103 -0400
|
| 117 |
+++ GConf-2.26.0/doc/gconf-1.0.dtd 2009-04-26 23:34:25.027700384 -0400
|
| 118 |
@@ -7,7 +7,7 @@
|
| 119 |
<!-- A single schema. What I am trying to say is "this set of
|
| 120 |
elements, in any order". Duplicate elements (apart from <locale>) are
|
| 121 |
not allowed). -->
|
| 122 |
-<!ELEMENT schema (key|applyto*|owner?|type|(list_type|(car_type,cdr_type))?|default?|locale*)*>
|
| 123 |
+<!ELEMENT schema (key|applyto*|owner?|type|(list_type|(car_type,cdr_type))?|default?|locale*|gettext_domain?)*>
|
| 124 |
|
| 125 |
<!-- The key for this schema (e.g. /schemas/apps/foo/bar) -->
|
| 126 |
<!ELEMENT key (#PCDATA)>
|
| 127 |
diff -up GConf-2.26.0/gconf/gconf-internals.c.gettext GConf-2.26.0/gconf/gconf-internals.c
|
| 128 |
--- GConf-2.26.0/gconf/gconf-internals.c.gettext 2009-04-26 23:34:10.994700035 -0400
|
| 129 |
+++ GConf-2.26.0/gconf/gconf-internals.c 2009-04-26 23:34:53.767450191 -0400
|
| 130 |
@@ -513,6 +513,7 @@ gconf_fill_corba_schema_from_gconf_schem
|
| 131 |
cs->short_desc = CORBA_string_dup (gconf_schema_get_short_desc (sc) ? gconf_schema_get_short_desc (sc) : "");
|
| 132 |
cs->long_desc = CORBA_string_dup (gconf_schema_get_long_desc (sc) ? gconf_schema_get_long_desc (sc) : "");
|
| 133 |
cs->owner = CORBA_string_dup (gconf_schema_get_owner (sc) ? gconf_schema_get_owner (sc) : "");
|
| 134 |
+ cs->gettext_domain = CORBA_string_dup (gconf_schema_get_gettext_domain (sc) ? gconf_schema_get_gettext_domain (sc) : "");
|
| 135 |
|
| 136 |
{
|
| 137 |
gchar* encoded;
|
| 138 |
@@ -600,6 +601,14 @@ gconf_schema_from_corba_schema(const Con
|
| 139 |
gconf_schema_set_owner(sc, cs->owner);
|
| 140 |
}
|
| 141 |
|
| 142 |
+ if (*cs->gettext_domain != '\0')
|
| 143 |
+ {
|
| 144 |
+ if (!g_utf8_validate (cs->gettext_domain, -1, NULL))
|
| 145 |
+ gconf_log (GCL_ERR, _("Invalid UTF-8 in gettext domain for schema"));
|
| 146 |
+ else
|
| 147 |
+ gconf_schema_set_gettext_domain(sc, cs->gettext_domain);
|
| 148 |
+ }
|
| 149 |
+
|
| 150 |
{
|
| 151 |
GConfValue* val;
|
| 152 |
|
| 153 |
diff -up GConf-2.26.0/gconf/gconf-schema.c.gettext GConf-2.26.0/gconf/gconf-schema.c
|
| 154 |
--- GConf-2.26.0/gconf/gconf-schema.c.gettext 2009-04-26 23:33:26.787483545 -0400
|
| 155 |
+++ GConf-2.26.0/gconf/gconf-schema.c 2009-04-26 23:35:54.240450142 -0400
|
| 156 |
@@ -32,9 +32,10 @@ typedef struct {
|
| 157 |
GConfValueType car_type; /* Pair car type of the described entry */
|
| 158 |
GConfValueType cdr_type; /* Pair cdr type of the described entry */
|
| 159 |
gchar* locale; /* Schema locale */
|
| 160 |
- gchar* owner; /* Name of creating application */
|
| 161 |
+ const gchar* owner; /* Name of creating application */
|
| 162 |
gchar* short_desc; /* 40 char or less description, no newlines */
|
| 163 |
gchar* long_desc; /* could be a paragraph or so */
|
| 164 |
+ const gchar* gettext_domain; /* description gettext domain */
|
| 165 |
GConfValue* default_value; /* Default value of the key */
|
| 166 |
} GConfRealSchema;
|
| 167 |
|
| 168 |
@@ -63,7 +64,6 @@ gconf_schema_free (GConfSchema* sc)
|
| 169 |
g_free (real->locale);
|
| 170 |
g_free (real->short_desc);
|
| 171 |
g_free (real->long_desc);
|
| 172 |
- g_free (real->owner);
|
| 173 |
|
| 174 |
if (real->default_value)
|
| 175 |
gconf_value_free (real->default_value);
|
| 176 |
@@ -91,7 +91,9 @@ gconf_schema_copy (const GConfSchema* sc
|
| 177 |
|
| 178 |
dest->long_desc = g_strdup (real->long_desc);
|
| 179 |
|
| 180 |
- dest->owner = g_strdup (real->owner);
|
| 181 |
+ dest->gettext_domain = real->gettext_domain;
|
| 182 |
+
|
| 183 |
+ dest->owner = real->owner;
|
| 184 |
|
| 185 |
dest->default_value = real->default_value ? gconf_value_copy (real->default_value) : NULL;
|
| 186 |
|
| 187 |
@@ -136,6 +138,17 @@ gconf_schema_set_locale (GConfSchema* sc
|
| 188 |
REAL_SCHEMA (sc)->locale = NULL;
|
| 189 |
}
|
| 190 |
|
| 191 |
+void
|
| 192 |
+gconf_schema_set_gettext_domain (GConfSchema* sc, const gchar* domain)
|
| 193 |
+{
|
| 194 |
+ g_return_if_fail (domain == NULL || g_utf8_validate (domain, -1, NULL));
|
| 195 |
+
|
| 196 |
+ if (domain)
|
| 197 |
+ REAL_SCHEMA (sc)->gettext_domain = g_intern_string (domain);
|
| 198 |
+ else
|
| 199 |
+ REAL_SCHEMA (sc)->gettext_domain = NULL;
|
| 200 |
+}
|
| 201 |
+
|
| 202 |
void
|
| 203 |
gconf_schema_set_short_desc (GConfSchema* sc, const gchar* desc)
|
| 204 |
{
|
| 205 |
@@ -169,11 +182,8 @@ gconf_schema_set_owner (GConfSchema* sc,
|
| 206 |
{
|
| 207 |
g_return_if_fail (owner == NULL || g_utf8_validate (owner, -1, NULL));
|
| 208 |
|
| 209 |
- if (REAL_SCHEMA (sc)->owner)
|
| 210 |
- g_free (REAL_SCHEMA (sc)->owner);
|
| 211 |
-
|
| 212 |
if (owner)
|
| 213 |
- REAL_SCHEMA (sc)->owner = g_strdup (owner);
|
| 214 |
+ REAL_SCHEMA (sc)->owner = g_intern_string (owner);
|
| 215 |
else
|
| 216 |
REAL_SCHEMA (sc)->owner = NULL;
|
| 217 |
}
|
| 218 |
@@ -228,6 +238,14 @@ gconf_schema_validate (const GConfSchema
|
| 219 |
return FALSE;
|
| 220 |
}
|
| 221 |
|
| 222 |
+ if (real->gettext_domain && !g_utf8_validate (real->gettext_domain, -1, NULL))
|
| 223 |
+ {
|
| 224 |
+ g_set_error (err, GCONF_ERROR,
|
| 225 |
+ GCONF_ERROR_FAILED,
|
| 226 |
+ _("Schema contains invalid UTF-8"));
|
| 227 |
+ return FALSE;
|
| 228 |
+ }
|
| 229 |
+
|
| 230 |
if (real->owner && !g_utf8_validate (real->owner, -1, NULL))
|
| 231 |
{
|
| 232 |
g_set_error (err, GCONF_ERROR,
|
| 233 |
@@ -299,11 +317,32 @@ gconf_schema_get_locale (const GConfSche
|
| 234 |
}
|
| 235 |
|
| 236 |
const char*
|
| 237 |
+gconf_schema_get_gettext_domain (const GConfSchema *schema)
|
| 238 |
+{
|
| 239 |
+ g_return_val_if_fail (schema != NULL, NULL);
|
| 240 |
+
|
| 241 |
+ return REAL_SCHEMA (schema)->gettext_domain;
|
| 242 |
+}
|
| 243 |
+
|
| 244 |
+static inline const char *
|
| 245 |
+schema_translate (const GConfSchema *schema,
|
| 246 |
+ const char *string)
|
| 247 |
+{
|
| 248 |
+ if (REAL_SCHEMA (schema)->gettext_domain)
|
| 249 |
+ {
|
| 250 |
+ bind_textdomain_codeset (REAL_SCHEMA (schema)->gettext_domain, "UTF-8");
|
| 251 |
+ return g_dgettext(REAL_SCHEMA (schema)->gettext_domain, string);
|
| 252 |
+ }
|
| 253 |
+ else
|
| 254 |
+ return string;
|
| 255 |
+}
|
| 256 |
+
|
| 257 |
+const char*
|
| 258 |
gconf_schema_get_short_desc (const GConfSchema *schema)
|
| 259 |
{
|
| 260 |
g_return_val_if_fail (schema != NULL, NULL);
|
| 261 |
|
| 262 |
- return REAL_SCHEMA (schema)->short_desc;
|
| 263 |
+ return schema_translate (schema, REAL_SCHEMA (schema)->short_desc);
|
| 264 |
}
|
| 265 |
|
| 266 |
const char*
|
| 267 |
@@ -311,7 +350,7 @@ gconf_schema_get_long_desc (const GConfS
|
| 268 |
{
|
| 269 |
g_return_val_if_fail (schema != NULL, NULL);
|
| 270 |
|
| 271 |
- return REAL_SCHEMA (schema)->long_desc;
|
| 272 |
+ return schema_translate (schema, REAL_SCHEMA (schema)->long_desc);
|
| 273 |
}
|
| 274 |
|
| 275 |
const char*
|
| 276 |
diff -up GConf-2.26.0/gconf/gconf-schema.h.gettext GConf-2.26.0/gconf/gconf-schema.h
|
| 277 |
--- GConf-2.26.0/gconf/gconf-schema.h.gettext 2009-04-26 23:33:33.979744088 -0400
|
| 278 |
+++ GConf-2.26.0/gconf/gconf-schema.h 2009-04-26 23:34:25.030737043 -0400
|
| 279 |
@@ -48,6 +48,8 @@ void gconf_schema_set_cdr_type
|
| 280 |
GConfValueType type);
|
| 281 |
void gconf_schema_set_locale (GConfSchema *sc,
|
| 282 |
const gchar *locale);
|
| 283 |
+void gconf_schema_set_gettext_domain (GConfSchema *sc,
|
| 284 |
+ const gchar *domain);
|
| 285 |
void gconf_schema_set_short_desc (GConfSchema *sc,
|
| 286 |
const gchar *desc);
|
| 287 |
void gconf_schema_set_long_desc (GConfSchema *sc,
|
| 288 |
@@ -65,6 +67,7 @@ GConfValueType gconf_schema_get_list_typ
|
| 289 |
GConfValueType gconf_schema_get_car_type (const GConfSchema *schema);
|
| 290 |
GConfValueType gconf_schema_get_cdr_type (const GConfSchema *schema);
|
| 291 |
const char* gconf_schema_get_locale (const GConfSchema *schema);
|
| 292 |
+const char* gconf_schema_get_gettext_domain(const GConfSchema *schema);
|
| 293 |
const char* gconf_schema_get_short_desc (const GConfSchema *schema);
|
| 294 |
const char* gconf_schema_get_long_desc (const GConfSchema *schema);
|
| 295 |
const char* gconf_schema_get_owner (const GConfSchema *schema);
|
| 296 |
diff -up GConf-2.26.0/gconf/gconftool.c.gettext GConf-2.26.0/gconf/gconftool.c
|
| 297 |
--- GConf-2.26.0/gconf/gconftool.c.gettext 2009-04-26 23:33:41.907451190 -0400
|
| 298 |
+++ GConf-2.26.0/gconf/gconftool.c 2009-04-26 23:34:25.034736752 -0400
|
| 299 |
@@ -3295,6 +3295,7 @@ struct _SchemaInfo {
|
| 300 |
GConfValueType cdr_type;
|
| 301 |
GConfValue* global_default;
|
| 302 |
GHashTable* hash;
|
| 303 |
+ gchar* gettext_domain;
|
| 304 |
};
|
| 305 |
|
| 306 |
static int
|
| 307 |
@@ -3547,6 +3548,15 @@ extract_global_info(xmlNodePtr node,
|
| 308 |
else
|
| 309 |
g_printerr (_("WARNING: empty <applyto> node"));
|
| 310 |
}
|
| 311 |
+ else if (strcmp((char *)iter->name, "gettext_domain") == 0)
|
| 312 |
+ {
|
| 313 |
+ tmp = (char *)xmlNodeGetContent(iter);
|
| 314 |
+ if (tmp)
|
| 315 |
+ {
|
| 316 |
+ info->gettext_domain = g_strdup(tmp);
|
| 317 |
+ xmlFree(tmp);
|
| 318 |
+ }
|
| 319 |
+ }
|
| 320 |
else
|
| 321 |
g_printerr (_("WARNING: node <%s> not understood below <schema>\n"),
|
| 322 |
iter->name);
|
| 323 |
@@ -3636,6 +3646,9 @@ process_locale_info(xmlNodePtr node, Sch
|
| 324 |
if (info->owner != NULL)
|
| 325 |
gconf_schema_set_owner(schema, info->owner);
|
| 326 |
|
| 327 |
+ if (info->gettext_domain != NULL)
|
| 328 |
+ gconf_schema_set_gettext_domain(schema, info->gettext_domain);
|
| 329 |
+
|
| 330 |
xmlFree(name);
|
| 331 |
|
| 332 |
/* Locale-specific info */
|
| 333 |
@@ -3765,6 +3778,7 @@ get_schema_from_xml(xmlNodePtr node, gch
|
| 334 |
info.apply_to = NULL;
|
| 335 |
info.owner = NULL;
|
| 336 |
info.global_default = NULL;
|
| 337 |
+ info.gettext_domain = NULL;
|
| 338 |
info.hash = g_hash_table_new(g_str_hash, g_str_equal);
|
| 339 |
|
| 340 |
extract_global_info(node, &info);
|
| 341 |
@@ -3801,6 +3815,8 @@ get_schema_from_xml(xmlNodePtr node, gch
|
| 342 |
; /* nothing */
|
| 343 |
else if (strcmp((char *)iter->name, "applyto") == 0)
|
| 344 |
; /* nothing */
|
| 345 |
+ else if (strcmp((char *)iter->name, "gettext_domain") == 0)
|
| 346 |
+ ; /* nothing */
|
| 347 |
else if (strcmp((char *)iter->name, "locale") == 0)
|
| 348 |
{
|
| 349 |
process_locale_info(iter, &info);
|
| 350 |
diff -up GConf-2.26.0/gconf/GConfX.idl.gettext GConf-2.26.0/gconf/GConfX.idl
|
| 351 |
--- GConf-2.26.0/gconf/GConfX.idl.gettext 2009-04-26 23:33:58.457483190 -0400
|
| 352 |
+++ GConf-2.26.0/gconf/GConfX.idl 2009-04-26 23:34:53.764448732 -0400
|
| 353 |
@@ -16,6 +16,7 @@ struct ConfigSchema {
|
| 354 |
string short_desc;
|
| 355 |
string long_desc;
|
| 356 |
string owner;
|
| 357 |
+ string gettext_domain;
|
| 358 |
// Work around lack of recursive data types
|
| 359 |
string encoded_default_value;
|
| 360 |
};
|