aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-03-02 13:55:16 -0600
committerTed Gould <ted@gould.cx>2011-03-02 13:55:16 -0600
commit9b34e7c064a685f377634e35310dd40663f60455 (patch)
tree1802c78ffd26b4fee7ceab2a04f6aed7a7118c98
parent27d079891cdcc65bc1e7174a2d8dfe6bb2f639df (diff)
downloadlibayatana-indicator-9b34e7c064a685f377634e35310dd40663f60455.tar.gz
libayatana-indicator-9b34e7c064a685f377634e35310dd40663f60455.tar.bz2
libayatana-indicator-9b34e7c064a685f377634e35310dd40663f60455.zip
Adding a target environment key and checking for that over others.
-rw-r--r--libindicator/indicator-desktop-shortcuts.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/libindicator/indicator-desktop-shortcuts.c b/libindicator/indicator-desktop-shortcuts.c
index b04b482..7a92f48 100644
--- a/libindicator/indicator-desktop-shortcuts.c
+++ b/libindicator/indicator-desktop-shortcuts.c
@@ -30,6 +30,7 @@ License along with this library. If not, see
#define GROUP_SUFFIX "Shortcut Group"
#define SHORTCUTS_KEY "X-Ayatana-Desktop-Shortcuts"
+#define ENVIRON_KEY "TargetEnvironment"
#define PROP_DESKTOP_FILE_S "desktop-file"
#define PROP_IDENTITY_S "identity"
@@ -295,6 +296,31 @@ parse_keyfile (IndicatorDesktopShortcuts * ids)
static gboolean
should_show (GKeyFile * keyfile, const gchar * group, const gchar * identity)
{
+ if (g_key_file_has_key(keyfile, group, ENVIRON_KEY, NULL)) {
+ /* If we've got this key, we're going to return here and not
+ process the deprecated keys. */
+ gint j;
+ gsize num_env = 0;
+ gchar ** envs = g_key_file_get_string_list(keyfile, group, ENVIRON_KEY, &num_env, NULL);
+
+ for (j = 0; j < num_env; j++) {
+ if (g_strcmp0(envs[j], identity) == 0) {
+ break;
+ }
+ }
+
+ if (envs != NULL) {
+ g_strfreev(envs);
+ }
+
+ if (j == num_env) {
+ return FALSE;
+ }
+ return TRUE;
+ } else {
+ g_warning(GROUP_SUFFIX " does not have key '" ENVIRON_KEY "' falling back to deprecated use of '" G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN "' and '" G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN "'.");
+ }
+
/* If there is a list of OnlyShowIn entries we need to check
to see if we're in that list. If not, we drop this nick */
if (g_key_file_has_key(keyfile, group, G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN, NULL)) {