summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWu Xiaotian <[email protected]>2019-05-03 11:26:50 +0800
committerVictor Kareh <[email protected]>2019-05-09 15:10:37 -0400
commitfb24ae35d358177cfaa1706280b3e0752a2ec97b (patch)
tree63c5349e78dfdd31eece997e06f03854919f8555
parent7b242fb0745aa6c70a7712743cdde1d6c7209afc (diff)
downloadmate-session-manager-fb24ae35d358177cfaa1706280b3e0752a2ec97b.tar.bz2
mate-session-manager-fb24ae35d358177cfaa1706280b3e0752a2ec97b.tar.xz
Hide NoDisplay Apps in Startup Applications
Autostart applications are hidden in Startup Applications when NoDisplay=true. Fix #134.
-rw-r--r--capplet/gsp-app-manager.c2
-rw-r--r--capplet/gsp-app.c18
-rw-r--r--capplet/gsp-app.h1
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);