diff options
author | Ted Gould <ted@gould.cx> | 2012-02-27 14:34:52 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2012-02-27 14:34:52 -0600 |
commit | 52c42ef36462d3dfc4396b219730a8f1d7bc8dcd (patch) | |
tree | 841e8f277765573f003265b7cafb28384ee71e56 | |
parent | 4baf9b7067554450de88e40d3336d9739ca79de5 (diff) | |
download | libayatana-indicator-52c42ef36462d3dfc4396b219730a8f1d7bc8dcd.tar.gz libayatana-indicator-52c42ef36462d3dfc4396b219730a8f1d7bc8dcd.tar.bz2 libayatana-indicator-52c42ef36462d3dfc4396b219730a8f1d7bc8dcd.zip |
Use the appropriate list of nicks and groups to find our data now
-rw-r--r-- | libindicator/indicator-desktop-shortcuts.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/libindicator/indicator-desktop-shortcuts.c b/libindicator/indicator-desktop-shortcuts.c index d58c81d..df588d1 100644 --- a/libindicator/indicator-desktop-shortcuts.c +++ b/libindicator/indicator-desktop-shortcuts.c @@ -281,16 +281,38 @@ parse_keyfile (IndicatorDesktopShortcuts * ids) priv->domain = g_key_file_get_string(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, "X-Ubuntu-Gettext-Domain", NULL); } + /* We need to figure out what we're looking for and what we want to + look for in the rest of the file */ + const gchar * list_name = NULL; + const gchar * group_format = NULL; + + switch (priv->actions) { + case ACTIONS_NONE: + /* None, let's just get outta here */ + return; + case ACTIONS_XAYATANA: + list_name = OLD_SHORTCUTS_KEY; + group_format = "%s " OLD_GROUP_SUFFIX; + break; + case ACTIONS_DESKTOP_SPEC: + list_name = ACTIONS_KEY; + group_format = ACTION_GROUP_PREFIX " %s"; + break; + default: + g_assert_not_reached(); + return; + } + /* Okay, we've got everything we need. Let's get it on! */ gint i; gsize num_nicks = 0; - gchar ** nicks = g_key_file_get_string_list(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, OLD_SHORTCUTS_KEY, &num_nicks, NULL); + gchar ** nicks = g_key_file_get_string_list(priv->keyfile, G_KEY_FILE_DESKTOP_GROUP, list_name, &num_nicks, NULL); /* If there is an error from get_string_list num_nicks should still be zero, so this loop will drop out. */ for (i = 0; i < num_nicks; i++) { /* g_debug("Looking at group nick %s", nicks[i]); */ - gchar * groupname = g_strdup_printf("%s " OLD_GROUP_SUFFIX, nicks[i]); + gchar * groupname = g_strdup_printf(group_format, nicks[i]); if (!g_key_file_has_group(priv->keyfile, groupname)) { g_warning("Unable to find group '%s'", groupname); g_free(groupname); |