[nautilus] Convert show-hidden-files to gsettings and merge it with show-backup-files



commit 9318df841a5a0ccd0723e2d5dbce8d2ddfd89b1d
Author: Alexander Larsson <alexl redhat com>
Date:   Wed Jul 21 22:34:25 2010 +0200

    Convert show-hidden-files to gsettings and merge it with show-backup-files

 .../nautilus-desktop-directory-file.c              |    2 +-
 libnautilus-private/nautilus-desktop-directory.c   |    5 +--
 libnautilus-private/nautilus-desktop-icon-file.c   |    2 +-
 libnautilus-private/nautilus-directory-async.c     |   40 +++-------------
 libnautilus-private/nautilus-directory-private.h   |    1 -
 libnautilus-private/nautilus-directory.c           |   15 ++----
 libnautilus-private/nautilus-directory.h           |    2 -
 libnautilus-private/nautilus-file-private.h        |    1 -
 libnautilus-private/nautilus-file.c                |   49 ++++++--------------
 libnautilus-private/nautilus-file.h                |    7 +--
 libnautilus-private/nautilus-global-preferences.c  |    8 ---
 libnautilus-private/nautilus-global-preferences.h  |    3 +-
 libnautilus-private/nautilus-merged-directory.c    |    8 +--
 libnautilus-private/nautilus-search-directory.c    |    3 -
 libnautilus-private/nautilus-vfs-directory.c       |    2 -
 libnautilus-private/nautilus-vfs-file.c            |    2 +-
 src/file-manager/fm-directory-view.c               |   26 ++++-------
 src/file-manager/fm-tree-model.c                   |    6 +--
 src/file-manager/fm-tree-view.c                    |   19 +++++---
 src/nautilus-file-management-properties.c          |   13 ++---
 src/nautilus-window-menus.c                        |   10 ++--
 test/test-nautilus-directory-async.c               |    4 +-
 22 files changed, 71 insertions(+), 157 deletions(-)
---
diff --git a/libnautilus-private/nautilus-desktop-directory-file.c b/libnautilus-private/nautilus-desktop-directory-file.c
index 334f587..4333d64 100644
--- a/libnautilus-private/nautilus-desktop-directory-file.c
+++ b/libnautilus-private/nautilus-desktop-directory-file.c
@@ -168,7 +168,7 @@ desktop_directory_file_monitor_add (NautilusFile *file,
 	/* Do the rest ourself */
 	nautilus_directory_monitor_add_internal
 		(file->details->directory, file,
-		 client, TRUE, TRUE,
+		 client, TRUE,
 		 monitor->non_delegated_attributes,
 		 NULL, NULL);
 }
diff --git a/libnautilus-private/nautilus-desktop-directory.c b/libnautilus-private/nautilus-desktop-directory.c
index 075f5e3..7a3e9de 100644
--- a/libnautilus-private/nautilus-desktop-directory.c
+++ b/libnautilus-private/nautilus-desktop-directory.c
@@ -59,7 +59,6 @@ typedef struct {
 	NautilusDesktopDirectory *desktop_dir;
 
 	gboolean monitor_hidden_files;
-	gboolean monitor_backup_files;
 	NautilusFileAttributes monitor_attributes;
 } MergedMonitor;
 
@@ -288,7 +287,6 @@ static void
 desktop_monitor_add (NautilusDirectory *directory,
 		    gconstpointer client,
 		    gboolean monitor_hidden_files,
-		    gboolean monitor_backup_files,
 		    NautilusFileAttributes file_attributes,
 		    NautilusDirectoryCallback callback,
 		    gpointer callback_data)
@@ -312,7 +310,6 @@ desktop_monitor_add (NautilusDirectory *directory,
 				     (gpointer) client, monitor);
 	}
 	monitor->monitor_hidden_files = monitor_hidden_files;
-	monitor->monitor_backup_files = monitor_backup_files;
 	monitor->monitor_attributes = file_attributes;
 	
 	/* Call through to the real directory add calls. */
