From 48e218a794786549c9d238addf4fb5b52827adc8 Mon Sep 17 00:00:00 2001 From: Stefano Karapetsas Date: Wed, 12 Feb 2014 12:29:41 +0100 Subject: capplet: Filter list with only the apps that can be launched in MATE --- capplet/gsp-app.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'capplet') 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; -- cgit v1.2.1