summaryrefslogtreecommitdiff
path: root/src/file-manager
diff options
context:
space:
mode:
authorSargastic <[email protected]>2018-08-11 21:40:02 +0200
committerraveit65 <[email protected]>2018-12-27 13:11:09 +0100
commit58e987622a1d4ff137b9e5475880376dd60ac18b (patch)
tree9eefd32199ba49d8500074b2a087ebc009431ae7 /src/file-manager
parent040a897fe879e949f4e11be4b0d065486c677e97 (diff)
downloadcaja-58e987622a1d4ff137b9e5475880376dd60ac18b.tar.bz2
caja-58e987622a1d4ff137b9e5475880376dd60ac18b.tar.xz
Add independent show/hide backup files
Diffstat (limited to 'src/file-manager')
-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
3 files changed, 67 insertions, 4 deletions
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