summaryrefslogtreecommitdiff
path: root/capplet
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2014-02-12 12:29:41 +0100
committerStefano Karapetsas <[email protected]>2014-02-12 12:29:41 +0100
commit48e218a794786549c9d238addf4fb5b52827adc8 (patch)
tree44205372d884cd3439154c33d3eb8b2fb1c6bd8e /capplet
parente895de34218535f81b0bf2452578163eeece4663 (diff)
downloadmate-session-manager-48e218a794786549c9d238addf4fb5b52827adc8.tar.bz2
mate-session-manager-48e218a794786549c9d238addf4fb5b52827adc8.tar.xz
capplet: Filter list with only the apps that can be launched in MATE
Diffstat (limited to 'capplet')
-rw-r--r--capplet/gsp-app.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/capplet/gsp-app.c b/capplet/gsp-app.c
index f61bc62..ab631aa 100644
--- a/capplet/gsp-app.c
+++ b/capplet/gsp-app.c
@@ -729,6 +729,42 @@ gsp_app_reload_at (GspApp *app,
gsp_app_new (path, xdg_position);
}
+gboolean
+gsp_app_can_launch (GKeyFile *keyfile)
+{
+ char **only_show_in, **not_show_in;
+ gboolean found;
+ int i;
+
+ only_show_in = g_key_file_get_string_list (keyfile,
+ G_KEY_FILE_DESKTOP_GROUP,
+ G_KEY_FILE_DESKTOP_KEY_ONLY_SHOW_IN,
+ NULL, NULL);
+ if (only_show_in) {
+ for (i = 0, found = FALSE; only_show_in[i] && !found; i++) {
+ if (!strcmp (only_show_in[i], "MATE"))
+ found = TRUE;
+ }
+ g_strfreev (only_show_in);
+ if (!found)
+ return FALSE;
+ }
+ not_show_in = g_key_file_get_string_list (keyfile,
+ G_KEY_FILE_DESKTOP_GROUP,
+ G_KEY_FILE_DESKTOP_KEY_NOT_SHOW_IN,
+ NULL, NULL);
+ if (not_show_in) {
+ for (i = 0, found = FALSE; not_show_in[i] && !found; i++) {
+ if (!strcmp (not_show_in[i], "MATE"))
+ found = TRUE;
+ }
+ g_strfreev (not_show_in);
+ if (found)
+ return FALSE;
+ }
+ return TRUE;
+}
+
GspApp *
gsp_app_new (const char *path,
unsigned int xdg_position)
@@ -777,6 +813,12 @@ gsp_app_new (const char *path,
return NULL;
}
+ if (!gsp_app_can_launch (keyfile)) {
+ g_key_file_free (keyfile);
+ g_free (basename);
+ return NULL;
+ }
+
if (new) {
app = g_object_new (GSP_TYPE_APP, NULL);
app->priv->basename = basename;