aboutsummaryrefslogtreecommitdiff
path: root/libindicator/indicator-desktop-shortcuts.c
diff options
context:
space:
mode:
authorSebastien Bacher <seb128@ubuntu.com>2010-04-09 20:53:31 +0200
committerSebastien Bacher <seb128@ubuntu.com>2010-04-09 20:53:31 +0200
commitec36577978bd7e31c0f52083d5d9d05976edc2db (patch)
tree4e8150197b697ba1f15cd2a59e69d9d2511bfe69 /libindicator/indicator-desktop-shortcuts.c
parent0cf6e6003e546c808968c2a1cd909e10be00a12f (diff)
parent478b7f7a65f1ed01a915d65631c28d82401b7f22 (diff)
downloadlibayatana-indicator-ec36577978bd7e31c0f52083d5d9d05976edc2db.tar.gz
libayatana-indicator-ec36577978bd7e31c0f52083d5d9d05976edc2db.tar.bz2
libayatana-indicator-ec36577978bd7e31c0f52083d5d9d05976edc2db.zip
releasing version 0.3.8-0ubuntu10.3.8-0ubuntu1
Diffstat (limited to 'libindicator/indicator-desktop-shortcuts.c')
-rw-r--r--libindicator/indicator-desktop-shortcuts.c51
1 files changed, 45 insertions, 6 deletions
diff --git a/libindicator/indicator-desktop-shortcuts.c b/libindicator/indicator-desktop-shortcuts.c
index e86a6ab..b04b482 100644
--- a/libindicator/indicator-desktop-shortcuts.c
+++ b/libindicator/indicator-desktop-shortcuts.c
@@ -39,6 +39,7 @@ struct _IndicatorDesktopShortcutsPrivate {
GKeyFile * keyfile;
gchar * identity;
GArray * nicks;
+ gchar * domain;
};
enum {
@@ -100,6 +101,7 @@ indicator_desktop_shortcuts_init (IndicatorDesktopShortcuts *self)
priv->keyfile = NULL;
priv->identity = NULL;
+ priv->domain = NULL;
priv->nicks = g_array_new(TRUE, TRUE, sizeof(gchar *));
return;
@@ -131,6 +133,11 @@ indicator_desktop_shortcuts_finalize (GObject *object)
priv->identity = NULL;
}
+ if (priv->domain != NULL) {
+ g_free(priv->domain);
+ priv->domain = NULL;
+ }
+
if (priv->nicks != NULL) {
gint i;
for (i = 0; i < priv->nicks->len; i++) {
@@ -227,6 +234,25 @@ parse_keyfile (IndicatorDesktopShortcuts * ids)
return;
}
+ /* Remove a previous translation domain if we had one
+ from a previously parsed file. */
+ if (priv->domain != NULL) {
+ g_free(priv->domain);
+ priv->domain = NULL;
+ }
+
+ /* Check to see if there is a custom translation domain that
+ we should take into account. */
+ if (priv->domain == NULL &&
+ g_key_file_has_key(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, "X-GNOME-Gettext-Domain", NULL)) {
+ priv->domain = g_key_file_get_string(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, "X-GNOME-Gettext-Domain", NULL);
+ }
+
+ if (priv->domain == NULL &&
+ g_key_file_has_key(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, "X-Ubuntu-Gettext-Domain", NULL)) {
+ priv->domain = g_key_file_get_string(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, "X-Ubuntu-Gettext-Domain", NULL);
+ }
+
/* Okay, we've got everything we need. Let's get it on! */
gint i;
gsize num_nicks = 0;
@@ -411,14 +437,27 @@ indicator_desktop_shortcuts_nick_get_name (IndicatorDesktopShortcuts * ids, cons
return NULL;
}
- gchar * name = g_key_file_get_locale_string(priv->keyfile,
- groupheader,
- G_KEY_FILE_DESKTOP_KEY_NAME,
- NULL,
- NULL);
-
+ gchar * name = NULL;
+ gchar * keyvalue = g_key_file_get_string(priv->keyfile,
+ groupheader,
+ G_KEY_FILE_DESKTOP_KEY_NAME,
+ NULL);
+ gchar * localeval = g_key_file_get_locale_string(priv->keyfile,
+ groupheader,
+ G_KEY_FILE_DESKTOP_KEY_NAME,
+ NULL,
+ NULL);
g_free(groupheader);
+ if (priv->domain != NULL && g_strcmp0(keyvalue, localeval) == 0) {
+ name = g_strdup(g_dgettext(priv->domain, keyvalue));
+ g_free(localeval);
+ } else {
+ name = localeval;
+ }
+
+ g_free(keyvalue);
+
return name;
}