@@ -321,7 +318,7 @@ desktop_monitor_add (NautilusDirectory *directory,
 	/* Call up to real dir */
 	nautilus_directory_file_monitor_add
 		(desktop->details->real_directory, monitor,
-		 monitor_hidden_files, monitor_backup_files,
+		 monitor_hidden_files,
 		 file_attributes,
 		 build_merged_callback_list, &merged_callback_list);
 	
diff --git a/libnautilus-private/nautilus-desktop-icon-file.c b/libnautilus-private/nautilus-desktop-icon-file.c
index 512eb67..115e103 100644
--- a/libnautilus-private/nautilus-desktop-icon-file.c
+++ b/libnautilus-private/nautilus-desktop-icon-file.c
@@ -53,7 +53,7 @@ desktop_icon_file_monitor_add (NautilusFile *file,
 {
 	nautilus_directory_monitor_add_internal
 		(file->details->directory, file,
-		 client, TRUE, TRUE, attributes, NULL, NULL);
+		 client, TRUE, attributes, NULL, NULL);
 }
 
 static void
diff --git a/libnautilus-private/nautilus-directory-async.c b/libnautilus-private/nautilus-directory-async.c
index 8f2b74a..dbee42e 100644
--- a/libnautilus-private/nautilus-directory-async.c
+++ b/libnautilus-private/nautilus-directory-async.c
@@ -158,7 +158,6 @@ typedef struct {
 typedef struct {
 	NautilusFile *file; /* Which file, NULL means all. */
 	gboolean monitor_hidden_files; /* defines whether "all" includes hidden files */
-	gboolean monitor_backup_files; /* defines whether "all" includes backup files */
 	gconstpointer client;
 	Request request;
 } Monitor;
@@ -744,7 +743,6 @@ nautilus_directory_monitor_add_internal (NautilusDirectory *directory,
 					 NautilusFile *file,
 					 gconstpointer client,
 					 gboolean monitor_hidden_files,
-					 gboolean monitor_backup_files,
 					 NautilusFileAttributes file_attributes,
 					 NautilusDirectoryCallback callback,
 					 gpointer callback_data)
@@ -761,7 +759,6 @@ nautilus_directory_monitor_add_internal (NautilusDirectory *directory,
 	monitor = g_new (Monitor, 1);
 	monitor->file = file;
 	monitor->monitor_hidden_files = monitor_hidden_files;
-	monitor->monitor_backup_files = monitor_backup_files;
 	monitor->client = client;
 	monitor->request = nautilus_directory_set_up_request (file_attributes);
 
@@ -830,59 +827,39 @@ set_file_unconfirmed (NautilusFile *file, gboolean unconfirmed)
 }
 
 static gboolean show_hidden_files = TRUE;
-static gboolean show_backup_files = TRUE;
 
 static void
 show_hidden_files_changed_callback (gpointer callback_data)
 {
-	show_hidden_files = eel_preferences_get_boolean (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES);
-}
-
-static void
-show_backup_files_changed_callback (gpointer callback_data)
-{
-	show_backup_files = eel_preferences_get_boolean (NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES);
+	show_hidden_files = g_settings_get_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES);
 }
 
 static gboolean
 should_skip_file (NautilusDirectory *directory, GFileInfo *info)
 {
 	static gboolean show_hidden_files_changed_callback_installed = FALSE;
-	static gboolean show_backup_files_changed_callback_installed = FALSE;
 
 	/* Add the callback once for the life of our process */
 	if (!show_hidden_files_changed_callback_installed) {
-		eel_preferences_add_callback (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES,
-					      show_hidden_files_changed_callback,
-					      NULL);
+		g_signal_connect_swapped (nautilus_preferences,
+					  "changed::" NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES,
+					  G_CALLBACK(show_hidden_files_changed_callback),
+					  NULL);
+
 		show_hidden_files_changed_callback_installed = TRUE;
-		
-		/* Peek for the first time */
-		show_hidden_files_changed_callback (NULL);
-	}
 
-	/* Add the callback once for the life of our process */
-	if (!show_backup_files_changed_callback_installed) {
-		eel_preferences_add_callback (NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES,
-					      show_backup_files_changed_callback,
-					      NULL);
-		show_backup_files_changed_callback_installed = TRUE;
-		
 		/* Peek for the first time */
-		show_backup_files_changed_callback (NULL);
+		show_hidden_files_changed_callback (NULL);
 	}
 
 	if (!show_hidden_files &&
 	    (g_file_info_get_is_hidden (info) ||
+	     g_file_info_get_is_backup (info) ||
 	     (directory != NULL && directory->details->hidden_file_hash != NULL &&
 	      g_hash_table_lookup (directory->details->hidden_file_hash,
 				   g_file_info_get_name (info)) != NULL))) {
 		return TRUE;
 	}
-	
-	if (!show_backup_files && g_file_info_get_is_backup (info)) {
-		return TRUE;
-	}
 
 	return FALSE;
 }
@@ -2357,7 +2334,6 @@ monitor_includes_file (const Monitor *monitor,
 	}
 	return nautilus_file_should_show (file,
 					  monitor->monitor_hidden_files,
-					  monitor->monitor_backup_files,
 					  TRUE);
 }
 
diff --git a/libnautilus-private/nautilus-directory-private.h b/libnautilus-private/nautilus-directory-private.h
index be1f73b..7d4713f 100644
--- a/libnautilus-private/nautilus-directory-private.h
+++ b/libnautilus-private/nautilus-directory-private.h
@@ -165,7 +165,6 @@ void               nautilus_directory_monitor_add_internal            (NautilusD
 								       NautilusFile              *file,
 								       gconstpointer              client,
 								       gboolean                   monitor_hidden_files,
-								       gboolean                   monitor_backup_files,
 								       NautilusFileAttributes     attributes,
 								       NautilusDirectoryCallback  callback,
 								       gpointer                   callback_data);
