diff options
author | Ted Gould <ted@gould.cx> | 2012-02-27 14:25:21 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2012-02-27 14:25:21 -0600 |
commit | 4baf9b7067554450de88e40d3336d9739ca79de5 (patch) | |
tree | 2fc9a7a8e7405fa187113e55004aea29804d22b2 | |
parent | f7e5502a2a136bedfb6a72fb081883568a1ead3c (diff) | |
download | libayatana-indicator-4baf9b7067554450de88e40d3336d9739ca79de5.tar.gz libayatana-indicator-4baf9b7067554450de88e40d3336d9739ca79de5.tar.bz2 libayatana-indicator-4baf9b7067554450de88e40d3336d9739ca79de5.zip |
Figure out what kind of actions we have
-rw-r--r-- | libindicator/indicator-desktop-shortcuts.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/libindicator/indicator-desktop-shortcuts.c b/libindicator/indicator-desktop-shortcuts.c index bb25979..d58c81d 100644 --- a/libindicator/indicator-desktop-shortcuts.c +++ b/libindicator/indicator-desktop-shortcuts.c @@ -174,6 +174,12 @@ set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec switch(prop_id) { case PROP_DESKTOP_FILE: { + if (priv->keyfile != NULL) { + g_key_file_free(priv->keyfile); + priv->keyfile = NULL; + priv->actions = ACTIONS_NONE; + } + GError * error = NULL; GKeyFile * keyfile = g_key_file_new(); g_key_file_load_from_file(keyfile, g_value_get_string(value), G_KEY_FILE_NONE, &error); @@ -185,7 +191,17 @@ set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec break; } - if (!g_key_file_has_key(keyfile, G_KEY_FILE_DESKTOP_GROUP, OLD_SHORTCUTS_KEY, NULL)) { + /* Always prefer the desktop spec if we can get it */ + if (priv->actions == ACTIONS_NONE && g_key_file_has_key(keyfile, G_KEY_FILE_DESKTOP_GROUP, ACTIONS_KEY, NULL)) { + priv->actions = ACTIONS_DESKTOP_SPEC; + } + + /* But fallback if we can't */ + if (priv->actions == ACTIONS_NONE && g_key_file_has_key(keyfile, G_KEY_FILE_DESKTOP_GROUP, OLD_SHORTCUTS_KEY, NULL)) { + priv->actions = ACTIONS_XAYATANA; + } + + if (priv->actions == ACTIONS_NONE) { g_key_file_free(keyfile); break; } |