From e8499e2e738a5227ddfc11a4b04b55543716d559 Mon Sep 17 00:00:00 2001 From: Wu Xiaotian Date: Fri, 3 May 2019 11:26:50 +0800 Subject: Hide NoDisplay Apps in Startup Applications Autostart applications are hidden in Startup Applications when NoDisplay=true. Fix #134. --- capplet/gsp-app-manager.c | 2 +- capplet/gsp-app.c | 18 +++++++++++++++++- capplet/gsp-app.h | 1 + 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/capplet/gsp-app-manager.c b/capplet/gsp-app-manager.c index 7e245db..4072036 100644 --- a/capplet/gsp-app-manager.c +++ b/capplet/gsp-app-manager.c @@ -479,7 +479,7 @@ _gsp_app_manager_fill_from_dir (GspAppManager *manager, desktop_file_path = g_build_filename (xdgdir->dir, name, NULL); app = gsp_app_new (desktop_file_path, xdgdir->index); - if (app != NULL) { + if (app != NULL && !gsp_app_get_nodisplay(app)) { gsp_app_manager_add (manager, app); g_object_unref (app); } diff --git a/capplet/gsp-app.c b/capplet/gsp-app.c index 1e970e6..169701f 100644 --- a/capplet/gsp-app.c +++ b/capplet/gsp-app.c @@ -54,6 +54,7 @@ typedef struct { char *path; gboolean hidden; + gboolean nodisplay; gboolean enabled; char *name; @@ -621,6 +622,18 @@ gsp_app_set_enabled (GspApp *app, _gsp_app_emit_changed (app); } +gboolean +gsp_app_get_nodisplay (GspApp *app) +{ + GspAppPrivate *priv; + + g_return_val_if_fail (GSP_IS_APP (app), FALSE); + + priv = gsp_app_get_instance_private (app); + + return priv->nodisplay; +} + const char * gsp_app_get_name (GspApp *app) { @@ -953,7 +966,9 @@ gsp_app_new (const char *path, priv->enabled = gsp_key_file_get_boolean (keyfile, GSP_KEY_FILE_DESKTOP_KEY_AUTOSTART_ENABLED, TRUE); - + priv->nodisplay = gsp_key_file_get_boolean (keyfile, + G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY, + FALSE); priv->name = gsp_key_file_get_locale_string (keyfile, G_KEY_FILE_DESKTOP_KEY_NAME); priv->exec = gsp_key_file_get_string (keyfile, @@ -1100,6 +1115,7 @@ gsp_app_create (const char *name, priv->hidden = FALSE; priv->enabled = TRUE; + priv->nodisplay = FALSE; if (!gsm_util_text_is_blank (name)) { priv->name = g_strdup (name); diff --git a/capplet/gsp-app.h b/capplet/gsp-app.h index e4ee457..6b0d640 100644 --- a/capplet/gsp-app.h +++ b/capplet/gsp-app.h @@ -64,6 +64,7 @@ gboolean gsp_app_get_hidden (GspApp *app); gboolean gsp_app_get_enabled (GspApp *app); void gsp_app_set_enabled (GspApp *app, gboolean enabled); +gboolean gsp_app_get_nodisplay (GspApp *app); const char *gsp_app_get_name (GspApp *app); const char *gsp_app_get_exec (GspApp *app); -- cgit v1.2.1