[nautilus] Convert enable-delete to gsettings



commit 77f7a0378921b98f9b9bd0347acc25aabaa954dd
Author: Alexander Larsson <alexl redhat com>
Date:   Wed Jul 21 16:34:59 2010 +0200

    Convert enable-delete to gsettings

 libnautilus-private/nautilus-global-preferences.c |    4 ----
 libnautilus-private/nautilus-global-preferences.h |    2 +-
 src/file-manager/fm-directory-view.c              |   13 ++-----------
 src/file-manager/fm-tree-view.c                   |   10 +++-------
 src/nautilus-file-management-properties.c         |    6 +++---
 5 files changed, 9 insertions(+), 26 deletions(-)
---
diff --git a/libnautilus-private/nautilus-global-preferences.c b/libnautilus-private/nautilus-global-preferences.c
index 30a7e27..4e3164b 100644
--- a/libnautilus-private/nautilus-global-preferences.c
+++ b/libnautilus-private/nautilus-global-preferences.c
@@ -248,10 +248,6 @@ static const PreferenceDefault preference_defaults[] = {
 	  PREFERENCE_BOOLEAN,
 	  GINT_TO_POINTER (FALSE)
 	},
-	{ NAUTILUS_PREFERENCES_ENABLE_DELETE,
-	  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 95b4f30..0013a56 100644
--- a/libnautilus-private/nautilus-global-preferences.h
+++ b/libnautilus-private/nautilus-global-preferences.h
@@ -59,7 +59,7 @@ G_BEGIN_DECLS
 
 /* Trash options */
 #define NAUTILUS_PREFERENCES_CONFIRM_TRASH			"confirm-trash"
-#define NAUTILUS_PREFERENCES_ENABLE_DELETE			"preferences/enable_delete"
+#define NAUTILUS_PREFERENCES_ENABLE_DELETE			"enable-delete"
 
 /* Desktop options */
 #define NAUTILUS_PREFERENCES_SHOW_DESKTOP			"preferences/show_desktop"
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index 187be9f..cbcc286 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -151,8 +151,6 @@ static guint signals[LAST_SIGNAL];
 
 static GdkAtom copied_files_atom;
 
-static gboolean show_delete_command_auto_value;
-
 static char *scripts_directory_uri;
 static int scripts_directory_uri_length;
 
@@ -1933,17 +1931,10 @@ fm_directory_view_init_view_iface (NautilusViewIface *iface)
 static void
 fm_directory_view_init (FMDirectoryView *view)
 {
-	static gboolean setup_autos = FALSE;
 	NautilusDirectory *scripts_directory;
 	NautilusDirectory *templates_directory;
 	char *templates_uri;
 
-	if (!setup_autos) {
-		setup_autos = TRUE;
-		eel_preferences_add_auto_boolean (NAUTILUS_PREFERENCES_ENABLE_DELETE,
-						  &show_delete_command_auto_value);
-	}
-
 	view->details = g_new0 (FMDirectoryViewDetails, 1);
 
 	/* Default to true; desktop-icon-view sets to false */
@@ -8365,7 +8356,7 @@ real_update_location_menu (FMDirectoryView *view)
 	} else {
 		label = _("Mo_ve to Trash");
 		tip = _("Move the open folder to the Trash");
-		show_separate_delete_command = show_delete_command_auto_value;
+		show_separate_delete_command = g_settings_get_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_ENABLE_DELETE);
 	}
 
 	action = gtk_action_group_get_action (view->details->dir_action_group,
@@ -8689,7 +8680,7 @@ real_update_menus (FMDirectoryView *view)
 	} else {
 		label = _("Mo_ve to Trash");
 		tip = _("Move each selected item to the Trash");
-		show_separate_delete_command = show_delete_command_auto_value;
+		show_separate_delete_command = g_settings_get_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_ENABLE_DELETE);
 	}
 	
 	action = gtk_action_group_get_action (view->details->dir_action_group,
diff --git a/src/file-manager/fm-tree-view.c b/src/file-manager/fm-tree-view.c
index 5bf8f0a..e7b3eb7 100644
--- a/src/file-manager/fm-tree-view.c
+++ b/src/file-manager/fm-tree-view.c
@@ -114,7 +114,6 @@ typedef struct {
 } PrependURIParameters;
 
 static GdkAtom copied_files_atom;
-static gboolean show_delete_command_auto_value;
 
 static void  fm_tree_view_iface_init        (NautilusSidebarIface         *iface);
 static void  sidebar_provider_iface_init    (NautilusSidebarProviderIface *iface);
@@ -744,7 +743,7 @@ button_pressed_callback (GtkTreeView *treeview, GdkEventButton *event,
 		can_move_file_to_trash = nautilus_file_can_trash (view->details->popup_file);
 		gtk_widget_set_sensitive (view->details->popup_trash, can_move_file_to_trash);
 		
-		if (show_delete_command_auto_value) {
+		if (g_settings_get_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_ENABLE_DELETE)) {
 			parent_file_is_writable = is_parent_writable (view->details->popup_file);
 			file_is_home_or_desktop = nautilus_file_is_home (view->details->popup_file)
 				|| nautilus_file_is_desktop_directory (view->details->popup_file);
@@ -1044,7 +1043,7 @@ fm_tree_view_delete_cb (GtkWidget *menu_item,
 {
 	GList *location_list;
 		
-	if (!show_delete_command_auto_value) {
+	if (!g_settings_get_boolean (nautilus_preferences, NAUTILUS_PREFERENCES_ENABLE_DELETE)) {
 		return;
 	}
 	
@@ -1585,11 +1584,8 @@ fm_tree_view_class_init (FMTreeViewClass *class)
 {
 	G_OBJECT_CLASS (class)->dispose = fm_tree_view_dispose;
 	G_OBJECT_CLASS (class)->finalize = fm_tree_view_finalize;
-	
-	copied_files_atom = gdk_atom_intern ("x-special/gnome-copied-files", FALSE);
 
-	eel_preferences_add_auto_boolean (NAUTILUS_PREFERENCES_ENABLE_DELETE,
-					  &show_delete_command_auto_value);	
+	copied_files_atom = gdk_atom_intern ("x-special/gnome-copied-files", FALSE);
 }
 
 static const char *
diff --git a/src/nautilus-file-management-properties.c b/src/nautilus-file-management-properties.c
index d4299d4..c765bc2 100644
--- a/src/nautilus-file-management-properties.c
+++ b/src/nautilus-file-management-properties.c
@@ -734,9 +734,9 @@ nautilus_file_management_properties_dialog_setup (GtkBuilder *builder, GtkWindow
 	bind_builder_bool (builder, nautilus_preferences,
 			   NAUTILUS_FILE_MANAGEMENT_PROPERTIES_TRASH_CONFIRM_WIDGET,
 			   NAUTILUS_PREFERENCES_CONFIRM_TRASH);
-	eel_preferences_builder_connect_bool (builder,
-					      NAUTILUS_FILE_MANAGEMENT_PROPERTIES_TRASH_DELETE_WIDGET,
-					      NAUTILUS_PREFERENCES_ENABLE_DELETE);
+	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);



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