diff --git a/libnautilus-private/nautilus-directory.c b/libnautilus-private/nautilus-directory.c
index ff4c41b..ba7bad4 100644
--- a/libnautilus-private/nautilus-directory.c
+++ b/libnautilus-private/nautilus-directory.c
@@ -316,12 +316,11 @@ add_preferences_callbacks (void)
 {
 	nautilus_global_preferences_init ();
 
-	eel_preferences_add_callback (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES,
-				      filtering_changed_callback,
-				      NULL);
-	eel_preferences_add_callback (NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES,
-				      filtering_changed_callback,
-				      NULL);
+	g_signal_connect_swapped (nautilus_preferences,
+				  "changed::" NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES,
+				  G_CALLBACK(filtering_changed_callback),
+				  NULL);
+
 	eel_preferences_add_callback (NAUTILUS_PREFERENCES_SHOW_TEXT_IN_ICONS,
 				      async_data_preference_changed_callback,
 				      NULL);
@@ -1560,7 +1559,6 @@ void
 nautilus_directory_file_monitor_add (NautilusDirectory *directory,
 				     gconstpointer client,
 				     gboolean monitor_hidden_files,
-				     gboolean monitor_backup_files,
 				     NautilusFileAttributes file_attributes,
 				     NautilusDirectoryCallback callback,
 				     gpointer callback_data)
@@ -1572,7 +1570,6 @@ nautilus_directory_file_monitor_add (NautilusDirectory *directory,
 		(NAUTILUS_DIRECTORY_CLASS, directory,
 		 file_monitor_add, (directory, client,
 				    monitor_hidden_files,
-				    monitor_backup_files,
 				    file_attributes,
 				    callback, callback_data));
 }
@@ -1824,7 +1821,7 @@ nautilus_self_check_directory (void)
 
 	nautilus_directory_file_monitor_add
 		(directory, &data_dummy,
-		 TRUE, TRUE, 0, NULL, NULL);
+		 TRUE, 0, NULL, NULL);
 
 	/* FIXME: these need to be updated to the new metadata infrastructure
 	 *  as make check doesn't pass.
diff --git a/libnautilus-private/nautilus-directory.h b/libnautilus-private/nautilus-directory.h
index 7df4838..2b7bab7 100644
--- a/libnautilus-private/nautilus-directory.h
+++ b/libnautilus-private/nautilus-directory.h
@@ -118,7 +118,6 @@ typedef struct
 	void     (* file_monitor_add)    (NautilusDirectory          *directory,
 					  gconstpointer              client,
 					  gboolean                   monitor_hidden_files,
-					  gboolean                   monitor_backup_files,
 					  NautilusFileAttributes     monitor_attributes,
 					  NautilusDirectoryCallback  initial_files_callback,
 					  gpointer                   callback_data);
@@ -195,7 +194,6 @@ void               nautilus_directory_cancel_callback          (NautilusDirector
 void               nautilus_directory_file_monitor_add         (NautilusDirectory         *directory,
 								gconstpointer              client,
 								gboolean                   monitor_hidden_files,
-								gboolean                   monitor_backup_files,
 								NautilusFileAttributes     attributes,
 								NautilusDirectoryCallback  initial_files_callback,
 								gpointer                   callback_data);
diff --git a/libnautilus-private/nautilus-file-private.h b/libnautilus-private/nautilus-file-private.h
index eee3b64..dce2095 100644
--- a/libnautilus-private/nautilus-file-private.h
+++ b/libnautilus-private/nautilus-file-private.h
@@ -203,7 +203,6 @@ struct NautilusFileDetails
 	eel_boolean_bit is_symlink                    : 1;
 	eel_boolean_bit is_mountpoint                 : 1;
 	eel_boolean_bit is_hidden                     : 1;
-	eel_boolean_bit is_backup                     : 1;
 
 	eel_boolean_bit has_permissions               : 1;
 	
diff --git a/libnautilus-private/nautilus-file.c b/libnautilus-private/nautilus-file.c
index 2c5b868..5f3a080 100644
--- a/libnautilus-private/nautilus-file.c
+++ b/libnautilus-private/nautilus-file.c
@@ -98,7 +98,6 @@
 
 typedef enum {
 	SHOW_HIDDEN = 1 << 0,
-	SHOW_BACKUP = 1 << 1
 } FilterOptions;
 
 typedef void (* ModifyListFunction) (GList **list, NautilusFile *file);
@@ -443,7 +442,6 @@ nautilus_file_clear_info (NautilusFile *file)
 	file->details->is_trusted_link = FALSE;
 	file->details->is_symlink = FALSE;
 	file->details->is_hidden = FALSE;
-	file->details->is_backup = FALSE;
 	file->details->is_mountpoint = FALSE;
 	file->details->uid = -1;
 	file->details->gid = -1;
@@ -2072,7 +2070,7 @@ update_info_internal (NautilusFile *file,
 {
 	GList *node;
 	gboolean changed;
-	gboolean is_symlink, is_hidden, is_backup, is_mountpoint;
+	gboolean is_symlink, is_hidden, is_mountpoint;
 	gboolean has_permissions;
 	guint32 permissions;
 	gboolean can_read, can_write, can_execute, can_delete, can_trash, can_rename, can_mount, can_unmount, can_eject;
@@ -2161,19 +2159,13 @@ update_info_internal (NautilusFile *file,
 		changed = TRUE;
 	}
 	file->details->is_symlink = is_symlink;
-		
-	is_hidden = g_file_info_get_is_hidden (info);
+
+	is_hidden = g_file_info_get_is_hidden (info) || g_file_info_get_is_backup (info);
 	if (file->details->is_hidden != is_hidden) {
 		changed = TRUE;
 	}
 	file->details->is_hidden = is_hidden;
-		
-	is_backup = g_file_info_get_is_backup (info);
-	if (file->details->is_backup != is_backup) {
-		changed = TRUE;
-	}
-	file->details->is_backup = is_backup;
-		
+
 	is_mountpoint = g_file_info_get_attribute_boolean (info, G_FILE_ATTRIBUTE_UNIX_IS_MOUNTPOINT);
 	if (file->details->is_mountpoint != is_mountpoint) {
 		changed = TRUE;
@@ -3382,12 +3374,6 @@ nautilus_file_is_hidden_file (NautilusFile *file)
 	return file->details->is_hidden;
 }
 
-gboolean 
-nautilus_file_is_backup_file (NautilusFile *file)
-{
-	return file->details->is_backup;
-}
-
 static gboolean
 is_file_hidden (NautilusFile *file)
 {
@@ -3401,7 +3387,6 @@ is_file_hidden (NautilusFile *file)
  * nautilus_file_should_show:
  * @file: the file to check.
  * @show_hidden: whether we want to show hidden files or not.
- * @show_backup: whether we want to show backup files or not.
  * 
  * Determines if a #NautilusFile should be shown. Note that when browsing
  * a trash directory, this function will always return %TRUE. 
@@ -3411,7 +3396,6 @@ is_file_hidden (NautilusFile *file)
 gboolean 
 nautilus_file_should_show (NautilusFile *file, 
 			   gboolean show_hidden,
-			   gboolean show_backup,
 			   gboolean show_foreign)
 {
 	/* Never hide any files in trash. */
