diff options
author | Ted Gould <ted@gould.cx> | 2010-02-16 10:41:58 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-02-16 10:41:58 -0600 |
commit | 4ee953a0feaa4be188ef097dcd710647689a1b38 (patch) | |
tree | 917cf17e577dacde4bda9ce2efd71d977387bd5f /libindicator/indicator-desktop-shortcuts.c | |
parent | 21c3a88382bb4a1e911456c633aa4730bbb7cdff (diff) | |
download | libayatana-indicator-4ee953a0feaa4be188ef097dcd710647689a1b38.tar.gz libayatana-indicator-4ee953a0feaa4be188ef097dcd710647689a1b38.tar.bz2 libayatana-indicator-4ee953a0feaa4be188ef097dcd710647689a1b38.zip |
Basic parsing of the files.
Diffstat (limited to 'libindicator/indicator-desktop-shortcuts.c')
-rw-r--r-- | libindicator/indicator-desktop-shortcuts.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/libindicator/indicator-desktop-shortcuts.c b/libindicator/indicator-desktop-shortcuts.c index eeb97be..b46b115 100644 --- a/libindicator/indicator-desktop-shortcuts.c +++ b/libindicator/indicator-desktop-shortcuts.c @@ -216,6 +216,34 @@ get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspe static void parse_keyfile (IndicatorDesktopShortcuts * ids) { + IndicatorDesktopShortcutsPrivate * priv = INDICATOR_DESKTOP_SHORTCUTS_GET_PRIVATE(ids); + + if (priv->keyfile == NULL) { + return; + } + + if (priv->identity == NULL) { + 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, SHORTCUTS_KEY, &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++) { + gchar * groupname = g_strdup_printf("%s" GROUP_SUFFIX, nicks[i]); + if (!g_key_file_has_group(priv->keyfile, groupname)) { + g_warning("Unable to find group '%s'", groupname); + g_free(groupname); + continue; + } + + gchar * nickalloc = g_strdup(nicks[i]); + g_array_append_val(priv->nicks, nickalloc); + } return; } |