diff options
-rw-r--r-- | libindicator/indicator-desktop-shortcuts.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/libindicator/indicator-desktop-shortcuts.c b/libindicator/indicator-desktop-shortcuts.c index b46b115..cc56e61 100644 --- a/libindicator/indicator-desktop-shortcuts.c +++ b/libindicator/indicator-desktop-shortcuts.c @@ -241,6 +241,44 @@ parse_keyfile (IndicatorDesktopShortcuts * ids) continue; } + /* 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(priv->keyfile, groupname, G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN, NULL)) { + gint j; + gsize num_only = 0; + gchar ** onlies = g_key_file_get_string_list(priv->keyfile, groupname, G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN, &num_only, NULL); + + for (j = 0; j < num_only; j++) { + if (g_strcmp0(onlies[i], priv->identity) == 0) { + break; + } + } + + if (j == num_only) { + g_free(groupname); + break; + } + } + + /* If there is a NotShowIn entry we need to make sure that we're + not in that list. If we are, we need to drop out. */ + if (g_key_file_has_key(priv->keyfile, groupname, G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN, NULL)) { + gint j; + gsize num_not = 0; + gchar ** nots = g_key_file_get_string_list(priv->keyfile, groupname, G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN, &num_not, NULL); + + for (j = 0; j < num_not; j++) { + if (g_strcmp0(nots[i], priv->identity) == 0) { + break; + } + } + + if (j != num_not) { + g_free(groupname); + break; + } + } + gchar * nickalloc = g_strdup(nicks[i]); g_array_append_val(priv->nicks, nickalloc); } |