summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2021-04-22 14:43:13 +0200
committerraveit65 <[email protected]>2021-04-22 18:30:15 +0200
commitadd9dd5ba8b984ba7371383cb9d527ebd5980e0e (patch)
tree86fae7aa521e0590f96351e3fa89f26ac13321b1
parent5fd6ec91cce37c0c76051437dc29aee73cd6bb8e (diff)
downloadmate-session-manager-1.24.tar.bz2
mate-session-manager-1.24.tar.xz
Follow freedesktop guidelines to disable autorun using Hidden key1.24
-rw-r--r--capplet/gsm-properties-dialog.c9
-rw-r--r--capplet/gsp-app.c53
-rw-r--r--capplet/gsp-app.h5
-rw-r--r--capplet/gsp-keyfile.h1
-rw-r--r--mate-session/gsm-autostart-app.c10
-rw-r--r--mate-session/gsm-autostart-app.h1
6 files changed, 15 insertions, 64 deletions
diff --git a/capplet/gsm-properties-dialog.c b/capplet/gsm-properties-dialog.c
index 434dcf0..cb314c5 100644
--- a/capplet/gsm-properties-dialog.c
+++ b/capplet/gsm-properties-dialog.c
@@ -118,7 +118,7 @@ _fill_iter_from_app (GtkListStore *list_store,
const char *description;
const char *app_name;
- enabled = gsp_app_get_enabled (app);
+ enabled = !gsp_app_get_hidden (app);
icon = gsp_app_get_icon (app);
description = gsp_app_get_description (app);
app_name = gsp_app_get_name (app);
@@ -270,10 +270,9 @@ on_startup_enabled_toggled (GtkCellRendererToggle *cell_renderer,
-1);
active = gtk_cell_renderer_toggle_get_active (cell_renderer);
- active = !active;
if (app) {
- gsp_app_set_enabled (app, active);
+ gsp_app_set_hidden (app, active);
g_object_unref (app);
}
}
@@ -500,12 +499,10 @@ visible_func (GtkTreeModel *model,
-1);
if (app) {
- gboolean hidden;
gboolean nodisplay;
- hidden = gsp_app_get_hidden (app);
nodisplay = gsp_app_get_nodisplay (app);
- visible = !hidden && (show_hidden || !nodisplay);
+ visible = show_hidden || !nodisplay;
g_object_unref (app);
} else {
visible = show_hidden;
diff --git a/capplet/gsp-app.c b/capplet/gsp-app.c
index 169701f..0c310b0 100644
--- a/capplet/gsp-app.c
+++ b/capplet/gsp-app.c
@@ -42,11 +42,10 @@
#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_DELAY 0x0020
+#define GSP_ASP_SAVE_MASK_NAME 0x0002
+#define GSP_ASP_SAVE_MASK_EXEC 0x0004
+#define GSP_ASP_SAVE_MASK_COMMENT 0x0008
+#define GSP_ASP_SAVE_MASK_DELAY 0x0010
#define GSP_ASP_SAVE_MASK_ALL 0xffff
typedef struct {
@@ -55,7 +54,6 @@ typedef struct {
gboolean hidden;
gboolean nodisplay;
- gboolean enabled;
char *name;
char *exec;
@@ -343,10 +341,7 @@ _gsp_app_user_equal_system (GspApp *app,
if (gsp_key_file_get_boolean (keyfile,
G_KEY_FILE_DESKTOP_KEY_HIDDEN,
- FALSE) != priv->hidden ||
- gsp_key_file_get_boolean (keyfile,
- GSP_KEY_FILE_DESKTOP_KEY_AUTOSTART_ENABLED,
- TRUE) != priv->enabled) {
+ FALSE) != priv->hidden) {
g_free (path);
g_key_file_free (keyfile);
return FALSE;
@@ -472,12 +467,6 @@ _gsp_app_save (gpointer data)
priv->hidden);
}
- if (priv->save_mask & GSP_ASP_SAVE_MASK_ENABLED) {
- gsp_key_file_set_boolean (keyfile,
- GSP_KEY_FILE_DESKTOP_KEY_AUTOSTART_ENABLED,
- priv->enabled);
- }
-
if (priv->save_mask & GSP_ASP_SAVE_MASK_NAME) {
gsp_key_file_set_locale_string (keyfile,
G_KEY_FILE_DESKTOP_KEY_NAME,
@@ -589,21 +578,9 @@ gsp_app_get_hidden (GspApp *app)
return priv->hidden;
}
-gboolean
-gsp_app_get_enabled (GspApp *app)
-{
- GspAppPrivate *priv;
-
- g_return_val_if_fail (GSP_IS_APP (app), FALSE);
-
- priv = gsp_app_get_instance_private (app);
-
- return priv->enabled;
-}
-
void
-gsp_app_set_enabled (GspApp *app,
- gboolean enabled)
+gsp_app_set_hidden (GspApp *app,
+ gboolean hidden)
{
GspAppPrivate *priv;
@@ -611,12 +588,12 @@ gsp_app_set_enabled (GspApp *app,
priv = gsp_app_get_instance_private (app);
- if (enabled == priv->enabled) {
+ if (hidden == priv->hidden) {
return;
}
- priv->enabled = enabled;
- priv->save_mask |= GSP_ASP_SAVE_MASK_ENABLED;
+ priv->hidden = hidden;
+ priv->save_mask |= GSP_ASP_SAVE_MASK_HIDDEN;
_gsp_app_queue_save (app);
_gsp_app_emit_changed (app);
@@ -963,9 +940,6 @@ gsp_app_new (const char *path,
priv->hidden = gsp_key_file_get_boolean (keyfile,
G_KEY_FILE_DESKTOP_KEY_HIDDEN,
FALSE);
- 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);
@@ -1114,7 +1088,6 @@ gsp_app_create (const char *name,
priv->basename, NULL);
priv->hidden = FALSE;
- priv->enabled = TRUE;
priv->nodisplay = FALSE;
if (!gsm_util_text_is_blank (name)) {
@@ -1214,12 +1187,6 @@ gsp_app_copy_desktop_file (const char *uri)
priv->save_mask |= GSP_ASP_SAVE_MASK_HIDDEN;
}
- if (!priv->enabled) {
- changed = TRUE;
- priv->enabled = TRUE;
- priv->save_mask |= GSP_ASP_SAVE_MASK_ENABLED;
- }
-
if (changed) {
_gsp_app_queue_save (app);
}
diff --git a/capplet/gsp-app.h b/capplet/gsp-app.h
index 8bc2700..f327d72 100644
--- a/capplet/gsp-app.h
+++ b/capplet/gsp-app.h
@@ -58,10 +58,9 @@ const char *gsp_app_get_basename (GspApp *app);
const char *gsp_app_get_path (GspApp *app);
gboolean gsp_app_get_hidden (GspApp *app);
+void gsp_app_set_hidden (GspApp *app,
+ gboolean hidden);
-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);
diff --git a/capplet/gsp-keyfile.h b/capplet/gsp-keyfile.h
index 97f135f..aecd2ef 100644
--- a/capplet/gsp-keyfile.h
+++ b/capplet/gsp-keyfile.h
@@ -33,7 +33,6 @@
extern "C" {
#endif
-#define GSP_KEY_FILE_DESKTOP_KEY_AUTOSTART_ENABLED "X-MATE-Autostart-enabled"
#define GSP_KEY_FILE_DESKTOP_KEY_DELAY "X-MATE-Autostart-Delay"
void gsp_key_file_populate (GKeyFile *keyfile);
diff --git a/mate-session/gsm-autostart-app.c b/mate-session/gsm-autostart-app.c
index 8c90759..deaa05d 100644
--- a/mate-session/gsm-autostart-app.c
+++ b/mate-session/gsm-autostart-app.c
@@ -114,16 +114,6 @@ is_disabled (GsmApp *app)
priv = gsm_autostart_app_get_instance_private (GSM_AUTOSTART_APP(app));
- /* GSM_AUTOSTART_APP_ENABLED_KEY key, used by old mate-session */
- if (egg_desktop_file_has_key (priv->desktop_file,
- GSM_AUTOSTART_APP_ENABLED_KEY, NULL) &&
- !egg_desktop_file_get_boolean (priv->desktop_file,
- GSM_AUTOSTART_APP_ENABLED_KEY, NULL)) {
- g_debug ("app %s is disabled by " GSM_AUTOSTART_APP_ENABLED_KEY,
- gsm_app_peek_id (app));
- return TRUE;
- }
-
/* Hidden key, used by autostart spec */
if (egg_desktop_file_get_boolean (priv->desktop_file,
EGG_DESKTOP_FILE_KEY_HIDDEN, NULL)) {
diff --git a/mate-session/gsm-autostart-app.h b/mate-session/gsm-autostart-app.h
index 48b2c48..08237c4 100644
--- a/mate-session/gsm-autostart-app.h
+++ b/mate-session/gsm-autostart-app.h
@@ -42,7 +42,6 @@ struct _GsmAutostartAppClass
GsmApp *gsm_autostart_app_new (const char *desktop_file);
-#define GSM_AUTOSTART_APP_ENABLED_KEY "X-MATE-Autostart-enabled"
#define GSM_AUTOSTART_APP_PHASE_KEY "X-MATE-Autostart-Phase"
#define GSM_AUTOSTART_APP_PROVIDES_KEY "X-MATE-Provides"
#define GSM_AUTOSTART_APP_STARTUP_ID_KEY "X-MATE-Autostart-startup-id"