diff -up gnome-session-2.16.0/gnome-session/headers.h.dont-ignore-hidden gnome-session-2.16.0/gnome-session/headers.h --- gnome-session-2.16.0/gnome-session/headers.h.dont-ignore-hidden 2012-08-26 22:46:05.137218243 -0400 +++ gnome-session-2.16.0/gnome-session/headers.h 2012-08-26 22:46:07.738244717 -0400 @@ -143,6 +143,7 @@ typedef struct /* If the client has been loaded from, or saved to, disk */ gboolean session_saved; + gboolean ignore; /* Purge timeout ID; see start_client() */ guint purge_timeout_id; diff -up gnome-session-2.16.0/gnome-session/save.c.dont-ignore-hidden gnome-session-2.16.0/gnome-session/save.c --- gnome-session-2.16.0/gnome-session/save.c.dont-ignore-hidden 2012-08-26 22:01:48.492711052 -0400 +++ gnome-session-2.16.0/gnome-session/save.c 2012-08-26 22:37:20.993490305 -0400 @@ -375,6 +375,7 @@ read_desktop_entries_in_dir (GHashTable SmProp *prop; gchar *desktop_file; GnomeDesktopItem *ditem; + gboolean ignore = FALSE; if (!g_str_has_suffix (name, ".desktop")) continue; @@ -390,15 +391,27 @@ read_desktop_entries_in_dir (GHashTable exec_string = gnome_desktop_item_get_string (ditem, GNOME_DESKTOP_ITEM_EXEC); /* First filter out entries without Exec keys and hidden entries */ if ((exec_string == NULL) || - !g_shell_parse_argv (exec_string, &argc, &argv, NULL) || - (gnome_desktop_item_attr_exists (ditem, GNOME_DESKTOP_ITEM_HIDDEN) && - gnome_desktop_item_get_boolean (ditem, GNOME_DESKTOP_ITEM_HIDDEN))) + !g_shell_parse_argv (exec_string, &argc, &argv, NULL)) { gnome_desktop_item_unref (ditem); g_free (desktop_file); continue; } + if (gnome_desktop_item_attr_exists (ditem, GNOME_DESKTOP_ITEM_HIDDEN) && + gnome_desktop_item_get_boolean (ditem, GNOME_DESKTOP_ITEM_HIDDEN)) + { + ignore = TRUE; + goto add_client; + } + + if (gnome_desktop_item_attr_exists (ditem, "X-GNOME-Autostart-enabled") && + !gnome_desktop_item_get_boolean (ditem, "X-GNOME-Autostart-enabled")) + { + ignore = TRUE; + goto add_client; + } + /* The filter out entries that are not for GNOME */ if (gnome_desktop_item_attr_exists (ditem, GNOME_DESKTOP_ITEM_ONLY_SHOW_IN)) { @@ -417,11 +430,9 @@ read_desktop_entries_in_dir (GHashTable if (only_show_in_list[i] == NULL) { - gnome_desktop_item_unref (ditem); - g_free (desktop_file); - g_strfreev (argv); g_strfreev (only_show_in_list); - continue; + ignore = TRUE; + goto add_client; } g_strfreev (only_show_in_list); } @@ -441,11 +452,8 @@ read_desktop_entries_in_dir (GHashTable if (not_show_in_list[i] != NULL) { - gnome_desktop_item_unref (ditem); - g_free (desktop_file); - g_strfreev (argv); - g_strfreev (not_show_in_list); - continue; + ignore = TRUE; + goto add_client; } g_strfreev (not_show_in_list); } @@ -463,14 +471,13 @@ read_desktop_entries_in_dir (GHashTable program_path = g_find_program_in_path (program); if (!program_path) { - gnome_desktop_item_unref (ditem); - g_free (desktop_file); - g_strfreev (argv); - continue; + ignore = TRUE; + goto add_client; } g_free (program_path); } +add_client: client = g_new0 (Client, 1); client->magic = CLIENT_MAGIC; client->id = NULL; @@ -482,6 +489,7 @@ read_desktop_entries_in_dir (GHashTable client->get_prop_requests = 0; client->command_data = NULL; client->match_rule = MATCH_PROP; + client->ignore = ignore; prop = (SmProp *) g_new (SmProp, 1); prop->name = g_strdup (SmRestartCommand); @@ -504,16 +512,7 @@ read_desktop_entries_in_dir (GHashTable free_client (hash_client); } - /* check the X-GNOME-Autostart-enabled field */ - if (gnome_desktop_item_attr_exists (ditem, "X-GNOME-Autostart-enabled")) - { - if (gnome_desktop_item_get_boolean (ditem, "X-GNOME-Autostart-enabled")) - g_hash_table_insert (clients, g_strdup (name), client); - else - free_client (client); - } - else - g_hash_table_insert (clients, g_strdup (name), client); + g_hash_table_insert (clients, g_strdup (name), client); g_strfreev (argv); gnome_desktop_item_unref (ditem); @@ -529,8 +528,13 @@ static gboolean hash_table_remove_cb (gpointer key, gpointer value, gpointer user_data) { GSList **list = (GSList **) user_data; + Client *client = (Client *) value; + + if (!client->ignore) + *list = g_slist_prepend (*list, value); + else + free_client (client); - *list = g_slist_prepend (*list, value); g_free (key); return TRUE; @@ -550,7 +554,9 @@ read_autostart_dirs (void) /* read directories */ system_dirs = g_get_system_data_dirs (); - for (i = 0; system_dirs[i] != NULL; i++) + + if (system_dirs ! = NULL) + for (i = g_strv_length (system_dirs); i >= 0; i--) { path = g_build_filename (system_dirs[i], "gnome", "autostart", NULL); read_desktop_entries_in_dir (clients, path); @@ -559,7 +565,8 @@ read_autostart_dirs (void) /* support old place (/etc/xdg/autostart) */ system_dirs = g_get_system_config_dirs (); - for (i = 0; system_dirs[i] != NULL; i++) + if (system_dirs ! = NULL) + for (i = g_strv_length (system_dirs); i >= 0; i--) { path = g_build_filename (system_dirs[i], "autostart", NULL); read_desktop_entries_in_dir (clients, path); diff -up gnome-session-2.16.0/gnome-session/startup-programs.c.dont-ignore-hidden gnome-session-2.16.0/gnome-session/startup-programs.c --- gnome-session-2.16.0/gnome-session/startup-programs.c.dont-ignore-hidden 2012-07-05 15:52:27.897841577 -0400 +++ gnome-session-2.16.0/gnome-session/startup-programs.c 2012-08-26 22:37:20.216478903 -0400 @@ -37,6 +37,7 @@ struct _ManualClient char *desktop_file; gboolean to_remove; gboolean enabled; + gboolean ignore; char *command; }; @@ -65,6 +66,7 @@ search_desktop_entries_in_dir (GHashTabl char *desktop_file, *hash_key; GnomeDesktopItem *ditem; ManualClient *hash_client; + gboolean ignore = FALSE; if (!g_str_has_suffix (file, ".desktop")) continue; @@ -78,16 +80,20 @@ search_desktop_entries_in_dir (GHashTabl exec_string = gnome_desktop_item_get_string (ditem, GNOME_DESKTOP_ITEM_EXEC); /* First filter out entries without Exec keys and hidden entries */ - if ((exec_string == NULL) || - (exec_string[0] == 0) || - (gnome_desktop_item_attr_exists (ditem, GNOME_DESKTOP_ITEM_HIDDEN) && - gnome_desktop_item_get_boolean (ditem, GNOME_DESKTOP_ITEM_HIDDEN))) + if ((exec_string == NULL) || (exec_string[0] == 0)) { gnome_desktop_item_unref (ditem); g_free (desktop_file); continue; } + if (gnome_desktop_item_attr_exists (ditem, GNOME_DESKTOP_ITEM_HIDDEN) && + gnome_desktop_item_get_boolean (ditem, GNOME_DESKTOP_ITEM_HIDDEN)) + { + ignore = TRUE; + goto add_client; + } + /* The filter out entries that are not for GNOME */ if (gnome_desktop_item_attr_exists (ditem, GNOME_DESKTOP_ITEM_ONLY_SHOW_IN)) { @@ -106,10 +112,9 @@ search_desktop_entries_in_dir (GHashTabl if (only_show_in_list[i] == NULL) { - gnome_desktop_item_unref (ditem); - g_free (desktop_file); g_strfreev (only_show_in_list); - continue; + ignore = TRUE; + goto add_client; } g_strfreev (only_show_in_list); } @@ -129,10 +134,9 @@ search_desktop_entries_in_dir (GHashTabl if (not_show_in_list[i] != NULL) { - gnome_desktop_item_unref (ditem); - g_free (desktop_file); + ignore = TRUE; g_strfreev (not_show_in_list); - continue; + goto add_client; } g_strfreev (not_show_in_list); } @@ -150,17 +154,18 @@ search_desktop_entries_in_dir (GHashTabl program_path = g_find_program_in_path (program); if (!program_path) { - gnome_desktop_item_unref (ditem); - g_free (desktop_file); - continue; + ignore = TRUE; + goto add_client; } g_free (program_path); } +add_client: current = g_new0 (ManualClient, 1); current->desktop_file = desktop_file; current->command = g_strdup (exec_string); current->to_remove = FALSE; + current->ignore = ignore; if (gnome_desktop_item_attr_exists (ditem, "X-GNOME-Autostart-enabled")) current->enabled = gnome_desktop_item_get_boolean (ditem, "X-GNOME-Autostart-enabled"); else @@ -187,8 +192,12 @@ static gboolean hash_table_remove_cb (gpointer key, gpointer value, gpointer user_data) { GSList **result = (GSList **) user_data; + ManualClient *client = (ManualClient *) value; - *result = g_slist_prepend (*result, value); + if (!client->ignore) + *result = g_slist_prepend (*result, value); + else + client_free (client); g_free (key); return TRUE; @@ -209,7 +218,8 @@ startup_list_read (gchar *name) /* read directories */ system_dirs = g_get_system_data_dirs (); - for (i = 0; system_dirs[i] != NULL; i++) + if (system_dirs != NULL) + for (i = g_strv_length (system_dirs); i >= 0; i--) { path = g_build_filename (system_dirs[i], "gnome", "autostart", NULL); search_desktop_entries_in_dir (clients, path); @@ -218,7 +228,8 @@ startup_list_read (gchar *name) /* support old place (/etc/xdg/autostart) */ system_dirs = g_get_system_config_dirs (); - for (i = 0; system_dirs[i] != NULL; i++) + if (system_dirs != NULL) + for (i = g_strv_length (system_dirs); i >= 0; i--) { path = g_build_filename (system_dirs[i], "autostart", NULL); search_desktop_entries_in_dir (clients, path);