summaryrefslogtreecommitdiff
path: root/libcaja-private/caja-file-operations.c
diff options
context:
space:
mode:
Diffstat (limited to 'libcaja-private/caja-file-operations.c')
-rw-r--r--libcaja-private/caja-file-operations.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/libcaja-private/caja-file-operations.c b/libcaja-private/caja-file-operations.c
index 6fc9ba8c..f89e00cc 100644
--- a/libcaja-private/caja-file-operations.c
+++ b/libcaja-private/caja-file-operations.c
@@ -70,8 +70,6 @@
#include "caja-file-conflict-dialog.h"
#include "caja-undostack-manager.h"
-static gboolean confirm_trash_auto_value;
-
/* TODO: TESTING!!! */
typedef struct {
@@ -1018,17 +1016,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 (CAJA_PREFERENCES_CONFIRM_TRASH,
- &confirm_trash_auto_value);
- }
-}
-
static gboolean
can_delete_without_confirm (GFile *file)
{
@@ -1285,6 +1272,19 @@ abort_job (CommonJob *job)
}
+/* 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.mate.caja.preferences");
+ confirm_trash = g_settings_get_boolean (prefs, CAJA_PREFERENCES_CONFIRM_TRASH);
+ g_object_unref (prefs);
+ return confirm_trash;
+}
+
static gboolean
job_aborted (CommonJob *job)
{
@@ -1300,7 +1300,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;
}
@@ -1337,7 +1337,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;
}
@@ -1363,7 +1363,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;
}
@@ -1964,8 +1964,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);
@@ -6310,8 +6308,6 @@ caja_file_operations_empty_trash (GtkWidget *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:"));