@@ -3419,7 +3403,6 @@ nautilus_file_should_show (NautilusFile *file,
 		return TRUE;
 	} else {
 		return (show_hidden || (!nautilus_file_is_hidden_file (file) && !is_file_hidden (file))) &&
-			(show_backup || !nautilus_file_is_backup_file (file)) &&
 			(show_foreign || !(nautilus_file_is_in_desktop (file) && nautilus_file_is_foreign_link (file)));
 	}
 }
@@ -3445,12 +3428,11 @@ nautilus_file_is_in_desktop (NautilusFile *file)
 		return nautilus_is_desktop_directory (file->details->directory->details->location);
 	}
 	return FALSE;
-	
 }
 
 static gboolean
-filter_hidden_and_backup_partition_callback (gpointer data,
-					     gpointer callback_data)
+filter_hidden_partition_callback (gpointer data,
+				  gpointer callback_data)
 {
 	NautilusFile *file;
 	FilterOptions options;
@@ -3458,29 +3440,26 @@ filter_hidden_and_backup_partition_callback (gpointer data,
 	file = NAUTILUS_FILE (data);
 	options = GPOINTER_TO_INT (callback_data);
 
-	return nautilus_file_should_show (file, 
+	return nautilus_file_should_show (file,
 					  options & SHOW_HIDDEN,
-					  options & SHOW_BACKUP,
 					  TRUE);
 }
 
 GList *
-nautilus_file_list_filter_hidden_and_backup (GList    *files,
-					     gboolean  show_hidden,
-					     gboolean  show_backup)
+nautilus_file_list_filter_hidden (GList    *files,
+				  gboolean  show_hidden)
 {
 	GList *filtered_files;
 	GList *removed_files;
 
-	/* FIXME bugzilla.gnome.org 40653: 
-	 * Eventually this should become a generic filtering thingy. 
+	/* FIXME bugzilla.gnome.org 40653:
+	 * Eventually this should become a generic filtering thingy.
 	 */
 
 	filtered_files = nautilus_file_list_copy (files);
-	filtered_files = eel_g_list_partition (filtered_files, 
-					       filter_hidden_and_backup_partition_callback,
-					       GINT_TO_POINTER ((show_hidden ? SHOW_HIDDEN : 0) |
-								(show_backup ? SHOW_BACKUP : 0)),
+	filtered_files = eel_g_list_partition (filtered_files,
+					       filter_hidden_partition_callback,
+					       GINT_TO_POINTER ((show_hidden ? SHOW_HIDDEN : 0)),
 					       &removed_files);
 	nautilus_file_list_free (removed_files);
 
diff --git a/libnautilus-private/nautilus-file.h b/libnautilus-private/nautilus-file.h
index 011f215..7197088 100644
--- a/libnautilus-private/nautilus-file.h
+++ b/libnautilus-private/nautilus-file.h
@@ -421,14 +421,11 @@ int                     nautilus_file_compare_location                  (Nautilu
 
 /* filtering functions for use by various directory views */
 gboolean                nautilus_file_is_hidden_file                    (NautilusFile                   *file);
-gboolean                nautilus_file_is_backup_file                    (NautilusFile                   *file);
 gboolean                nautilus_file_should_show                       (NautilusFile                   *file,
 									 gboolean                        show_hidden,
-									 gboolean                        show_backup,
 									 gboolean                        show_foreign);
-GList                  *nautilus_file_list_filter_hidden_and_backup     (GList                          *files,
-									 gboolean                        show_hidden,
-									 gboolean                        show_backup);
+GList                  *nautilus_file_list_filter_hidden                (GList                          *files,
+									 gboolean                        show_hidden);
 
 
 /* Get the URI that's used when activating the file.
diff --git a/libnautilus-private/nautilus-global-preferences.c b/libnautilus-private/nautilus-global-preferences.c
index fb075a2..9b21e31 100644
--- a/libnautilus-private/nautilus-global-preferences.c
+++ b/libnautilus-private/nautilus-global-preferences.c
@@ -239,14 +239,6 @@ static const PreferenceDefault preference_defaults[] = {
 	  PREFERENCE_BOOLEAN,
 	  GINT_TO_POINTER (TRUE)
 	},
-	{ NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES,
-	  PREFERENCE_BOOLEAN,
-	  GINT_TO_POINTER (FALSE)
-	},
-	{ NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES,
-	  PREFERENCE_BOOLEAN,
-	  GINT_TO_POINTER (FALSE)
-	},
 	{ NAUTILUS_PREFERENCES_SHOW_TEXT_IN_ICONS,
 	  PREFERENCE_STRING,
 	  "local_only",
diff --git a/libnautilus-private/nautilus-global-preferences.h b/libnautilus-private/nautilus-global-preferences.h
index a46921a..bf73a31 100644
--- a/libnautilus-private/nautilus-global-preferences.h
+++ b/libnautilus-private/nautilus-global-preferences.h
@@ -67,8 +67,7 @@ G_BEGIN_DECLS
 #define NAUTILUS_PREFERENCES_DESKTOP_FONT			"desktop-font"
 
 /* Display  */
-#define NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES  		"/desktop/gnome/file_views/show_hidden_files"
-#define NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES  		"/desktop/gnome/file_views/show_backup_files"
+#define NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES			"show-hidden-files"
 #define NAUTILUS_PREFERENCES_SHOW_ADVANCED_PERMISSIONS		"preferences/show_advanced_permissions"
 #define NAUTILUS_PREFERENCES_DATE_FORMAT			"preferences/date_format"
 
diff --git a/libnautilus-private/nautilus-merged-directory.c b/libnautilus-private/nautilus-merged-directory.c
index 5c9fc45..0810479 100644
--- a/libnautilus-private/nautilus-merged-directory.c
+++ b/libnautilus-private/nautilus-merged-directory.c
@@ -56,7 +56,6 @@ typedef struct {
 	NautilusMergedDirectory *merged;
 
 	gboolean monitor_hidden_files;
-	gboolean monitor_backup_files;
 	NautilusFileAttributes monitor_attributes;
 } MergedMonitor;
 
@@ -257,7 +256,6 @@ static void
 merged_monitor_add (NautilusDirectory *directory,
 		    gconstpointer client,
 		    gboolean monitor_hidden_files,
-		    gboolean monitor_backup_files,
 		    NautilusFileAttributes file_attributes,
 		    NautilusDirectoryCallback callback,
 		    gpointer callback_data)
@@ -282,15 +280,14 @@ merged_monitor_add (NautilusDirectory *directory,
 				     (gpointer) client, monitor);
 	}
 	monitor->monitor_hidden_files = monitor_hidden_files;
-	monitor->monitor_backup_files = monitor_backup_files;
 	monitor->monitor_attributes = file_attributes;
-	
+
 	/* Call through to the real directory add calls. */
 	merged_callback_list = NULL;
 	for (node = merged->details->directories; node != NULL; node = node->next) {
 		nautilus_directory_file_monitor_add
 			(node->data, monitor,
-			 monitor_hidden_files, monitor_backup_files,
+			 monitor_hidden_files,
 			 file_attributes,
 			 build_merged_callback_list, &merged_callback_list);
 	}
@@ -461,7 +458,6 @@ monitor_add_directory (gpointer key,
 	nautilus_directory_file_monitor_add
 		(NAUTILUS_DIRECTORY (callback_data), monitor,
 		 monitor->monitor_hidden_files,
-		 monitor->monitor_backup_files,
 		 monitor->monitor_attributes,
 		 forward_files_added_cover, monitor->merged);
 }
diff --git a/libnautilus-private/nautilus-search-directory.c b/libnautilus-private/nautilus-search-directory.c
index 1fd4879..84f6b5b 100644
--- a/libnautilus-private/nautilus-search-directory.c
+++ b/libnautilus-private/nautilus-search-directory.c
@@ -55,7 +55,6 @@ struct NautilusSearchDirectoryDetails {
 
 typedef struct {
 	gboolean monitor_hidden_files;
-	gboolean monitor_backup_files;
 	NautilusFileAttributes monitor_attributes;
 
 	gconstpointer client;
@@ -172,7 +171,6 @@ static void
 search_monitor_add (NautilusDirectory *directory,
 		    gconstpointer client,
 		    gboolean monitor_hidden_files,
-		    gboolean monitor_backup_files,
 		    NautilusFileAttributes file_attributes,
 		    NautilusDirectoryCallback callback,
 		    gpointer callback_data)
@@ -186,7 +184,6 @@ search_monitor_add (NautilusDirectory *directory,
 
 	monitor = g_new0 (SearchMonitor, 1);
 	monitor->monitor_hidden_files = monitor_hidden_files;
-	monitor->monitor_backup_files = monitor_backup_files;
 	monitor->monitor_attributes = file_attributes;
 	monitor->client = client;
 
diff --git a/libnautilus-private/nautilus-vfs-directory.c b/libnautilus-private/nautilus-vfs-directory.c
index e18031d..0d4f0aa 100644
--- a/libnautilus-private/nautilus-vfs-directory.c
+++ b/libnautilus-private/nautilus-vfs-directory.c
@@ -94,7 +94,6 @@ static void
 vfs_file_monitor_add (NautilusDirectory *directory,
 		      gconstpointer client,
 		      gboolean monitor_hidden_files,
-		      gboolean monitor_backup_files,
 		      NautilusFileAttributes file_attributes,
 		      NautilusDirectoryCallback callback,
 		      gpointer callback_data)
@@ -106,7 +105,6 @@ vfs_file_monitor_add (NautilusDirectory *directory,
 		(directory, NULL,
 		 client,
 		 monitor_hidden_files,
-		 monitor_backup_files,
 		 file_attributes,
 		 callback, callback_data);
 }
diff --git a/libnautilus-private/nautilus-vfs-file.c b/libnautilus-private/nautilus-vfs-file.c
index ef7de84..c584a2b 100644
--- a/libnautilus-private/nautilus-vfs-file.c
+++ b/libnautilus-private/nautilus-vfs-file.c
@@ -48,7 +48,7 @@ vfs_file_monitor_add (NautilusFile *file,
 {
 	nautilus_directory_monitor_add_internal
 		(file->details->directory, file,
-		 client, TRUE, TRUE, attributes, NULL, NULL);
+		 client, TRUE, attributes, NULL, NULL);
 }   
 			   
 static void
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index cbcc286..192b9ba 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -231,7 +231,6 @@ struct FMDirectoryViewDetails
 
 	gboolean show_foreign_files;
 	gboolean show_hidden_files;
-	gboolean show_backup_files;
 	gboolean ignore_hidden_file_preferences;
 
 	gboolean batching_selection_level;
@@ -1708,9 +1707,9 @@ add_directory_to_directory_list (FMDirectoryView *view,
 			NAUTILUS_FILE_ATTRIBUTES_FOR_ICON |
 			NAUTILUS_FILE_ATTRIBUTE_INFO |
 			NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_COUNT;
- 
+
 		nautilus_directory_file_monitor_add (directory, directory_list,
-						     FALSE, FALSE, attributes,
+						     FALSE, attributes,
 						     (NautilusDirectoryCallback)changed_callback, view);
 
 		g_signal_connect_object (directory, "files_added",
@@ -3267,7 +3266,6 @@ fm_directory_view_add_subdirectory (FMDirectoryView  *view,
 	nautilus_directory_file_monitor_add (directory,
 					     &view->details->model,
 					     view->details->show_hidden_files,
-					     view->details->show_backup_files,
 					     attributes,
 					     files_added_callback, view);
 	
@@ -5342,7 +5340,7 @@ update_directory_in_scripts_menu (FMDirectoryView *view, NautilusDirectory *dire
 	g_free (escaped_path);
 
 	file_list = nautilus_directory_get_file_list (directory);
-	filtered = nautilus_file_list_filter_hidden_and_backup (file_list, FALSE, FALSE);
+	filtered = nautilus_file_list_filter_hidden (file_list, FALSE);
 	nautilus_file_list_free (file_list);
 
 	file_list = nautilus_file_list_sort_by_display_name (filtered);
@@ -5596,7 +5594,7 @@ update_directory_in_templates_menu (FMDirectoryView *view,
 	g_free (escaped_path);
 
 	file_list = nautilus_directory_get_file_list (directory);
-	filtered = nautilus_file_list_filter_hidden_and_backup (file_list, FALSE, FALSE);
+	filtered = nautilus_file_list_filter_hidden (file_list, FALSE);
 	nautilus_file_list_free (file_list);
 
 	file_list = nautilus_file_list_sort_by_display_name (filtered);
@@ -6987,26 +6985,23 @@ fm_directory_view_init_show_hidden_files (FMDirectoryView *view)
 	if (view->details->ignore_hidden_file_preferences) {
 		return;
 	}
-	
+
 	show_hidden_changed = FALSE;
 	mode = nautilus_window_info_get_hidden_files_mode (view->details->window);
-	
+
 	if (mode == NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DEFAULT) {
-		show_hidden_default_setting = eel_preferences_get_boolean (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES);
+		show_hidden_default_setting = g_settings_get_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES);
 		if (show_hidden_default_setting != view->details->show_hidden_files) {
 			view->details->show_hidden_files = show_hidden_default_setting;
-			view->details->show_backup_files = show_hidden_default_setting;
 			show_hidden_changed = TRUE;
 		}
 	} else {
 		if (mode == NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_ENABLE) {
 			show_hidden_changed = !view->details->show_hidden_files;
 			view->details->show_hidden_files = TRUE;
-			view->details->show_backup_files = TRUE;
 		} else {
 			show_hidden_changed = view->details->show_hidden_files;
 			view->details->show_hidden_files = FALSE;
-			view->details->show_backup_files = FALSE;
 		}
 	}
 
@@ -9336,7 +9331,6 @@ finish_loading (FMDirectoryView *view)
 	nautilus_directory_file_monitor_add (view->details->model,
 					     &view->details->model,
 					     view->details->show_hidden_files,
-					     view->details->show_backup_files,
 					     attributes,
 					     files_added_callback, view);
 
@@ -9722,9 +9716,8 @@ fm_directory_view_accepts_dragged_files (FMDirectoryView *view)
 gboolean
 fm_directory_view_should_show_file (FMDirectoryView *view, NautilusFile *file)
 {
-	return nautilus_file_should_show (file, 
-					  view->details->show_hidden_files, 
-					  view->details->show_backup_files,
+	return nautilus_file_should_show (file,
+					  view->details->show_hidden_files,
 					  view->details->show_foreign_files);
 }
 
@@ -9837,7 +9830,6 @@ fm_directory_view_ignore_hidden_file_preferences (FMDirectoryView *view)
 	}
 
 	view->details->show_hidden_files = FALSE;
-	view->details->show_backup_files = FALSE;
 	view->details->ignore_hidden_file_preferences = TRUE;
 }
 
diff --git a/src/file-manager/fm-tree-model.c b/src/file-manager/fm-tree-model.c
index 7804d97..75b9379 100644
--- a/src/file-manager/fm-tree-model.c
+++ b/src/file-manager/fm-tree-model.c
@@ -98,7 +98,6 @@ struct FMTreeModelDetails {
 	guint monitoring_update_idle_id;
 
 	gboolean show_hidden_files;
-	gboolean show_backup_files;
 	gboolean show_only_directories;
 
 	GList *highlighted_files;
@@ -923,7 +922,6 @@ should_show_file (FMTreeModel *model, NautilusFile *file)
 
 	should = nautilus_file_should_show (file,
 					    model->details->show_hidden_files,
-					    model->details->show_backup_files,
 					    TRUE);
 
 	if (should
@@ -1128,11 +1126,10 @@ start_monitoring_directory (FMTreeModel *model, TreeNode *node)
 		 G_CALLBACK (files_changed_callback), node->root);
 
 	set_done_loading (model, node, nautilus_directory_are_all_files_seen (directory));
-	
+
 	attributes = get_tree_monitor_attributes ();
 	nautilus_directory_file_monitor_add (directory, model,
 					     model->details->show_hidden_files,
-					     model->details->show_backup_files,
 					     attributes, files_changed_callback, node->root);
 }
 
@@ -1718,7 +1715,6 @@ fm_tree_model_set_show_hidden_files (FMTreeModel *model,
 		return;
 	}
 	model->details->show_hidden_files = show_hidden_files;
-	model->details->show_backup_files = show_hidden_files;
 	stop_monitoring (model);
 	if (!show_hidden_files) {
 		destroy_by_function (model, nautilus_file_is_hidden_file);
diff --git a/src/file-manager/fm-tree-view.c b/src/file-manager/fm-tree-view.c
index e7b3eb7..1ee2d38 100644
--- a/src/file-manager/fm-tree-view.c
+++ b/src/file-manager/fm-tree-view.c
@@ -1418,7 +1418,7 @@ static void
 update_filtering_from_preferences (FMTreeView *view)
 {
 	NautilusWindowShowHiddenFilesMode mode;
-	
+
 	if (view->details->child_model == NULL) {
 		return;
 	}
@@ -1428,7 +1428,7 @@ update_filtering_from_preferences (FMTreeView *view)
 	if (mode == NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DEFAULT) {
 		fm_tree_model_set_show_hidden_files
 			(view->details->child_model,
-			 eel_preferences_get_boolean (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES));
+			 g_settings_get_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES));
 	} else {
 		fm_tree_model_set_show_hidden_files
 			(view->details->child_model,
@@ -1492,13 +1492,14 @@ fm_tree_view_init (FMTreeView *view)
 	
 	view->details->selecting = FALSE;
 
-	eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES,
-						  filtering_changed_callback, view, G_OBJECT (view));
-	eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES,
-						  filtering_changed_callback, view, G_OBJECT (view));
+	g_signal_connect_swapped (nautilus_preferences,
+				  "changed::" NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES,
+				  G_CALLBACK(filtering_changed_callback),
+				  view);
+
 	eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_TREE_SHOW_ONLY_DIRECTORIES,
 						  filtering_changed_callback, view, G_OBJECT (view));
-	
+
 	view->details->popup_file = NULL;
 
 	view->details->clipboard_handler_id = 
@@ -1562,6 +1563,10 @@ fm_tree_view_dispose (GObject *object)
 		view->details->volume_monitor = NULL;
 	}
 
+	g_signal_handlers_disconnect_by_func (nautilus_preferences,
+					      G_CALLBACK(filtering_changed_callback),
+					      view);
+
 	view->details->window = NULL;
 
 	G_OBJECT_CLASS (parent_class)->dispose (object);
diff --git a/src/nautilus-file-management-properties.c b/src/nautilus-file-management-properties.c
index c765bc2..a035005 100644
--- a/src/nautilus-file-management-properties.c
+++ b/src/nautilus-file-management-properties.c
@@ -730,23 +730,20 @@ nautilus_file_management_properties_dialog_setup (GtkBuilder *builder, GtkWindow
 	bind_builder_bool (builder, nautilus_media_preferences,
 			   NAUTILUS_FILE_MANAGEMENT_PROPERTIES_MEDIA_AUTORUN_NEVER,
 			   NAUTILUS_PREFERENCES_MEDIA_AUTORUN_NEVER);
-
 	bind_builder_bool (builder, nautilus_preferences,
 			   NAUTILUS_FILE_MANAGEMENT_PROPERTIES_TRASH_CONFIRM_WIDGET,
 			   NAUTILUS_PREFERENCES_CONFIRM_TRASH);
 	bind_builder_bool (builder, nautilus_preferences,
 			   NAUTILUS_FILE_MANAGEMENT_PROPERTIES_TRASH_DELETE_WIDGET,
 			   NAUTILUS_PREFERENCES_ENABLE_DELETE);
-	eel_preferences_builder_connect_bool (builder,
-					      NAUTILUS_FILE_MANAGEMENT_PROPERTIES_SHOW_HIDDEN_WIDGET,
-					      NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES);
-	eel_preferences_builder_connect_bool_slave (builder,
-						    NAUTILUS_FILE_MANAGEMENT_PROPERTIES_SHOW_HIDDEN_WIDGET,
-						    NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES);
+	bind_builder_bool (builder, nautilus_preferences,
+			   NAUTILUS_FILE_MANAGEMENT_PROPERTIES_SHOW_HIDDEN_WIDGET,
+			   NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES);
+
 	eel_preferences_builder_connect_bool (builder,
 					      NAUTILUS_FILE_MANAGEMENT_PROPERTIES_TREE_VIEW_FOLDERS_WIDGET,
 					      NAUTILUS_PREFERENCES_TREE_SHOW_ONLY_DIRECTORIES);
-	
+
 	eel_preferences_builder_connect_string_enum_combo_box (builder,
 							       NAUTILUS_FILE_MANAGEMENT_PROPERTIES_DEFAULT_VIEW_WIDGET,
 							       NAUTILUS_PREFERENCES_DEFAULT_FOLDER_VIEWER,
diff --git a/src/nautilus-window-menus.c b/src/nautilus-window-menus.c
index 1cdab99..0efd5ea 100644
--- a/src/nautilus-window-menus.c
+++ b/src/nautilus-window-menus.c
@@ -424,7 +424,7 @@ show_hidden_files_preference_callback (gpointer callback_data)
 		/* update button */
 		g_signal_handlers_block_by_func (action, action_show_hidden_files_callback, window);
 		gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
-					      eel_preferences_get_boolean (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES));
+					      g_settings_get_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES));
 		g_signal_handlers_unblock_by_func (action, action_show_hidden_files_callback, window);
 
 		/* inform views */
@@ -913,13 +913,13 @@ nautilus_window_initialize_menus (NautilusWindow *window)
 	action = gtk_action_group_get_action (action_group, NAUTILUS_ACTION_SHOW_HIDDEN_FILES);
 	g_signal_handlers_block_by_func (action, action_show_hidden_files_callback, window);
 	gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
-				      eel_preferences_get_boolean (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES));
+				      g_settings_get_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES));
 	g_signal_handlers_unblock_by_func (action, action_show_hidden_files_callback, window);
 
 
-	eel_preferences_add_callback_while_alive (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES,
-						  show_hidden_files_preference_callback,
-						  window, G_OBJECT (window));
+	g_signal_connect_swapped (nautilus_preferences, "changed::" NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES,
+				  G_CALLBACK(show_hidden_files_preference_callback),
+				  window);
 
 	window->details->ui_manager = gtk_ui_manager_new ();
 	ui_manager = window->details->ui_manager;
diff --git a/test/test-nautilus-directory-async.c b/test/test-nautilus-directory-async.c
index 3dabca4..a625bbd 100644
--- a/test/test-nautilus-directory-async.c
+++ b/test/test-nautilus-directory-async.c
@@ -94,8 +94,8 @@ main (int argc, char **argv)
 	g_signal_connect (directory, "files-added", G_CALLBACK (files_added), NULL);
 	g_signal_connect (directory, "files-changed", G_CALLBACK (files_changed), NULL);
 	g_signal_connect (directory, "done-loading", G_CALLBACK (done_loading), NULL);
-	nautilus_directory_file_monitor_add (directory, client1, TRUE, TRUE,
-					     NAUTILUS_FILE_ATTRIBUTE_INFO, 
+	nautilus_directory_file_monitor_add (directory, client1, TRUE,
+					     NAUTILUS_FILE_ATTRIBUTE_INFO,
 					     NULL, NULL);
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]