summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libnautilus-private/nautilus-file-operations.c38
-rw-r--r--libnautilus-private/nautilus-global-preferences.c4
-rw-r--r--libnautilus-private/nautilus-global-preferences.h2
-rw-r--r--src/file-manager/fm-directory-view.c7
-rw-r--r--src/nautilus-file-management-properties.c33
5 files changed, 38 insertions, 46 deletions
diff --git a/libnautilus-private/nautilus-file-operations.c b/libnautilus-private/nautilus-file-operations.c
index caee375db..9ef181984 100644
--- a/libnautilus-private/nautilus-file-operations.c
+++ b/libnautilus-private/nautilus-file-operations.c
@@ -68,8 +68,6 @@
#include "nautilus-file-utilities.h"
#include "nautilus-file-conflict-dialog.h"
-static gboolean confirm_trash_auto_value;
-
/* TODO: TESTING!!! */
typedef struct {
@@ -1006,17 +1004,6 @@ should_skip_readdir_error (CommonJob *common,
return FALSE;
}
-static void
-setup_autos (void)
-{
- static gboolean setup_autos = FALSE;
- if (!setup_autos) {
- setup_autos = TRUE;
- eel_preferences_add_auto_boolean (NAUTILUS_PREFERENCES_CONFIRM_TRASH,
- &confirm_trash_auto_value);
- }
-}
-
static gboolean
can_delete_without_confirm (GFile *file)
{
@@ -1279,6 +1266,19 @@ job_aborted (CommonJob *job)
return g_cancellable_is_cancelled (job->cancellable);
}
+/* Since this happens on a thread we can't use the global prefs object */
+static gboolean
+should_confirm_trash (void)
+{
+ GSettings *prefs;
+ gboolean confirm_trash;
+
+ prefs = g_settings_new ("org.gnome.nautilus.preferences");
+ confirm_trash = g_settings_get_boolean (prefs, NAUTILUS_PREFERENCES_CONFIRM_TRASH);
+ g_object_unref (prefs);
+ return confirm_trash;
+}
+
static gboolean
confirm_delete_from_trash (CommonJob *job,
GList *files)
@@ -1288,7 +1288,7 @@ confirm_delete_from_trash (CommonJob *job,
int response;
/* Just Say Yes if the preference says not to confirm. */
- if (!confirm_trash_auto_value) {
+ if (!should_confirm_trash ()) {
return TRUE;
}
@@ -1325,7 +1325,7 @@ confirm_empty_trash (CommonJob *job)
int response;
/* Just Say Yes if the preference says not to confirm. */
- if (!confirm_trash_auto_value) {
+ if (!should_confirm_trash ()) {
return TRUE;
}
@@ -1353,7 +1353,7 @@ confirm_delete_directly (CommonJob *job,
int response;
/* Just Say Yes if the preference says not to confirm. */
- if (!confirm_trash_auto_value) {
+ if (!should_confirm_trash ()) {
return TRUE;
}
@@ -1945,8 +1945,6 @@ trash_or_delete_internal (GList *files,
{
DeleteJob *job;
- setup_autos ();
-
/* TODO: special case desktop icon link files ... */
job = op_job_new (DeleteJob, parent_window);
@@ -6168,9 +6166,7 @@ nautilus_file_operations_empty_trash (GtkWidget *parent_view)
if (parent_view) {
parent_window = (GtkWindow *)gtk_widget_get_ancestor (parent_view, GTK_TYPE_WINDOW);
}
-
- setup_autos ();
-
+
job = op_job_new (EmptyTrashJob, parent_window);
job->trash_dirs = g_list_prepend (job->trash_dirs,
g_file_new_for_uri ("trash:"));
diff --git a/libnautilus-private/nautilus-global-preferences.c b/libnautilus-private/nautilus-global-preferences.c
index ad1171ac3..30a7e27e2 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_CONFIRM_TRASH,
- PREFERENCE_BOOLEAN,
- GINT_TO_POINTER (TRUE)
- },
{ NAUTILUS_PREFERENCES_ENABLE_DELETE,
PREFERENCE_BOOLEAN,
GINT_TO_POINTER (FALSE)
diff --git a/libnautilus-private/nautilus-global-preferences.h b/libnautilus-private/nautilus-global-preferences.h
index 394df4f4c..95b4f3063 100644
--- a/libnautilus-private/nautilus-global-preferences.h
+++ b/libnautilus-private/nautilus-global-preferences.h
@@ -58,7 +58,7 @@ G_BEGIN_DECLS
#define NAUTILUS_PREFERENCES_MEDIA_AUTORUN_X_CONTENT_OPEN_FOLDER "autorun-x-content-open-folder"
/* Trash options */
-#define NAUTILUS_PREFERENCES_CONFIRM_TRASH "preferences/confirm_trash"
+#define NAUTILUS_PREFERENCES_CONFIRM_TRASH "confirm-trash"
#define NAUTILUS_PREFERENCES_ENABLE_DELETE "preferences/enable_delete"
/* Desktop options */
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index a6fe51ff1..187be9f75 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -152,7 +152,6 @@ static guint signals[LAST_SIGNAL];
static GdkAtom copied_files_atom;
static gboolean show_delete_command_auto_value;
-static gboolean confirm_trash_auto_value;
static char *scripts_directory_uri;
static int scripts_directory_uri_length;
@@ -1941,8 +1940,6 @@ fm_directory_view_init (FMDirectoryView *view)
if (!setup_autos) {
setup_autos = TRUE;
- eel_preferences_add_auto_boolean (NAUTILUS_PREFERENCES_CONFIRM_TRASH,
- &confirm_trash_auto_value);
eel_preferences_add_auto_boolean (NAUTILUS_PREFERENCES_ENABLE_DELETE,
&show_delete_command_auto_value);
}
@@ -1998,8 +1995,6 @@ fm_directory_view_init (FMDirectoryView *view)
gtk_widget_show (GTK_WIDGET (view));
- eel_preferences_add_callback (NAUTILUS_PREFERENCES_CONFIRM_TRASH,
- schedule_update_menus_callback, view);
eel_preferences_add_callback (NAUTILUS_PREFERENCES_ENABLE_DELETE,
schedule_update_menus_callback, view);
eel_preferences_add_callback (NAUTILUS_PREFERENCES_ICON_VIEW_CAPTIONS,
@@ -2114,8 +2109,6 @@ fm_directory_view_finalize (GObject *object)
view = FM_DIRECTORY_VIEW (object);
- eel_preferences_remove_callback (NAUTILUS_PREFERENCES_CONFIRM_TRASH,
- schedule_update_menus_callback, view);
eel_preferences_remove_callback (NAUTILUS_PREFERENCES_ENABLE_DELETE,
schedule_update_menus_callback, view);
eel_preferences_remove_callback (NAUTILUS_PREFERENCES_ICON_VIEW_CAPTIONS,
diff --git a/src/nautilus-file-management-properties.c b/src/nautilus-file-management-properties.c
index a3a66719a..d4299d402 100644
--- a/src/nautilus-file-management-properties.c
+++ b/src/nautilus-file-management-properties.c
@@ -667,6 +667,17 @@ nautilus_file_management_properties_dialog_setup_media_page (GtkBuilder *builder
nautilus_file_management_properties_dialog_update_media_sensitivity (builder);
}
+static void
+bind_builder_bool (GtkBuilder *builder,
+ GSettings *settings,
+ const char *widget_name,
+ const char *prefs)
+{
+ g_settings_bind (settings, prefs,
+ gtk_builder_get_object (builder, widget_name),
+ "active", G_SETTINGS_BIND_DEFAULT);
+}
+
static void
nautilus_file_management_properties_dialog_setup (GtkBuilder *builder, GtkWindow *window)
{
@@ -713,20 +724,16 @@ nautilus_file_management_properties_dialog_setup (GtkBuilder *builder, GtkWindow
NAUTILUS_FILE_MANAGEMENT_PROPERTIES_ALWAYS_USE_BROWSER_WIDGET,
NAUTILUS_PREFERENCES_ALWAYS_USE_BROWSER);
- g_settings_bind (nautilus_media_preferences,
- NAUTILUS_PREFERENCES_MEDIA_AUTOMOUNT_OPEN,
- gtk_builder_get_object (builder,
- NAUTILUS_FILE_MANAGEMENT_PROPERTIES_MEDIA_AUTOMOUNT_OPEN),
- "active", G_SETTINGS_BIND_DEFAULT);
- g_settings_bind (nautilus_media_preferences,
- NAUTILUS_PREFERENCES_MEDIA_AUTORUN_NEVER,
- gtk_builder_get_object (builder,
- NAUTILUS_FILE_MANAGEMENT_PROPERTIES_MEDIA_AUTORUN_NEVER),
- "active", G_SETTINGS_BIND_DEFAULT);
+ bind_builder_bool (builder, nautilus_media_preferences,
+ NAUTILUS_FILE_MANAGEMENT_PROPERTIES_MEDIA_AUTOMOUNT_OPEN,
+ NAUTILUS_PREFERENCES_MEDIA_AUTOMOUNT_OPEN);
+ bind_builder_bool (builder, nautilus_media_preferences,
+ NAUTILUS_FILE_MANAGEMENT_PROPERTIES_MEDIA_AUTORUN_NEVER,
+ NAUTILUS_PREFERENCES_MEDIA_AUTORUN_NEVER);
- eel_preferences_builder_connect_bool (builder,
- NAUTILUS_FILE_MANAGEMENT_PROPERTIES_TRASH_CONFIRM_WIDGET,
- NAUTILUS_PREFERENCES_CONFIRM_TRASH);
+ 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);