[gnome-control-center] keyboard: Pass a gettext package when loading GConf
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] keyboard: Pass a gettext package when loading GConf
- Date: Thu, 17 Feb 2011 13:00:57 +0000 (UTC)
commit 73f155eaacd4d486d54680a20a9bfd50f91a79d4
Author: Bastien Nocera <hadess hadess net>
Date: Thu Feb 17 12:19:38 2011 +0000
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
panels/keyboard/cc-keyboard-item.c | 13 ++++++++++++-
panels/keyboard/cc-keyboard-item.h | 2 ++
2 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/panels/keyboard/cc-keyboard-item.c b/panels/keyboard/cc-keyboard-item.c
index 0feea22..158823d 100644
--- a/panels/keyboard/cc-keyboard-item.c
+++ b/panels/keyboard/cc-keyboard-item.c
@@ -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);
}
}
diff --git a/panels/keyboard/cc-keyboard-item.h b/panels/keyboard/cc-keyboard-item.h
index 2a879b2..243d898 100644
--- a/panels/keyboard/cc-keyboard-item.h
+++ b/panels/keyboard/cc-keyboard-item.h
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]