summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Terry <michael.terry@canonical.com>2013-05-29 10:31:30 -0400
committerRay Strode <rstrode@redhat.com>2013-07-30 15:08:17 -0400
commitda4bb27fe208d453800c221c99bd40a0c70e5b15 (patch)
tree96b142ca5f3261ffb780d579dfe864712b2fee0d
parentfff1d5fcb18be772ab899949ccff715726d6726c (diff)
downloadgnome-session-da4bb27fe208d453800c221c99bd40a0c70e5b15.tar.gz
capplet: Don't show desktop files with NoDisplay=true
https://bugzilla.gnome.org/show_bug.cgi?id=556459
-rw-r--r--capplet/gsm-properties-dialog.c4
-rw-r--r--capplet/gsp-app.c46
-rw-r--r--capplet/gsp-app.h1
3 files changed, 44 insertions, 7 deletions
diff --git a/capplet/gsm-properties-dialog.c b/capplet/gsm-properties-dialog.c
index 712b861c..24bf9071 100644
--- a/capplet/gsm-properties-dialog.c
+++ b/capplet/gsm-properties-dialog.c
@@ -112,6 +112,7 @@ _fill_iter_from_app (GtkListStore *list_store,
GspApp *app)
{
gboolean hidden;
+ gboolean display;
gboolean enabled;
gboolean shown;
GIcon *icon;
@@ -119,6 +120,7 @@ _fill_iter_from_app (GtkListStore *list_store,
const char *app_name;
hidden = gsp_app_get_hidden (app);
+ display = gsp_app_get_display (app);
enabled = gsp_app_get_enabled (app);
shown = gsp_app_get_shown (app);
icon = gsp_app_get_icon (app);
@@ -151,7 +153,7 @@ _fill_iter_from_app (GtkListStore *list_store,
}
gtk_list_store_set (list_store, iter,
- STORE_COL_VISIBLE, !hidden && shown,
+ STORE_COL_VISIBLE, !hidden && shown && display,
STORE_COL_ENABLED, enabled,
STORE_COL_GICON, icon,
STORE_COL_DESCRIPTION, description,
diff --git a/capplet/gsp-app.c b/capplet/gsp-app.c
index eeda4662..c92b8dad 100644
--- a/capplet/gsp-app.c
+++ b/capplet/gsp-app.c
@@ -41,18 +41,20 @@
#define GSP_APP_SAVE_DELAY 2
-#define GSP_ASP_SAVE_MASK_HIDDEN 0x0001
-#define GSP_ASP_SAVE_MASK_ENABLED 0x0002
-#define GSP_ASP_SAVE_MASK_NAME 0x0004
-#define GSP_ASP_SAVE_MASK_EXEC 0x0008
-#define GSP_ASP_SAVE_MASK_COMMENT 0x0010
-#define GSP_ASP_SAVE_MASK_ALL 0xffff
+#define GSP_ASP_SAVE_MASK_HIDDEN 0x0001
+#define GSP_ASP_SAVE_MASK_ENABLED 0x0002
+#define GSP_ASP_SAVE_MASK_NAME 0x0004
+#define GSP_ASP_SAVE_MASK_EXEC 0x0008
+#define GSP_ASP_SAVE_MASK_COMMENT 0x0010
+#define GSP_ASP_SAVE_MASK_NO_DISPLAY 0x0020
+#define GSP_ASP_SAVE_MASK_ALL 0xffff
struct _GspAppPrivate {
char *basename;
char *path;
gboolean hidden;
+ gboolean no_display;
gboolean enabled;
gboolean shown;
@@ -341,6 +343,14 @@ _gsp_app_user_equal_system (GspApp *app,
return FALSE;
}
+ if (gsp_key_file_get_boolean (keyfile,
+ G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY,
+ FALSE) != app->priv->no_display) {
+ g_free (path);
+ g_key_file_free (keyfile);
+ return FALSE;
+ }
+
str = gsp_key_file_get_locale_string (keyfile,
G_KEY_FILE_DESKTOP_KEY_NAME);
if (!_gsp_str_equal (str, app->priv->name)) {
@@ -449,6 +459,12 @@ _gsp_app_save (gpointer data)
app->priv->hidden);
}
+ if (app->priv->save_mask & GSP_ASP_SAVE_MASK_NO_DISPLAY) {
+ gsp_key_file_set_boolean (keyfile,
+ G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY,
+ app->priv->no_display);
+ }
+
if (app->priv->save_mask & GSP_ASP_SAVE_MASK_ENABLED) {
gsp_key_file_set_boolean (keyfile,
GSP_KEY_FILE_DESKTOP_KEY_AUTOSTART_ENABLED,
@@ -548,6 +564,14 @@ gsp_app_get_hidden (GspApp *app)
}
gboolean
+gsp_app_get_display (GspApp *app)
+{
+ g_return_val_if_fail (GSP_IS_APP (app), FALSE);
+
+ return !app->priv->no_display;
+}
+
+gboolean
gsp_app_get_enabled (GspApp *app)
{
g_return_val_if_fail (GSP_IS_APP (app), FALSE);
@@ -805,6 +829,9 @@ gsp_app_new (const char *path,
app->priv->hidden = gsp_key_file_get_boolean (keyfile,
G_KEY_FILE_DESKTOP_KEY_HIDDEN,
FALSE);
+ app->priv->no_display = gsp_key_file_get_boolean (keyfile,
+ G_KEY_FILE_DESKTOP_KEY_NO_DISPLAY,
+ FALSE);
app->priv->enabled = gsp_key_file_get_boolean (keyfile,
GSP_KEY_FILE_DESKTOP_KEY_AUTOSTART_ENABLED,
TRUE);
@@ -952,6 +979,7 @@ gsp_app_create (const char *name,
app->priv->basename, NULL);
app->priv->hidden = FALSE;
+ app->priv->no_display = FALSE;
app->priv->enabled = TRUE;
app->priv->shown = TRUE;
@@ -1049,6 +1077,12 @@ gsp_app_copy_desktop_file (const char *uri)
app->priv->save_mask |= GSP_ASP_SAVE_MASK_HIDDEN;
}
+ if (app->priv->no_display) {
+ changed = TRUE;
+ app->priv->no_display = FALSE;
+ app->priv->save_mask |= GSP_ASP_SAVE_MASK_NO_DISPLAY;
+ }
+
if (!app->priv->enabled) {
changed = TRUE;
app->priv->enabled = TRUE;
diff --git a/capplet/gsp-app.h b/capplet/gsp-app.h
index 6a2e3be8..a1997955 100644
--- a/capplet/gsp-app.h
+++ b/capplet/gsp-app.h
@@ -74,6 +74,7 @@ const char *gsp_app_get_basename (GspApp *app);
const char *gsp_app_get_path (GspApp *app);
gboolean gsp_app_get_hidden (GspApp *app);
+gboolean gsp_app_get_display (GspApp *app);
gboolean gsp_app_get_enabled (GspApp *app);
void gsp_app_set_enabled (GspApp *app,