diff options
author | Ted Gould <ted@gould.cx> | 2010-04-05 15:21:26 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-04-05 15:21:26 -0500 |
commit | 4213bc2aa17ca238d05ab36b67365522da58a56a (patch) | |
tree | 76757cfe91761c34a67204a8fdf5bd4e0892efcf /libindicator | |
parent | 49c5444af4042b1084c00009f5ff5a65996b300b (diff) | |
parent | 1200f51e90901eb120484ae3bb0a3912efb7bff4 (diff) | |
download | libayatana-indicator-4213bc2aa17ca238d05ab36b67365522da58a56a.tar.gz libayatana-indicator-4213bc2aa17ca238d05ab36b67365522da58a56a.tar.bz2 libayatana-indicator-4213bc2aa17ca238d05ab36b67365522da58a56a.zip |
* Upstream merge
* Chnages requested by pitt
Diffstat (limited to 'libindicator')
-rw-r--r-- | libindicator/indicator-desktop-shortcuts.c | 39 |
1 files changed, 26 insertions, 13 deletions
diff --git a/libindicator/indicator-desktop-shortcuts.c b/libindicator/indicator-desktop-shortcuts.c index 504d023..cfd8eef 100644 --- a/libindicator/indicator-desktop-shortcuts.c +++ b/libindicator/indicator-desktop-shortcuts.c @@ -234,12 +234,22 @@ parse_keyfile (IndicatorDesktopShortcuts * ids) return; } + /* Remove a previous translation domain if we had one + from a perviously 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 (g_key_file_has_key(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, "X-Ubuntu-Gettext-Domain", NULL)) { - if (priv->domain != NULL) { - g_free(priv->domain); - } + 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); } @@ -428,22 +438,25 @@ indicator_desktop_shortcuts_nick_get_name (IndicatorDesktopShortcuts * ids, cons } gchar * name = NULL; - if (priv->domain == NULL) { - name = g_key_file_get_locale_string(priv->keyfile, + 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 { - gchar * tempname = g_key_file_get_string(priv->keyfile, - groupheader, - G_KEY_FILE_DESKTOP_KEY_NAME, - NULL); - name = g_strdup(g_dgettext(priv->domain, tempname)); - g_free(tempname); + name = localeval; } - g_free(groupheader); + g_free(keyvalue); return name; } |