[PATCH] Improve backup file experience



The attached patch takes care that the GConf key
"/desktop/gnome/file_views/show_backup_files" takes effect independently
from the GConf key "/desktop/gnome/file_views/show_hidden_files". We
used to decide whether to display backup files based on whether to
display hidden files. With these changes, one can effectively see his
backup files, while still hiding the hidden files.

-- 
Christian Neumair <chris gnome-de org>
Index: src/file-manager/fm-directory-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-directory-view.c,v
retrieving revision 1.708
diff -u -p -r1.708 fm-directory-view.c
--- src/file-manager/fm-directory-view.c	6 Sep 2005 13:55:29 -0000	1.708
+++ src/file-manager/fm-directory-view.c	7 Sep 2005 17:16:35 -0000
@@ -163,6 +163,9 @@ static GdkAtom utf8_string_atom;
 static gboolean show_delete_command_auto_value;
 static gboolean confirm_trash_auto_value;
 
+static gboolean show_hidden_files_auto_value;
+static gboolean show_backup_files_auto_value;
+
 static char *scripts_directory_uri;
 static int scripts_directory_uri_length;
 
@@ -1619,6 +1622,11 @@ fm_directory_view_init (FMDirectoryView 
 						  &confirm_trash_auto_value);
 		eel_preferences_add_auto_boolean (NAUTILUS_PREFERENCES_ENABLE_DELETE,
 						  &show_delete_command_auto_value);
+
+		eel_preferences_add_auto_boolean (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES,
+						  &show_hidden_files_auto_value);
+		eel_preferences_add_auto_boolean (NAUTILUS_PREFERENCES_SHOW_BACKUP_FILES,
+						  &show_backup_files_auto_value);
 	}
 
 	view->details = g_new0 (FMDirectoryViewDetails, 1);
@@ -6055,34 +6063,32 @@ static void
 fm_directory_view_init_show_hidden_files (FMDirectoryView *view)
 {
 	NautilusWindowShowHiddenFilesMode mode;
-	gboolean show_hidden_changed;
-	gboolean show_hidden_default_setting;
+	gboolean changed;
 	GtkAction *action;
 
 	if (view->details->ignore_hidden_file_preferences) {
 		return;
 	}
 	
-	show_hidden_changed = FALSE;
+	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);
-		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;
-		}
+		if (show_hidden_files_auto_value != view->details->show_hidden_files) {
+			view->details->show_hidden_files = show_hidden_files_auto_value;
+			changed = TRUE;
+		}
+	} else if (mode == NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_ENABLE) {
+		changed = !show_hidden_files_auto_value;
+		view->details->show_hidden_files = 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;
-		}
+		changed = show_hidden_files_auto_value;
+		view->details->show_hidden_files = FALSE;
+	}
+
+	if (show_backup_files_auto_value != view->details->show_backup_files) {
+		view->details->show_backup_files = show_backup_files_auto_value;
+		changed = TRUE;
 	}
  
 	action = gtk_action_group_get_action (view->details->dir_action_group,
@@ -6090,7 +6096,7 @@ fm_directory_view_init_show_hidden_files
 	gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
 				      view->details->show_hidden_files);
 	
-	if (show_hidden_changed && (view->details->model != NULL)) {
+	if (changed && (view->details->model != NULL)) {
 		load_directory (view, view->details->model);	
 	}
 
@@ -8086,19 +8092,19 @@ static void
 filtering_changed_callback (gpointer callback_data)
 {
 	FMDirectoryView	*directory_view;
-	gboolean new_show_hidden;
 	NautilusWindowShowHiddenFilesMode mode;
 	GtkAction *action;
+	gboolean changed;
 
 	directory_view = FM_DIRECTORY_VIEW (callback_data);
-	new_show_hidden = eel_preferences_get_boolean (NAUTILUS_PREFERENCES_SHOW_HIDDEN_FILES);
 	mode = nautilus_window_info_get_hidden_files_mode (directory_view->details->window);
+	changed = FALSE;
 
 	/* only apply global show hidden files pref if local setting has not been set for this window */
-	if (new_show_hidden != directory_view->details->show_hidden_files
+	if (show_hidden_files_auto_value != directory_view->details->show_hidden_files
 	    && mode == NAUTILUS_WINDOW_SHOW_HIDDEN_FILES_DEFAULT) {
-		directory_view->details->show_hidden_files = new_show_hidden;
-		directory_view->details->show_backup_files = new_show_hidden;
+		directory_view->details->show_hidden_files = show_hidden_files_auto_value;
+		changed = TRUE;
 
 		action = gtk_action_group_get_action (directory_view->details->dir_action_group,
 						      FM_ACTION_SHOW_HIDDEN_FILES);
@@ -8106,11 +8112,16 @@ filtering_changed_callback (gpointer cal
 		gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
 					      directory_view->details->show_hidden_files);
 		g_signal_handlers_unblock_by_func (action, action_show_hidden_files_callback, directory_view);
+	}
+
+	if (show_backup_files_auto_value != directory_view->details->show_backup_files) {
+		directory_view->details->show_backup_files = show_backup_files_auto_value;
+		changed = TRUE;
+	}
 
+	if (changed && directory_view->details->model != NULL) {
 		/* Reload the current uri so that the filtering changes take place. */
-		if (directory_view->details->model != NULL) {
-			load_directory (directory_view, directory_view->details->model);
-		}
+		load_directory (directory_view, directory_view->details->model);
 	}
 }
 

Attachment: signature.asc
Description: This is a digitally signed message part



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