diff options
author | Ted Gould <ted@gould.cx> | 2010-02-16 10:53:08 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-02-16 10:53:08 -0600 |
commit | a39d426865186205de6bdd18d7a28748636476fd (patch) | |
tree | 19008273d1724eba43fa7c681d5313fc901f2e07 /libindicator | |
parent | 4ee953a0feaa4be188ef097dcd710647689a1b38 (diff) | |
download | libayatana-indicator-a39d426865186205de6bdd18d7a28748636476fd.tar.gz libayatana-indicator-a39d426865186205de6bdd18d7a28748636476fd.tar.bz2 libayatana-indicator-a39d426865186205de6bdd18d7a28748636476fd.zip |
Adding in checking to see if we should be showing this entry.
Diffstat (limited to 'libindicator')
-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); } |