From 76189ca50976f5f146ad86914a0c5ba932e77171 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 27 Mar 2017 15:34:51 -0400
Subject: [PATCH 19/19] capplet: fix disable check items

An optimzation that tries to prevent transient desktop files from
accumulating in the user's homedirectory inadvertently broke the
ability for a user to disable startup applications.

This commit restores the broken functionality.
---
 capplet/gsp-app.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/capplet/gsp-app.c b/capplet/gsp-app.c
index 123ab217..1a0580e6 100644
--- a/capplet/gsp-app.c
+++ b/capplet/gsp-app.c
@@ -315,64 +315,65 @@ _gsp_app_user_equal_system (GspApp  *app,
         char          *str = NULL;
         GKeyFile      *keyfile = NULL;
         GDesktopAppInfo *app_info = NULL;
 
         manager = gsp_app_manager_get ();
         system_dir = gsp_app_manager_get_dir (manager,
                                               app->priv->xdg_system_position);
         g_object_unref (manager);
         if (!system_dir) {
                 goto out;
         }
 
         path = g_build_filename (system_dir, app->priv->basename, NULL);
 
         keyfile = g_key_file_new ();
         if (!g_key_file_load_from_file (keyfile, path, G_KEY_FILE_NONE, NULL)) {
                 goto out;
         }
 
         app_info = g_desktop_app_info_new_from_keyfile (keyfile);
 
         if (!app_info) {
                 goto out;
         }
 
         if (g_desktop_app_info_get_is_hidden (app_info)) {
                 goto out;
         }
 
         if (g_desktop_app_info_has_key (app_info,
-                                        GSP_KEY_FILE_DESKTOP_KEY_AUTOSTART_ENABLED) &&
-            !g_desktop_app_info_get_boolean (app_info,
-                                             GSP_KEY_FILE_DESKTOP_KEY_AUTOSTART_ENABLED)) {
-                goto out;
+                                        GSP_KEY_FILE_DESKTOP_KEY_AUTOSTART_ENABLED)) {
+                if (app->priv->enabled != g_desktop_app_info_get_boolean (app_info, GSP_KEY_FILE_DESKTOP_KEY_AUTOSTART_ENABLED))
+                        goto out;
+        } else if (!app->priv->enabled) {
+                        goto out;
         }
 
         if (!g_desktop_app_info_get_show_in (app_info, NULL)) {
                 goto out;
         }
 
         if (g_desktop_app_info_get_nodisplay (app_info)) {
                 goto out;
         }
 
         str = gsp_key_file_get_locale_string (keyfile,
                                               G_KEY_FILE_DESKTOP_KEY_NAME);
         if (!_gsp_str_equal (str, app->priv->name)) {
                 goto out;
         }
         g_clear_pointer (&str, g_free);
 
         str = gsp_key_file_get_locale_string (keyfile,
                                               G_KEY_FILE_DESKTOP_KEY_COMMENT);
         if (!_gsp_str_equal (str, app->priv->comment)) {
                 goto out;
         }
         g_clear_pointer (&str, g_free);
 
         str = gsp_key_file_get_string (keyfile,
                                        G_KEY_FILE_DESKTOP_KEY_EXEC);
         if (!_gsp_str_equal (str, app->priv->exec)) {
                 goto out;
         }
         g_clear_pointer (&str, g_free);
-- 
2.17.0

