summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcaja-private/caja-directory-async.c5
-rw-r--r--libcaja-private/caja-file-operations.c1
-rw-r--r--libcaja-private/caja-file-private.h2
-rw-r--r--libcaja-private/caja-file.c30
-rw-r--r--libcaja-private/caja-file.h3
-rw-r--r--libcaja-private/caja-global-preferences.h1
-rw-r--r--libcaja-private/caja-metadata.c1
-rw-r--r--libcaja-private/caja-metadata.h1
-rw-r--r--libcaja-private/caja-window-info.c28
-rw-r--r--libcaja-private/caja-window-info.h17
-rw-r--r--libcaja-private/org.mate.caja.gschema.xml8
-rw-r--r--src/caja-actions.h1
-rw-r--r--src/caja-file-management-properties.c4
-rw-r--r--src/caja-file-management-properties.ui17
-rw-r--r--src/caja-window-menus.c67
-rw-r--r--src/caja-window-private.h1
-rw-r--r--src/caja-window.c19
-rw-r--r--src/file-manager/caja-directory-view-ui.xml1
-rw-r--r--src/file-manager/fm-directory-view.c63
-rw-r--r--src/file-manager/fm-tree-model.c7
20 files changed, 256 insertions, 21 deletions
diff --git a/libcaja-private/caja-directory-async.c b/libcaja-private/caja-directory-async.c
index 069f5523..e3513cc8 100644
--- a/libcaja-private/caja-directory-async.c
+++ b/libcaja-private/caja-directory-async.c
@@ -904,7 +904,7 @@ static gboolean
should_skip_file (CajaDirectory *directory, GFileInfo *info)
{
static gboolean show_hidden_files_changed_callback_installed = FALSE;
-
+
/* Add the callback once for the life of our process */
if (!show_hidden_files_changed_callback_installed)
{
@@ -2457,7 +2457,8 @@ monitor_includes_file (const Monitor *monitor,
}
return caja_file_should_show (file,
monitor->monitor_hidden_files,
- TRUE);
+ TRUE,
+ FALSE);
}
static gboolean
diff --git a/libcaja-private/caja-file-operations.c b/libcaja-private/caja-file-operations.c
index 41e4f129..51481db0 100644
--- a/libcaja-private/caja-file-operations.c
+++ b/libcaja-private/caja-file-operations.c
@@ -1032,6 +1032,7 @@ should_skip_file (CommonJob *common,
if (common->skip_files != NULL) {
return g_hash_table_lookup (common->skip_files, file) != NULL;
}
+
return FALSE;
}
diff --git a/libcaja-private/caja-file-private.h b/libcaja-private/caja-file-private.h
index 71beac72..1130862a 100644
--- a/libcaja-private/caja-file-private.h
+++ b/libcaja-private/caja-file-private.h
@@ -208,7 +208,7 @@ struct CajaFileDetails
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;
eel_boolean_bit can_read : 1;
diff --git a/libcaja-private/caja-file.c b/libcaja-private/caja-file.c
index 0d13ff5f..74cbe988 100644
--- a/libcaja-private/caja-file.c
+++ b/libcaja-private/caja-file.c
@@ -105,6 +105,7 @@
typedef enum {
SHOW_HIDDEN = 1 << 0,
+ SHOW_BACKUP = 1 << 1,
} FilterOptions;
typedef void (* ModifyListFunction) (GList **list, CajaFile *file);
@@ -2094,7 +2095,7 @@ update_info_internal (CajaFile *file,
{
GList *node;
gboolean changed;
- gboolean is_symlink, is_hidden, is_mountpoint;
+ gboolean is_symlink, is_hidden, is_backup, 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;
@@ -2185,12 +2186,15 @@ update_info_internal (CajaFile *file,
}
file->details->is_symlink = is_symlink;
- is_hidden = g_file_info_get_is_hidden (info) || g_file_info_get_is_backup (info);
- if (file->details->is_hidden != is_hidden) {
+ is_hidden = g_file_info_get_is_hidden (info);
+ is_backup = g_file_info_get_is_backup (info);
+ if (file->details->is_hidden != is_hidden ||
+ file->details->is_backup != is_backup) {
changed = TRUE;
}
file->details->is_hidden = is_hidden;
-
+ 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;
@@ -3627,6 +3631,7 @@ caja_file_is_hidden_file (CajaFile *file)
* caja_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 #CajaFile should be shown. Note that when browsing
* a trash directory, this function will always return %TRUE.
@@ -3635,14 +3640,16 @@ caja_file_is_hidden_file (CajaFile *file)
*/
gboolean
caja_file_should_show (CajaFile *file,
- gboolean show_hidden,
- gboolean show_foreign)
+ gboolean show_hidden,
+ gboolean show_foreign,
+ gboolean show_backup)
{
/* Never hide any files in trash. */
if (caja_file_is_in_trash (file)) {
return TRUE;
} else {
return (show_hidden || !caja_file_is_hidden_file (file)) &&
+ (show_backup || !caja_file_is_backup_file (file)) &&
(show_foreign || !(caja_file_is_in_desktop (file) && caja_file_is_foreign_link (file)));
}
}
@@ -3671,6 +3678,12 @@ caja_file_is_in_desktop (CajaFile *file)
}
+gboolean
+caja_file_is_backup_file (CajaFile *file)
+{
+ return file->details->is_backup;
+}
+
static gboolean
filter_hidden_partition_callback (gpointer data,
gpointer callback_data)
@@ -3682,8 +3695,9 @@ filter_hidden_partition_callback (gpointer data,
options = GPOINTER_TO_INT (callback_data);
return caja_file_should_show (file,
- options & SHOW_HIDDEN,
- TRUE);
+ options & SHOW_HIDDEN,
+ TRUE,
+ options & SHOW_BACKUP);
}
GList *
diff --git a/libcaja-private/caja-file.h b/libcaja-private/caja-file.h
index 949c77e9..9d5a1f62 100644
--- a/libcaja-private/caja-file.h
+++ b/libcaja-private/caja-file.h
@@ -429,7 +429,8 @@ int caja_file_compare_location (CajaFile
gboolean caja_file_is_hidden_file (CajaFile *file);
gboolean caja_file_should_show (CajaFile *file,
gboolean show_hidden,
- gboolean show_foreign);
+ gboolean show_foreign,
+ gboolean show_backup);
GList *caja_file_list_filter_hidden (GList *files,
gboolean show_hidden);
diff --git a/libcaja-private/caja-global-preferences.h b/libcaja-private/caja-global-preferences.h
index 7a0da287..d3e4b7ce 100644
--- a/libcaja-private/caja-global-preferences.h
+++ b/libcaja-private/caja-global-preferences.h
@@ -64,6 +64,7 @@ G_BEGIN_DECLS
/* Display */
#define CAJA_PREFERENCES_SHOW_HIDDEN_FILES "show-hidden-files"
+#define CAJA_PREFERENCES_SHOW_BACKUP_FILES "show-backup-files"
#define CAJA_PREFERENCES_SHOW_ADVANCED_PERMISSIONS "show-advanced-permissions"
#define CAJA_PREFERENCES_DATE_FORMAT "date-format"
#define CAJA_PREFERENCES_USE_IEC_UNITS "use-iec-units"
diff --git a/libcaja-private/caja-metadata.c b/libcaja-private/caja-metadata.c
index b4a315c8..2b12962f 100644
--- a/libcaja-private/caja-metadata.c
+++ b/libcaja-private/caja-metadata.c
@@ -45,6 +45,7 @@ static char *used_metadata_names[] =
CAJA_METADATA_KEY_WINDOW_GEOMETRY,
CAJA_METADATA_KEY_WINDOW_SCROLL_POSITION,
CAJA_METADATA_KEY_WINDOW_SHOW_HIDDEN_FILES,
+ CAJA_METADATA_KEY_WINDOW_SHOW_BACKUP_FILES,
CAJA_METADATA_KEY_WINDOW_MAXIMIZED,
CAJA_METADATA_KEY_WINDOW_STICKY,
CAJA_METADATA_KEY_WINDOW_KEEP_ABOVE,
diff --git a/libcaja-private/caja-metadata.h b/libcaja-private/caja-metadata.h
index 02384c60..72eb4789 100644
--- a/libcaja-private/caja-metadata.h
+++ b/libcaja-private/caja-metadata.h
@@ -58,6 +58,7 @@
#define CAJA_METADATA_KEY_WINDOW_GEOMETRY "caja-window-geometry"
#define CAJA_METADATA_KEY_WINDOW_SCROLL_POSITION "caja-window-scroll-position"
#define CAJA_METADATA_KEY_WINDOW_SHOW_HIDDEN_FILES "caja-window-show-hidden-files"
+#define CAJA_METADATA_KEY_WINDOW_SHOW_BACKUP_FILES "caja-window-show-backup-files"
#define CAJA_METADATA_KEY_WINDOW_MAXIMIZED "caja-window-maximized"
#define CAJA_METADATA_KEY_WINDOW_STICKY "caja-window-sticky"
#define CAJA_METADATA_KEY_WINDOW_KEEP_ABOVE "caja-window-keep-above"
diff --git a/libcaja-private/caja-window-info.c b/libcaja-private/caja-window-info.c
index f55e6803..cce05f7d 100644
--- a/libcaja-private/caja-window-info.c
+++ b/libcaja-private/caja-window-info.c
@@ -31,6 +31,7 @@ enum
SELECTION_CHANGED,
TITLE_CHANGED,
HIDDEN_FILES_MODE_CHANGED,
+ BACKUP_FILES_MODE_CHANGED,
LAST_SIGNAL
};
@@ -81,6 +82,15 @@ caja_window_info_base_init (gpointer g_class)
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
+ caja_window_info_signals[BACKUP_FILES_MODE_CHANGED] =
+ g_signal_new ("backup_files_mode_changed",
+ CAJA_TYPE_WINDOW_INFO,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (CajaWindowInfoIface, backup_files_mode_changed),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
initialized = TRUE;
}
}
@@ -248,6 +258,24 @@ caja_window_info_set_hidden_files_mode (CajaWindowInfo *window,
mode);
}
+CajaWindowShowBackupFilesMode
+caja_window_info_get_backup_files_mode (CajaWindowInfo *window)
+{
+ g_return_val_if_fail (CAJA_IS_WINDOW_INFO (window), CAJA_WINDOW_SHOW_BACKUP_FILES_DEFAULT);
+
+ return (* CAJA_WINDOW_INFO_GET_IFACE (window)->get_backup_files_mode) (window);
+}
+
+void
+caja_window_info_set_backup_files_mode (CajaWindowInfo *window,
+ CajaWindowShowBackupFilesMode mode)
+{
+ g_return_if_fail (CAJA_IS_WINDOW_INFO (window));
+
+ (* CAJA_WINDOW_INFO_GET_IFACE (window)->set_backup_files_mode) (window,
+ mode);
+}
+
GtkUIManager *
caja_window_info_get_ui_manager (CajaWindowInfo *window)
{
diff --git a/libcaja-private/caja-window-info.h b/libcaja-private/caja-window-info.h
index 7cced147..20ecc414 100644
--- a/libcaja-private/caja-window-info.h
+++ b/libcaja-private/caja-window-info.h
@@ -41,6 +41,13 @@ extern "C" {
}
CajaWindowShowHiddenFilesMode;
+ typedef enum
+ {
+ CAJA_WINDOW_SHOW_BACKUP_FILES_DEFAULT,
+ CAJA_WINDOW_SHOW_BACKUP_FILES_ENABLE,
+ CAJA_WINDOW_SHOW_BACKUP_FILES_DISABLE
+ }
+ CajaWindowShowBackupFilesMode;
typedef enum
{
@@ -105,6 +112,7 @@ extern "C" {
void (* title_changed) (CajaWindowInfo *window,
const char *title);
void (* hidden_files_mode_changed)(CajaWindowInfo *window);
+ void (* backup_files_mode_changed)(CajaWindowInfo *window);
/* VTable: */
/* A view calls this once after a load_location, once it starts loading the
@@ -142,7 +150,11 @@ extern "C" {
(* get_hidden_files_mode) (CajaWindowInfo *window);
void (* set_hidden_files_mode) (CajaWindowInfo *window,
CajaWindowShowHiddenFilesMode mode);
-
+ CajaWindowShowBackupFilesMode
+ (* get_backup_files_mode) (CajaWindowInfo *window);
+ void (* set_backup_files_mode) (CajaWindowInfo *window,
+ CajaWindowShowBackupFilesMode mode);
+
CajaWindowSlotInfo * (* get_active_slot) (CajaWindowInfo *window);
CajaWindowSlotInfo * (* get_extra_slot) (CajaWindowInfo *window);
@@ -180,6 +192,9 @@ extern "C" {
CajaWindowShowHiddenFilesMode caja_window_info_get_hidden_files_mode (CajaWindowInfo *window);
void caja_window_info_set_hidden_files_mode (CajaWindowInfo *window,
CajaWindowShowHiddenFilesMode mode);
+ void caja_window_info_set_backup_files_mode (CajaWindowInfo *window,
+ CajaWindowShowBackupFilesMode mode);
+
gboolean caja_window_info_get_initiated_unmount (CajaWindowInfo *window);
void caja_window_info_set_initiated_unmount (CajaWindowInfo *window,
gboolean initiated_unmount);
diff --git a/libcaja-private/org.mate.caja.gschema.xml b/libcaja-private/org.mate.caja.gschema.xml
index 8555d5f7..34ae2e5a 100644
--- a/libcaja-private/org.mate.caja.gschema.xml
+++ b/libcaja-private/org.mate.caja.gschema.xml
@@ -246,8 +246,14 @@
<key name="show-hidden-files" type="b">
<default>false</default>
<summary>Whether to show hidden files</summary>
- <description>If set to true, then hidden files are shown by default in the file manager. Hidden files are either dotfiles, listed in the folder's .hidden file or backup files ending with a tilde (~).</description>
+ <description>If set to true, then hidden files are shown by default in the file manager. Hidden files are either dotfiles or listed in the folder's .hidden file.</description>
</key>
+ <key name="show-backup-files" type="b">
+ <default>false</default>
+ <summary>Whether to show backup files</summary>
+ <description>If set to true, then backup files are shown by default in the file manager. Backup files are either backup files ending with a tilde (~).</description>
+ </key>
+
<key name="use-iec-units" type="b">
<default>false</default>
<summary>Whether to show file sizes with IEC units</summary>
diff --git a/src/caja-actions.h b/src/caja-actions.h
index c8a0dffd..75fbd72c 100644
--- a/src/caja-actions.h
+++ b/src/caja-actions.h
@@ -47,6 +47,7 @@
#define CAJA_ACTION_ZOOM_OUT "Zoom Out"
#define CAJA_ACTION_ZOOM_NORMAL "Zoom Normal"
#define CAJA_ACTION_SHOW_HIDDEN_FILES "Show Hidden Files"
+#define CAJA_ACTION_SHOW_BACKUP_FILES "Show Backup Files"
#define CAJA_ACTION_CLOSE "Close"
#define CAJA_ACTION_SEARCH "Search"
#define CAJA_ACTION_FOLDER_WINDOW "Folder Window"
diff --git a/src/caja-file-management-properties.c b/src/caja-file-management-properties.c
index 29039add..7f540707 100644
--- a/src/caja-file-management-properties.c
+++ b/src/caja-file-management-properties.c
@@ -68,6 +68,7 @@
#define CAJA_FILE_MANAGEMENT_PROPERTIES_TRASH_CONFIRM_TRASH_WIDGET "trash_confirm_trash_checkbutton"
#define CAJA_FILE_MANAGEMENT_PROPERTIES_TRASH_DELETE_WIDGET "trash_delete_checkbutton"
#define CAJA_FILE_MANAGEMENT_PROPERTIES_SHOW_HIDDEN_WIDGET "hidden_files_checkbutton"
+#define CAJA_FILE_MANAGEMENT_PROPERTIES_SHOW_BACKUP_WIDGET "backup_files_checkbutton"
#define CAJA_FILE_MANAGEMENT_PROPERTIES_TREE_VIEW_FOLDERS_WIDGET "treeview_folders_checkbutton"
#define CAJA_FILE_MANAGEMENT_PROPERTIES_MEDIA_AUTOMOUNT_OPEN "media_automount_open_checkbutton"
#define CAJA_FILE_MANAGEMENT_PROPERTIES_MEDIA_AUTORUN_NEVER "media_autorun_never_checkbutton"
@@ -1178,6 +1179,9 @@ caja_file_management_properties_dialog_setup (GtkBuilder *builder, GtkWindow *wi
bind_builder_bool (builder, caja_preferences,
CAJA_FILE_MANAGEMENT_PROPERTIES_SHOW_HIDDEN_WIDGET,
CAJA_PREFERENCES_SHOW_HIDDEN_FILES);
+ bind_builder_bool (builder, caja_preferences,
+ CAJA_FILE_MANAGEMENT_PROPERTIES_SHOW_BACKUP_WIDGET,
+ CAJA_PREFERENCES_SHOW_BACKUP_FILES);
bind_builder_bool (builder, caja_tree_sidebar_preferences,
CAJA_FILE_MANAGEMENT_PROPERTIES_TREE_VIEW_FOLDERS_WIDGET,
CAJA_PREFERENCES_TREE_SHOW_ONLY_DIRECTORIES);
diff --git a/src/caja-file-management-properties.ui b/src/caja-file-management-properties.ui
index 20d36c08..77fdd7ee 100644
--- a/src/caja-file-management-properties.ui
+++ b/src/caja-file-management-properties.ui
@@ -490,7 +490,7 @@
</child>
<child>
<object class="GtkCheckButton" id="hidden_files_checkbutton">
- <property name="label" translatable="yes">Show hidden and _backup files</property>
+ <property name="label" translatable="yes">Show hidden files</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -503,6 +503,21 @@
<property name="position">3</property>
</packing>
</child>
+ <child>
+ <object class="GtkCheckButton" id="backup_files_checkbutton">
+ <property name="label" translatable="yes">Show backup files</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
</object>
</child>
</object>
diff --git a/src/caja-window-menus.c b/src/caja-window-menus.c
index 66012627..d1b65df9 100644
--- a/src/caja-window-menus.c
+++ b/src/caja-window-menus.c
@@ -405,6 +405,27 @@ action_show_hidden_files_callback (GtkAction *action,
}
static void
+action_show_backup_files_callback (GtkAction *action,
+ gpointer callback_data)
+{
+ CajaWindow *window;
+ CajaWindowShowBackupFilesMode mode;
+
+ window = CAJA_WINDOW (callback_data);
+
+ if (gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)))
+ {
+ mode = CAJA_WINDOW_SHOW_BACKUP_FILES_ENABLE;
+ }
+ else
+ {
+ mode = CAJA_WINDOW_SHOW_BACKUP_FILES_DISABLE;
+ }
+
+ caja_window_info_set_backup_files_mode (window, mode);
+}
+
+static void
show_hidden_files_preference_callback (gpointer callback_data)
{
CajaWindow *window;
@@ -430,6 +451,30 @@ show_hidden_files_preference_callback (gpointer callback_data)
}
static void
+show_backup_files_preference_callback (gpointer callback_data)
+{
+ CajaWindow *window;
+ GtkAction *action;
+
+ window = CAJA_WINDOW (callback_data);
+
+ if (window->details->show_backup_files_mode == CAJA_WINDOW_SHOW_BACKUP_FILES_DEFAULT)
+ {
+ action = gtk_action_group_get_action (window->details->main_action_group, CAJA_ACTION_SHOW_BACKUP_FILES);
+ g_assert (GTK_IS_ACTION (action));
+
+ /* update button */
+ g_signal_handlers_block_by_func (action, action_show_backup_files_callback, window);
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
+ g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_SHOW_BACKUP_FILES));
+ g_signal_handlers_unblock_by_func (action, action_show_backup_files_callback, window);
+
+ /* inform views */
+ caja_window_info_set_backup_files_mode (window, CAJA_WINDOW_SHOW_BACKUP_FILES_DEFAULT);
+ }
+}
+
+static void
preferences_respond_callback (GtkDialog *dialog,
gint response_id)
{
@@ -922,6 +967,13 @@ static const GtkToggleActionEntry main_toggle_entries[] =
G_CALLBACK (action_show_hidden_files_callback),
TRUE
},
+ /* name, stock id */ { "Show Backup Files", NULL,
+ /* label, accelerator */ N_("Show _Backup Files"), NULL,
+ /* tooltip */ N_("Toggle the display of backup files in the current window"),
+ G_CALLBACK (action_show_backup_files_callback),
+ TRUE
+ },
+
};
/**
@@ -959,12 +1011,20 @@ caja_window_initialize_menus (CajaWindow *window)
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_SHOW_HIDDEN_FILES));
g_signal_handlers_unblock_by_func (action, action_show_hidden_files_callback, window);
-
-
g_signal_connect_swapped (caja_preferences, "changed::" CAJA_PREFERENCES_SHOW_HIDDEN_FILES,
G_CALLBACK(show_hidden_files_preference_callback),
window);
+ action = gtk_action_group_get_action (action_group, CAJA_ACTION_SHOW_BACKUP_FILES);
+ g_signal_handlers_block_by_func (action, action_show_backup_files_callback, window);
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action),
+ g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_SHOW_BACKUP_FILES));
+ g_signal_handlers_unblock_by_func (action, action_show_backup_files_callback, window);
+
+ g_signal_connect_swapped (caja_preferences, "changed::" CAJA_PREFERENCES_SHOW_BACKUP_FILES,
+ G_CALLBACK(show_backup_files_preference_callback),
+ window);
+
window->details->ui_manager = gtk_ui_manager_new ();
ui_manager = window->details->ui_manager;
gtk_window_add_accel_group (GTK_WINDOW (window),
@@ -996,6 +1056,9 @@ caja_window_finalize_menus (CajaWindow *window)
g_signal_handlers_disconnect_by_func (caja_preferences,
show_hidden_files_preference_callback, window);
+
+ g_signal_handlers_disconnect_by_func (caja_preferences,
+ show_backup_files_preference_callback, window);
}
static GList *
diff --git a/src/caja-window-private.h b/src/caja-window-private.h
index 7afcb497..f02e73c8 100644
--- a/src/caja-window-private.h
+++ b/src/caja-window-private.h
@@ -60,6 +60,7 @@ struct CajaWindowDetails
CajaBookmarkList *bookmark_list;
CajaWindowShowHiddenFilesMode show_hidden_files_mode;
+ CajaWindowShowBackupFilesMode show_backup_files_mode;
/* View As menu */
GList *short_list_viewers;
diff --git a/src/caja-window.c b/src/caja-window.c
index 52676dd5..a0c1d06a 100644
--- a/src/caja-window.c
+++ b/src/caja-window.c
@@ -1975,6 +1975,21 @@ caja_window_set_hidden_files_mode (CajaWindowInfo *window,
g_signal_emit_by_name (window, "hidden_files_mode_changed");
}
+static CajaWindowShowBackupFilesMode
+caja_window_get_backup_files_mode (CajaWindowInfo *window)
+{
+ return window->details->show_backup_files_mode;
+}
+
+static void
+caja_window_set_backup_files_mode (CajaWindowInfo *window,
+ CajaWindowShowBackupFilesMode mode)
+{
+ window->details->show_backup_files_mode = mode;
+
+ g_signal_emit_by_name (window, "backup_files_mode_changed");
+}
+
static gboolean
caja_window_get_initiated_unmount (CajaWindowInfo *window)
{
@@ -2076,6 +2091,10 @@ caja_window_info_iface_init (CajaWindowInfoIface *iface)
iface->get_selection = caja_window_get_selection;
iface->get_hidden_files_mode = caja_window_get_hidden_files_mode;
iface->set_hidden_files_mode = caja_window_set_hidden_files_mode;
+
+ iface->get_backup_files_mode = caja_window_get_backup_files_mode;
+ iface->set_backup_files_mode = caja_window_set_backup_files_mode;
+
iface->get_active_slot = caja_window_get_active_slot;
iface->get_extra_slot = caja_window_get_extra_slot;
iface->get_initiated_unmount = caja_window_get_initiated_unmount;
diff --git a/src/file-manager/caja-directory-view-ui.xml b/src/file-manager/caja-directory-view-ui.xml
index 4e926fa0..4eba3e63 100644
--- a/src/file-manager/caja-directory-view-ui.xml
+++ b/src/file-manager/caja-directory-view-ui.xml
@@ -93,6 +93,7 @@
<placeholder name="View Preferences Placeholder">
<menuitem name="Reset to Defaults" action="Reset to Defaults"/>
<menuitem name="Show Hidden Files" action="Show Hidden Files"/>
+ <menuitem name="Show Backup Files" action="Show Backup Files"/>
</placeholder>
</menu>
</menubar>
diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c
index 90a0d594..65a0976b 100644
--- a/src/file-manager/fm-directory-view.c
+++ b/src/file-manager/fm-directory-view.c
@@ -237,6 +237,8 @@ struct FMDirectoryViewDetails
gboolean show_foreign_files;
gboolean show_hidden_files;
gboolean ignore_hidden_file_preferences;
+
+ gboolean show_backup_files;
gboolean batching_selection_level;
gboolean selection_changed_while_batched;
@@ -291,6 +293,7 @@ static void load_directory (FMDirectoryView
static void fm_directory_view_merge_menus (FMDirectoryView *view);
static void fm_directory_view_unmerge_menus (FMDirectoryView *view);
static void fm_directory_view_init_show_hidden_files (FMDirectoryView *view);
+static void fm_directory_view_init_show_backup_files (FMDirectoryView *view);
static void fm_directory_view_load_location (CajaView *caja_view,
const char *location);
static void fm_directory_view_stop_loading (CajaView *caja_view);
@@ -1292,6 +1295,17 @@ hidden_files_mode_changed (CajaWindow *window,
}
static void
+backup_files_mode_changed (CajaWindow *window,
+ gpointer callback_data)
+{
+ FMDirectoryView *directory_view;
+
+ directory_view = FM_DIRECTORY_VIEW (callback_data);
+
+ fm_directory_view_init_show_backup_files (directory_view);
+}
+
+static void
action_save_search_callback (GtkAction *action,
gpointer callback_data)
{
@@ -7266,6 +7280,44 @@ fm_directory_view_init_show_hidden_files (FMDirectoryView *view)
}
+static void
+fm_directory_view_init_show_backup_files (FMDirectoryView *view)
+{
+ CajaWindowShowBackupFilesMode mode;
+ gboolean show_backup_changed;
+ gboolean show_backup_default_setting;
+
+ /*
+ if (view->details->ignore_hidden_file_preferences) {
+ return;
+ }
+ */
+
+ show_backup_changed = FALSE;
+ mode = caja_window_info_get_backup_files_mode (view->details->window);
+
+ if (mode == CAJA_WINDOW_SHOW_BACKUP_FILES_DEFAULT) {
+ show_backup_default_setting = g_settings_get_boolean (caja_preferences, CAJA_PREFERENCES_SHOW_BACKUP_FILES);
+ if (show_backup_default_setting != view->details->show_backup_files) {
+ view->details->show_backup_files = show_backup_default_setting;
+ show_backup_changed = TRUE;
+ }
+ } else {
+ if (mode == CAJA_WINDOW_SHOW_BACKUP_FILES_ENABLE) {
+ show_backup_changed = !view->details->show_backup_files;
+ view->details->show_backup_files = TRUE;
+ } else {
+ show_backup_changed = view->details->show_backup_files;
+ view->details->show_backup_files = FALSE;
+ }
+ }
+
+ if (show_backup_changed && (view->details->model != NULL)) {
+ load_directory (view, view->details->model);
+ }
+
+}
+
static const GtkActionEntry directory_view_entries[] = {
/* name, icon name, label */ { "New Documents", "document-new", N_("Create _Document") },
/* name, icon name, label */ { "Open With", NULL, N_("Open Wit_h"),
@@ -9974,8 +10026,9 @@ gboolean
fm_directory_view_should_show_file (FMDirectoryView *view, CajaFile *file)
{
return caja_file_should_show (file,
- view->details->show_hidden_files,
- view->details->show_foreign_files);
+ view->details->show_hidden_files,
+ view->details->show_foreign_files,
+ view->details->show_backup_files);
}
static gboolean
@@ -10801,6 +10854,12 @@ fm_directory_view_set_property (GObject *object,
"hidden-files-mode-changed", G_CALLBACK (hidden_files_mode_changed),
directory_view, 0);
fm_directory_view_init_show_hidden_files (directory_view);
+
+ g_signal_connect_object (directory_view->details->window,
+ "backup-files-mode-changed", G_CALLBACK (backup_files_mode_changed),
+ directory_view, 0);
+ fm_directory_view_init_show_backup_files (directory_view);
+
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
diff --git a/src/file-manager/fm-tree-model.c b/src/file-manager/fm-tree-model.c
index fd9bf074..3ca02fd7 100644
--- a/src/file-manager/fm-tree-model.c
+++ b/src/file-manager/fm-tree-model.c
@@ -100,8 +100,9 @@ struct FMTreeModelDetails
guint monitoring_update_idle_id;
gboolean show_hidden_files;
+ gboolean show_backup_files;
gboolean show_only_directories;
-
+
GList *highlighted_files;
};
@@ -956,7 +957,9 @@ should_show_file (FMTreeModel *model, CajaFile *file)
should = caja_file_should_show (file,
model->details->show_hidden_files,
- TRUE);
+ /* TODO details->show_backup_files */
+ TRUE,
+ model->details->show_backup_files);
if (should
&& model->details->show_only_directories