From a39d426865186205de6bdd18d7a28748636476fd Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 16 Feb 2010 10:53:08 -0600 Subject: Adding in checking to see if we should be showing this entry. --- libindicator/indicator-desktop-shortcuts.c | 38 ++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) 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); } -- cgit v1.2.3