keyboard: Pass a gettext package when loading GConf
As GConf itself won't be passing us a translated entry by itself. https://bugzilla.gnome.org/show_bug.cgi?id=576570
This commit is contained in:
parent
17d775aee6
commit
73f155eaac
2 changed files with 14 additions and 1 deletions
|
@ -332,6 +332,7 @@ cc_keyboard_item_finalize (GObject *object)
|
|||
g_object_unref (client);
|
||||
|
||||
/* Free memory */
|
||||
g_free (item->gettext_package);
|
||||
g_free (item->gconf_key);
|
||||
g_free (item->description);
|
||||
g_free (item->desc_gconf_key);
|
||||
|
@ -412,6 +413,7 @@ binding_changed (GSettings *settings,
|
|||
|
||||
gboolean
|
||||
cc_keyboard_item_load_from_gconf (CcKeyboardItem *item,
|
||||
const char *gettext_package,
|
||||
const char *key)
|
||||
{
|
||||
GConfClient *client;
|
||||
|
@ -432,12 +434,21 @@ cc_keyboard_item_load_from_gconf (CcKeyboardItem *item,
|
|||
|
||||
if (gconf_entry_get_schema_name (entry)) {
|
||||
GConfSchema *schema;
|
||||
const char *description;
|
||||
|
||||
schema = gconf_client_get_schema (client,
|
||||
gconf_entry_get_schema_name (entry),
|
||||
NULL);
|
||||
if (schema != NULL) {
|
||||
item->description = g_strdup (gconf_schema_get_short_desc (schema));
|
||||
g_debug ("trying to get translation for '%s' using package '%s'",
|
||||
gconf_schema_get_short_desc (schema), gettext_package);
|
||||
if (gettext_package != NULL) {
|
||||
bind_textdomain_codeset (gettext_package, "UTF-8");
|
||||
description = dgettext (gettext_package, gconf_schema_get_short_desc (schema));
|
||||
} else {
|
||||
description = _(gconf_schema_get_short_desc (schema));
|
||||
}
|
||||
item->description = g_strdup (description);
|
||||
gconf_schema_free (schema);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@ typedef struct
|
|||
BindingGroupType group;
|
||||
GtkTreeModel *model;
|
||||
char *description;
|
||||
char *gettext_package;
|
||||
char *binding;
|
||||
|
||||
/* GCONF */
|
||||
|
@ -101,6 +102,7 @@ GType cc_keyboard_item_get_type (void);
|
|||
|
||||
CcKeyboardItem * cc_keyboard_item_new (CcKeyboardItemType type);
|
||||
gboolean cc_keyboard_item_load_from_gconf (CcKeyboardItem *item,
|
||||
const char *gettext_package,
|
||||
const char *key);
|
||||
gboolean cc_keyboard_item_load_from_gconf_dir (CcKeyboardItem *item,
|
||||
const char *key_dir);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue