[gnome-commander] Filter file list based on gio and not on gnome-vfs anymore



commit 8bea5ca18a4ade218b7f8c31cffb64eec61b7a97
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Sun Jan 17 21:39:19 2021 +0100

    Filter file list based on gio and not on gnome-vfs anymore

 data/org.gnome.gnome-commander.gschema.xml |  26 +++---
 src/dialogs/gnome-cmd-options-dialog.cc    |  75 +++++++++--------
 src/gnome-cmd-data.cc                      | 131 ++++++++++++++++-------------
 src/gnome-cmd-data.h                       |  37 +++++---
 src/gnome-cmd-file-list.cc                 |  58 ++++++++++---
 src/gnome-cmd-main-menu.cc                 |   4 +-
 src/gnome-cmd-main-win.cc                  |   3 +-
 src/gnome-cmd-user-actions.cc              |   4 +-
 8 files changed, 204 insertions(+), 134 deletions(-)
---
diff --git a/data/org.gnome.gnome-commander.gschema.xml b/data/org.gnome.gnome-commander.gschema.xml
index 7dd82557..8187fc2b 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -629,31 +629,35 @@
       <default>false</default>
       <summary>Hide directories</summary>
     </key>
-    <key name="hide-fifo" type="b">
+    <key name="hide-symlink" type="b">
       <default>false</default>
-      <summary>Hide FIFO pipes</summary>
+      <summary>Hide symbolic links</summary>
     </key>
-    <key name="hide-socket" type="b">
+    <key name="hide-special" type="b">
       <default>false</default>
-      <summary>Hide sockets</summary>
+      <summary>Hide special files, such as a socket, fifo, block devices, or character devices.</summary>
     </key>
-    <key name="hide-char-device" type="b">
+    <key name="hide-shortcut" type="b">
       <default>false</default>
-      <summary>Hide character devices</summary>
+      <summary>Hide shortcut files (Windows systems)</summary>
     </key>
-    <key name="hide-block-device" type="b">
+    <key name="hide-mountable" type="b">
       <default>false</default>
-      <summary>Hide block devices</summary>
+      <summary>Hide mountable locations</summary>
     </key>
-    <key name="hide-symbolic-link" type="b">
+    <key name="hide-virtual" type="b">
       <default>false</default>
-      <summary>Hide symbolic links</summary>
+      <summary>Hide virtual files</summary>
+    </key>
+    <key name="hide-volatile" type="b">
+      <default>false</default>
+      <summary>Hide volatile files</summary>
     </key>
     <key name="hide-dotfile" type="b">
       <default>true</default>
       <summary>Hide files and folders starting with a dot</summary>
     </key>
-    <key name="hide-backup-files" type="b">
+    <key name="hide-backupfiles" type="b">
       <default>true</default>
       <summary>Hide backup files</summary>
       <description>Hide all files with a suffix defined as the backup pattern.</description>
diff --git a/src/dialogs/gnome-cmd-options-dialog.cc b/src/dialogs/gnome-cmd-options-dialog.cc
index 42f2c6c0..7c82e3ec 100644
--- a/src/dialogs/gnome-cmd-options-dialog.cc
+++ b/src/dialogs/gnome-cmd-options-dialog.cc
@@ -1183,26 +1183,28 @@ GtkWidget *create_filter_tab (GtkWidget *parent, GnomeCmdData::Options &cfg)
 
     check = create_check (parent, _("Unknown"), "hide_unknown_check");
     gtk_container_add (GTK_CONTAINER (cat_box), check);
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), 
cfg.filter.file_types[GNOME_VFS_FILE_TYPE_UNKNOWN]);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), 
cfg.filter.file_types[GnomeCmdData::G_FILE_IS_UNKNOWN]);
     check = create_check (parent, _("Regular files"), "hide_regular_check");
     gtk_container_add (GTK_CONTAINER (cat_box), check);
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), 
cfg.filter.file_types[GNOME_VFS_FILE_TYPE_REGULAR]);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), 
cfg.filter.file_types[GnomeCmdData::G_FILE_IS_REGULAR]);
     check = create_check (parent, _("Directories"), "hide_directory_check");
     gtk_container_add (GTK_CONTAINER (cat_box), check);
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), 
cfg.filter.file_types[GNOME_VFS_FILE_TYPE_DIRECTORY]);
-    check = create_check (parent, _("Fifo files"), "hide_fifo_check");
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), 
cfg.filter.file_types[GnomeCmdData::G_FILE_IS_DIR]);
+    check = create_check (parent, _("Socket, fifo, block, or character devices"), "hide_special_check");
     gtk_container_add (GTK_CONTAINER (cat_box), check);
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), 
cfg.filter.file_types[GNOME_VFS_FILE_TYPE_FIFO]);
-    check = create_check (parent, _("Socket files"), "hide_socket_check");
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), 
cfg.filter.file_types[GnomeCmdData::G_FILE_IS_SPECIAL]);
+    check = create_check (parent, _("Shortcuts (Windows systems)"), "hide_shortcut_check");
     gtk_container_add (GTK_CONTAINER (cat_box), check);
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), 
cfg.filter.file_types[GNOME_VFS_FILE_TYPE_SOCKET]);
-    check = create_check (parent, _("Character devices"), "hide_char_check");
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), 
cfg.filter.file_types[GnomeCmdData::G_FILE_IS_SHORTCUT]);
+    check = create_check (parent, _("Mountable locations"), "hide_mountable_check");
     gtk_container_add (GTK_CONTAINER (cat_box), check);
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), 
cfg.filter.file_types[GNOME_VFS_FILE_TYPE_CHARACTER_DEVICE]);
-    check = create_check (parent, _("Block devices"), "hide_block_check");
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), 
cfg.filter.file_types[GnomeCmdData::G_FILE_IS_MOUNTABLE]);
+    check = create_check (parent, _("Virtual files"), "hide_virtual_check");
     gtk_container_add (GTK_CONTAINER (cat_box), check);
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), 
cfg.filter.file_types[GNOME_VFS_FILE_TYPE_BLOCK_DEVICE]);
-
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), 
cfg.filter.file_types[GnomeCmdData::G_FILE_IS_VIRTUAL]);
+    check = create_check (parent, _("Volatile files"), "hide_volatile_check");
+    gtk_container_add (GTK_CONTAINER (cat_box), check);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), 
cfg.filter.file_types[GnomeCmdData::G_FILE_IS_VOLATILE]);
 
     cat_box = create_vbox (parent, FALSE, 0);
     cat = create_category (parent, cat_box, _("Also hide"));
@@ -1210,13 +1212,13 @@ GtkWidget *create_filter_tab (GtkWidget *parent, GnomeCmdData::Options &cfg)
 
     check = create_check (parent, _("Hidden files"), "hide_hidden_check");
     gtk_container_add (GTK_CONTAINER (cat_box), check);
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), cfg.filter.hidden);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), 
cfg.filter.file_types[GnomeCmdData::G_FILE_IS_HIDDEN]);
     backup_check = create_check (parent, _("Backup files"), "hide_backup_check");
     gtk_container_add (GTK_CONTAINER (cat_box), backup_check);
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (backup_check), cfg.filter.backup);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (backup_check), 
cfg.filter.file_types[GnomeCmdData::G_FILE_IS_BACKUP]);
     check = create_check (parent, _("Symlinks"), "hide_symlink_check");
     gtk_container_add (GTK_CONTAINER (cat_box), check);
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), 
cfg.filter.file_types[GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK]);
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), 
cfg.filter.file_types[GnomeCmdData::G_FILE_IS_SYMLINK]);
 
 
     cat_box = create_vbox (parent, FALSE, 0);
@@ -1225,7 +1227,7 @@ GtkWidget *create_filter_tab (GtkWidget *parent, GnomeCmdData::Options &cfg)
 
     entry = create_entry (parent, "backup_pattern_entry", cfg.backup_pattern);
     gtk_box_pack_start (GTK_BOX (cat_box), entry, TRUE, FALSE, 0);
-    gtk_widget_set_sensitive (entry, cfg.filter.backup);
+    gtk_widget_set_sensitive (entry, cfg.filter.file_types[GnomeCmdData::G_FILE_IS_BACKUP]);
 
 
     g_signal_connect (backup_check, "toggled", G_CALLBACK (on_filter_backup_files_toggled), frame);
@@ -1239,42 +1241,47 @@ void store_filter_options (GtkWidget *dialog, GnomeCmdData::Options &cfg)
     GtkWidget *hide_unknown_check = lookup_widget (dialog, "hide_unknown_check");
     GtkWidget *hide_regular_check = lookup_widget (dialog, "hide_regular_check");
     GtkWidget *hide_directory_check = lookup_widget (dialog, "hide_directory_check");
-    GtkWidget *hide_fifo_check = lookup_widget (dialog, "hide_fifo_check");
-    GtkWidget *hide_socket_check = lookup_widget (dialog, "hide_socket_check");
-    GtkWidget *hide_char_check = lookup_widget (dialog, "hide_char_check");
-    GtkWidget *hide_block_check = lookup_widget (dialog, "hide_block_check");
+    GtkWidget *hide_special_check = lookup_widget (dialog, "hide_special_check");
+    GtkWidget *hide_shortcut_check = lookup_widget (dialog, "hide_shortcut_check");
+    GtkWidget *hide_mountable_check = lookup_widget (dialog, "hide_mountable_check");
+    GtkWidget *hide_virtual_check = lookup_widget (dialog, "hide_virtual_check");
+    GtkWidget *hide_volatile_check = lookup_widget (dialog, "hide_volatile_check");
     GtkWidget *hide_symlink_check = lookup_widget (dialog, "hide_symlink_check");
     GtkWidget *hide_hidden_check = lookup_widget (dialog, "hide_hidden_check");
     GtkWidget *hide_backup_check = lookup_widget (dialog, "hide_backup_check");
     GtkWidget *backup_pattern_entry = lookup_widget (dialog, "backup_pattern_entry");
 
-    cfg.filter.file_types[GNOME_VFS_FILE_TYPE_UNKNOWN] =
+    cfg.filter.file_types[GnomeCmdData::G_FILE_IS_UNKNOWN] =
         gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (hide_unknown_check));
 
-    cfg.filter.file_types[GNOME_VFS_FILE_TYPE_REGULAR] =
+    cfg.filter.file_types[GnomeCmdData::G_FILE_IS_REGULAR] =
         gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (hide_regular_check));
 
-    cfg.filter.file_types[GNOME_VFS_FILE_TYPE_DIRECTORY] =
+    cfg.filter.file_types[GnomeCmdData::G_FILE_IS_DIR] =
         gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (hide_directory_check));
 
-    cfg.filter.file_types[GNOME_VFS_FILE_TYPE_FIFO] =
-        gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (hide_fifo_check));
+    cfg.filter.file_types[GnomeCmdData::G_FILE_IS_SPECIAL] =
+        gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (hide_special_check));
 
-    cfg.filter.file_types[GNOME_VFS_FILE_TYPE_SOCKET] =
-        gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (hide_socket_check));
+    cfg.filter.file_types[GnomeCmdData::G_FILE_IS_SHORTCUT] =
+        gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (hide_shortcut_check));
 
-    cfg.filter.file_types[GNOME_VFS_FILE_TYPE_CHARACTER_DEVICE] =
-        gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (hide_char_check));
+    cfg.filter.file_types[GnomeCmdData::G_FILE_IS_MOUNTABLE] =
+        gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (hide_mountable_check));
 
-    cfg.filter.file_types[GNOME_VFS_FILE_TYPE_BLOCK_DEVICE] =
-        gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (hide_block_check));
+    cfg.filter.file_types[GnomeCmdData::G_FILE_IS_VIRTUAL] =
+        gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (hide_virtual_check));
 
-    cfg.filter.file_types[GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK] =
+    cfg.filter.file_types[GnomeCmdData::G_FILE_IS_VOLATILE] =
+        gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (hide_volatile_check));
+
+    cfg.filter.file_types[GnomeCmdData::G_FILE_IS_SYMLINK] =
         gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (hide_symlink_check));
 
-    cfg.filter.hidden =
+    cfg.filter.file_types[GnomeCmdData::G_FILE_IS_HIDDEN] =
         gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (hide_hidden_check));
-    cfg.filter.backup =
+
+    cfg.filter.file_types[GnomeCmdData::G_FILE_IS_BACKUP] =
         gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (hide_backup_check));
 
     cfg.set_backup_pattern(gtk_entry_get_text (GTK_ENTRY (backup_pattern_entry)));
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 83e0af23..51407ccc 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -198,7 +198,7 @@ static void on_filter_hide_unknown_changed()
     gboolean filter;
 
     filter = g_settings_get_boolean (gnome_cmd_data.options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_UNKNOWN);
-    gnome_cmd_data.options.filter.file_types[GNOME_VFS_FILE_TYPE_UNKNOWN] = filter;
+    gnome_cmd_data.options.filter.file_types[GnomeCmdData::GcmdFileType::G_FILE_IS_UNKNOWN] = filter;
 
     main_win->update_view();
 }
@@ -208,7 +208,7 @@ static void on_filter_hide_regular_changed ()
     gboolean filter;
 
     filter = g_settings_get_boolean (gnome_cmd_data.options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_REGULAR);
-    gnome_cmd_data.options.filter.file_types[GNOME_VFS_FILE_TYPE_REGULAR] = filter;
+    gnome_cmd_data.options.filter.file_types[GnomeCmdData::GcmdFileType::G_FILE_IS_REGULAR] = filter;
 
     main_win->update_view();
 }
@@ -218,77 +218,87 @@ static void on_filter_hide_directory_changed ()
     gboolean filter;
 
     filter = g_settings_get_boolean (gnome_cmd_data.options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_DIRECTORY);
-    gnome_cmd_data.options.filter.file_types[GNOME_VFS_FILE_TYPE_DIRECTORY] = filter;
+    gnome_cmd_data.options.filter.file_types[GnomeCmdData::GcmdFileType::G_FILE_IS_DIR] = filter;
 
     main_win->update_view();
 }
 
-static void on_filter_hide_fifo_changed ()
+static void on_filter_hide_symlink_changed ()
 {
     gboolean filter;
 
-    filter = g_settings_get_boolean (gnome_cmd_data.options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_FIFO);
-    gnome_cmd_data.options.filter.file_types[GNOME_VFS_FILE_TYPE_FIFO] = filter;
+    filter = g_settings_get_boolean (gnome_cmd_data.options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_SYMLINK);
+    gnome_cmd_data.options.filter.file_types[GnomeCmdData::GcmdFileType::G_FILE_IS_SYMLINK] = filter;
 
     main_win->update_view();
 }
 
-static void on_filter_hide_socket_changed ()
+static void on_filter_hide_special_changed ()
 {
     gboolean filter;
 
-    filter = g_settings_get_boolean (gnome_cmd_data.options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_SOCKET);
-    gnome_cmd_data.options.filter.file_types[GNOME_VFS_FILE_TYPE_SOCKET] = filter;
+    filter = g_settings_get_boolean (gnome_cmd_data.options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_SPECIAL);
+    gnome_cmd_data.options.filter.file_types[GnomeCmdData::GcmdFileType::G_FILE_IS_SPECIAL] = filter;
 
     main_win->update_view();
 }
 
-static void on_filter_hide_character_device_changed ()
+static void on_filter_hide_shortcut_changed ()
 {
     gboolean filter;
 
-    filter = g_settings_get_boolean (gnome_cmd_data.options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_CHARACTER_DEVICE);
-    gnome_cmd_data.options.filter.file_types[GNOME_VFS_FILE_TYPE_CHARACTER_DEVICE] = filter;
+    filter = g_settings_get_boolean (gnome_cmd_data.options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_SHORTCUT);
+    gnome_cmd_data.options.filter.file_types[GnomeCmdData::GcmdFileType::G_FILE_IS_SHORTCUT] = filter;
 
     main_win->update_view();
 }
 
-static void on_filter_hide_block_device_changed ()
+static void on_filter_hide_mountable_changed ()
 {
     gboolean filter;
 
-    filter = g_settings_get_boolean (gnome_cmd_data.options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_BLOCK_DEVICE);
-    gnome_cmd_data.options.filter.file_types[GNOME_VFS_FILE_TYPE_BLOCK_DEVICE] = filter;
+    filter = g_settings_get_boolean (gnome_cmd_data.options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_MOUNTABLE);
+    gnome_cmd_data.options.filter.file_types[GnomeCmdData::GcmdFileType::G_FILE_IS_MOUNTABLE] = filter;
 
     main_win->update_view();
 }
 
-static void on_filter_hide_symbolic_link_changed ()
+static void on_filter_hide_hidden_changed()
 {
     gboolean filter;
 
-    filter = g_settings_get_boolean (gnome_cmd_data.options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_SYMBOLIC_LINK);
-    gnome_cmd_data.options.filter.file_types[GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK] = filter;
+    filter = g_settings_get_boolean (gnome_cmd_data.options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_HIDDEN);
+    gnome_cmd_data.options.filter.file_types[GnomeCmdData::GcmdFileType::G_FILE_IS_HIDDEN] = filter;
 
     main_win->update_view();
 }
 
-static void on_filter_dotfile_changed ()
+static void on_filter_hide_backupfiles_changed ()
 {
     gboolean filter;
 
-    filter = g_settings_get_boolean (gnome_cmd_data.options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_DOTFILE);
-    gnome_cmd_data.options.filter.hidden = filter;
+    filter = g_settings_get_boolean (gnome_cmd_data.options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_BACKUPS);
+    gnome_cmd_data.options.filter.file_types[GnomeCmdData::GcmdFileType::G_FILE_IS_BACKUP] = filter;
 
     main_win->update_view();
 }
 
-static void on_filter_backup_changed ()
+static void on_filter_hide_virtual_changed ()
 {
     gboolean filter;
 
-    filter = g_settings_get_boolean (gnome_cmd_data.options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_BACKUP);
-    gnome_cmd_data.options.filter.backup = filter;
+    filter = g_settings_get_boolean (gnome_cmd_data.options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_VIRTUAL);
+    gnome_cmd_data.options.filter.file_types[GnomeCmdData::GcmdFileType::G_FILE_IS_VIRTUAL] = filter;
+
+    main_win->update_view();
+}
+
+static void on_filter_hide_volatile_changed ()
+{
+    gboolean filter;
+
+    filter = g_settings_get_boolean (gnome_cmd_data.options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_VOLATILE);
+    gnome_cmd_data.options.filter.file_types[GnomeCmdData::GcmdFileType::G_FILE_IS_VOLATILE] = filter;
 
     main_win->update_view();
 }
@@ -971,38 +981,43 @@ static void gcmd_connect_gsettings_signals(GcmdSettings *gs)
                       nullptr);
 
     g_signal_connect (gs->filter,
-                      "changed::hide-fifo",
-                      G_CALLBACK (on_filter_hide_fifo_changed),
+                      "changed::hide-symlink",
+                      G_CALLBACK (on_filter_hide_symlink_changed),
+                      nullptr);
+
+    g_signal_connect (gs->filter,
+                      "changed::hide-special",
+                      G_CALLBACK (on_filter_hide_special_changed),
                       nullptr);
 
     g_signal_connect (gs->filter,
-                      "changed::hide-socket",
-                      G_CALLBACK (on_filter_hide_socket_changed),
+                      "changed::hide-shortcut",
+                      G_CALLBACK (on_filter_hide_shortcut_changed),
                       nullptr);
 
     g_signal_connect (gs->filter,
-                      "changed::hide-char-device",
-                      G_CALLBACK (on_filter_hide_character_device_changed),
+                      "changed::hide-mountable",
+                      G_CALLBACK (on_filter_hide_mountable_changed),
                       nullptr);
 
     g_signal_connect (gs->filter,
-                      "changed::hide-block-device",
-                      G_CALLBACK (on_filter_hide_block_device_changed),
+                      "changed::hide-virtual",
+                      G_CALLBACK (on_filter_hide_virtual_changed),
                       nullptr);
 
     g_signal_connect (gs->filter,
-                      "changed::hide-symbolic-link",
-                      G_CALLBACK (on_filter_hide_symbolic_link_changed),
+                      "changed::hide-volatile",
+                      G_CALLBACK (on_filter_hide_volatile_changed),
                       nullptr);
 
     g_signal_connect (gs->filter,
                       "changed::hide-dotfile",
-                      G_CALLBACK (on_filter_dotfile_changed),
+                      G_CALLBACK (on_filter_hide_hidden_changed),
                       nullptr);
 
     g_signal_connect (gs->filter,
-                      "changed::hide-backup-files",
-                      G_CALLBACK (on_filter_backup_changed),
+                      "changed::hide-backupfiles",
+                      G_CALLBACK (on_filter_hide_backupfiles_changed),
                       nullptr);
 
     g_signal_connect (gs->filter,
@@ -3078,16 +3093,17 @@ void GnomeCmdData::load()
     options.confirm_move_overwrite = (GnomeCmdConfirmOverwriteMode) g_settings_get_enum 
(options.gcmd_settings->confirm, GCMD_SETTINGS_CONFIRM_MOVE_OVERWRITE);
     options.confirm_mouse_dnd = g_settings_get_boolean (options.gcmd_settings->confirm, 
GCMD_SETTINGS_CONFIRM_MOUSE_DRAG_AND_DROP);
 
-    options.filter.file_types[GNOME_VFS_FILE_TYPE_UNKNOWN] = g_settings_get_boolean 
(options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_UNKNOWN);
-    options.filter.file_types[GNOME_VFS_FILE_TYPE_REGULAR] = g_settings_get_boolean 
(options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_REGULAR);
-    options.filter.file_types[GNOME_VFS_FILE_TYPE_DIRECTORY] = g_settings_get_boolean 
(options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_DIRECTORY);
-    options.filter.file_types[GNOME_VFS_FILE_TYPE_FIFO] = g_settings_get_boolean 
(options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_FIFO);
-    options.filter.file_types[GNOME_VFS_FILE_TYPE_SOCKET] = g_settings_get_boolean 
(options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_SOCKET);
-    options.filter.file_types[GNOME_VFS_FILE_TYPE_CHARACTER_DEVICE] = g_settings_get_boolean 
(options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_CHARACTER_DEVICE);
-    options.filter.file_types[GNOME_VFS_FILE_TYPE_BLOCK_DEVICE] = g_settings_get_boolean 
(options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_BLOCK_DEVICE);
-    options.filter.file_types[GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK] = g_settings_get_boolean 
(options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_SYMBOLIC_LINK);
-    options.filter.hidden = g_settings_get_boolean (options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_DOTFILE);
-    options.filter.backup = g_settings_get_boolean (options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_BACKUP);
+    options.filter.file_types[G_FILE_IS_UNKNOWN] = g_settings_get_boolean (options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_UNKNOWN);
+    options.filter.file_types[G_FILE_IS_REGULAR] = g_settings_get_boolean (options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_REGULAR);
+    options.filter.file_types[G_FILE_IS_DIR] = g_settings_get_boolean (options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_DIRECTORY);
+    options.filter.file_types[G_FILE_IS_SYMLINK] = g_settings_get_boolean (options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_SYMLINK);
+    options.filter.file_types[G_FILE_TYPE_SPECIAL] = g_settings_get_boolean (options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_SPECIAL);
+    options.filter.file_types[G_FILE_TYPE_SHORTCUT] = g_settings_get_boolean (options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_SHORTCUT);
+    options.filter.file_types[G_FILE_TYPE_MOUNTABLE] = g_settings_get_boolean 
(options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_MOUNTABLE);
+    options.filter.file_types[G_FILE_IS_VIRTUAL] = g_settings_get_boolean (options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_VIRTUAL);
+    options.filter.file_types[G_FILE_IS_VOLATILE] = g_settings_get_boolean (options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_VOLATILE);
+    options.filter.file_types[G_FILE_IS_HIDDEN] = g_settings_get_boolean (options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_HIDDEN);
+    options.filter.file_types[G_FILE_IS_BACKUP] = g_settings_get_boolean (options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_BACKUPS);
 
     options.select_dirs = g_settings_get_boolean (options.gcmd_settings->general, GCMD_SETTINGS_SELECT_DIRS);
     options.case_sens_sort = g_settings_get_boolean (options.gcmd_settings->general, 
GCMD_SETTINGS_CASE_SENSITIVE);
@@ -3450,16 +3466,17 @@ void GnomeCmdData::save()
     set_gsettings_enum_when_changed (options.gcmd_settings->confirm, GCMD_SETTINGS_CONFIRM_MOVE_OVERWRITE, 
options.confirm_move_overwrite);
     set_gsettings_when_changed      (options.gcmd_settings->confirm, 
GCMD_SETTINGS_CONFIRM_MOUSE_DRAG_AND_DROP, &(options.confirm_mouse_dnd));
 
-    set_gsettings_when_changed      (options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_UNKNOWN, 
&(options.filter.file_types[GNOME_VFS_FILE_TYPE_UNKNOWN]));
-    set_gsettings_when_changed      (options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_REGULAR, 
&(options.filter.file_types[GNOME_VFS_FILE_TYPE_REGULAR]));
-    set_gsettings_when_changed      (options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_DIRECTORY, 
&(options.filter.file_types[GNOME_VFS_FILE_TYPE_DIRECTORY]));
-    set_gsettings_when_changed      (options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_FIFO, 
&(options.filter.file_types[GNOME_VFS_FILE_TYPE_FIFO]));
-    set_gsettings_when_changed      (options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_SOCKET, 
&(options.filter.file_types[GNOME_VFS_FILE_TYPE_SOCKET]));
-    set_gsettings_when_changed      (options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_CHARACTER_DEVICE, 
&(options.filter.file_types[GNOME_VFS_FILE_TYPE_CHARACTER_DEVICE]));
-    set_gsettings_when_changed      (options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_BLOCK_DEVICE, 
&(options.filter.file_types[GNOME_VFS_FILE_TYPE_BLOCK_DEVICE]));
-    set_gsettings_when_changed      (options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_SYMBOLIC_LINK, 
&(options.filter.file_types[GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK]));
-    set_gsettings_when_changed      (options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_DOTFILE, 
&(options.filter.hidden));
-    set_gsettings_when_changed      (options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_BACKUP, 
&(options.filter.backup));
+    set_gsettings_when_changed      (options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_UNKNOWN, 
&(options.filter.file_types[G_FILE_IS_UNKNOWN]));
+    set_gsettings_when_changed      (options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_REGULAR, 
&(options.filter.file_types[G_FILE_IS_REGULAR]));
+    set_gsettings_when_changed      (options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_DIRECTORY, 
&(options.filter.file_types[G_FILE_IS_DIR]));
+    set_gsettings_when_changed      (options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_SYMLINK, 
&(options.filter.file_types[G_FILE_IS_SYMLINK]));
+    set_gsettings_when_changed      (options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_SPECIAL, 
&(options.filter.file_types[G_FILE_IS_SPECIAL]));
+    set_gsettings_when_changed      (options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_SHORTCUT, 
&(options.filter.file_types[G_FILE_IS_SHORTCUT]));
+    set_gsettings_when_changed      (options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_MOUNTABLE, 
&(options.filter.file_types[G_FILE_IS_MOUNTABLE]));
+    set_gsettings_when_changed      (options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_VIRTUAL, 
&(options.filter.file_types[G_FILE_IS_VIRTUAL]));
+    set_gsettings_when_changed      (options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_VOLATILE, 
&(options.filter.file_types[G_FILE_IS_VOLATILE]));
+    set_gsettings_when_changed      (options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_HIDDEN, 
&(options.filter.file_types[G_FILE_IS_HIDDEN]));
+    set_gsettings_when_changed      (options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_BACKUPS, 
&(options.filter.file_types[G_FILE_IS_BACKUP]));
 
     set_gsettings_when_changed      (options.gcmd_settings->general, GCMD_SETTINGS_SELECT_DIRS, 
&(options.select_dirs));
     set_gsettings_when_changed      (options.gcmd_settings->general, GCMD_SETTINGS_CASE_SENSITIVE, 
&(options.case_sens_sort));
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index 9c87525a..747342c5 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -148,13 +148,14 @@ GcmdSettings *gcmd_settings_new (void);
 #define GCMD_SETTINGS_FILTER_HIDE_UNKNOWN             "hide-unknown"
 #define GCMD_SETTINGS_FILTER_HIDE_REGULAR             "hide-regular"
 #define GCMD_SETTINGS_FILTER_HIDE_DIRECTORY           "hide-directory"
-#define GCMD_SETTINGS_FILTER_HIDE_FIFO                "hide-fifo"
-#define GCMD_SETTINGS_FILTER_HIDE_SOCKET              "hide-socket"
-#define GCMD_SETTINGS_FILTER_HIDE_CHARACTER_DEVICE    "hide-char-device"
-#define GCMD_SETTINGS_FILTER_HIDE_BLOCK_DEVICE        "hide-block-device"
-#define GCMD_SETTINGS_FILTER_HIDE_SYMBOLIC_LINK       "hide-symbolic-link"
-#define GCMD_SETTINGS_FILTER_DOTFILE                  "hide-dotfile"
-#define GCMD_SETTINGS_FILTER_BACKUP                   "hide-backup-files"
+#define GCMD_SETTINGS_FILTER_HIDE_SYMLINK             "hide-symlink"
+#define GCMD_SETTINGS_FILTER_HIDE_SPECIAL             "hide-special"
+#define GCMD_SETTINGS_FILTER_HIDE_SHORTCUT            "hide-shortcut"
+#define GCMD_SETTINGS_FILTER_HIDE_MOUNTABLE           "hide-mountable"
+#define GCMD_SETTINGS_FILTER_HIDE_VIRTUAL             "hide-virtual"
+#define GCMD_SETTINGS_FILTER_HIDE_VOLATILE            "hide-volatile"
+#define GCMD_SETTINGS_FILTER_HIDE_HIDDEN              "hide-dotfile"
+#define GCMD_SETTINGS_FILTER_HIDE_BACKUPS             "hide-backupfiles"
 #define GCMD_SETTINGS_FILTER_BACKUP_PATTERN           "backup-pattern"
 
 #define GCMD_PREF_CONFIRM                             "org.gnome.gnome-commander.preferences.confirmations"
@@ -280,18 +281,28 @@ struct GnomeCmdData
 
     enum {SEARCH_HISTORY_SIZE=10, ADVRENAME_HISTORY_SIZE=10, INTVIEWER_HISTORY_SIZE=16};
 
-    struct FilterSettings
+    typedef enum
     {
-        gboolean file_types[8];
+        G_FILE_IS_UNKNOWN,
+        G_FILE_IS_REGULAR,
+        G_FILE_IS_DIR,
+        G_FILE_IS_SYMLINK,
+        G_FILE_IS_SPECIAL,
+        G_FILE_IS_SHORTCUT,
+        G_FILE_IS_MOUNTABLE,
+        G_FILE_IS_HIDDEN,
+        G_FILE_IS_BACKUP,
+        G_FILE_IS_VIRTUAL,
+        G_FILE_IS_VOLATILE
+    }GcmdFileType;
 
-        gboolean hidden;
-        gboolean backup;
+    struct FilterSettings
+    {
+        gboolean file_types[11];
 
         FilterSettings()
         {
             memset(file_types, 0, sizeof(file_types));
-            hidden = TRUE;
-            backup = TRUE;
         }
     };
 
diff --git a/src/gnome-cmd-file-list.cc b/src/gnome-cmd-file-list.cc
index 899542e6..bec533d1 100644
--- a/src/gnome-cmd-file-list.cc
+++ b/src/gnome-cmd-file-list.cc
@@ -2813,22 +2813,52 @@ gboolean GnomeCmdFileList::file_is_wanted(GnomeCmdFile *gnomeCmdFile)
 {
     g_return_val_if_fail (gnomeCmdFile != nullptr, FALSE);
 
-    GnomeVFSFileInfo *info = gnomeCmdFile->info;
+    GError *error;
+    error = nullptr;
 
-    if (strcmp (info->name, ".") == 0)
-        return FALSE;
-    if (gnomeCmdFile->is_dotdot)
-        return FALSE;
-    if (gnome_cmd_data.options.filter.file_types[info->type])
-        return FALSE;
-    if (info->symlink_name && gnome_cmd_data.options.filter.file_types[GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK])
-        return FALSE;
-    if (info->name[0] == '.' && gnome_cmd_data.options.filter.hidden)
-        return FALSE;
-    if (gnome_cmd_data.options.filter.backup && patlist_matches (gnome_cmd_data.options.backup_pattern_list, 
info->name))
-        return FALSE;
+    auto fileNameString = g_file_get_basename(gnomeCmdFile->gFile);
 
-    return TRUE;
+    auto gFileInfo = g_file_query_info(gnomeCmdFile->gFile,
+                                   "standard::*",
+                                   G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+                                   nullptr,
+                                   &error);
+    if (error)
+    {
+        g_message ("retrieving file info failed: %s", error->message);
+        g_error_free (error);
+        return TRUE;
+    }
+
+    auto gFileType       = g_file_info_get_attribute_uint32(gFileInfo, G_FILE_ATTRIBUTE_STANDARD_TYPE);
+    auto gFileIsHidden   = g_file_info_get_attribute_boolean(gFileInfo, G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN);
+    auto gFileIsSymLink  = g_file_info_get_attribute_boolean(gFileInfo, 
G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK);
+    auto gFileIsVirtual  = g_file_info_get_attribute_boolean(gFileInfo, 
G_FILE_ATTRIBUTE_STANDARD_IS_VIRTUAL);
+    auto gFileIsVolatile = g_file_info_get_attribute_boolean(gFileInfo, 
G_FILE_ATTRIBUTE_STANDARD_IS_VOLATILE);
+
+    auto returnValue = TRUE;
+
+    if (strcmp ((const char*) fileNameString, ".") == 0)
+        returnValue = FALSE;
+    if (gnomeCmdFile->is_dotdot)
+        returnValue = FALSE;
+    if (gnome_cmd_data.options.filter.file_types[gFileType])
+        returnValue = FALSE;
+    if (gFileIsSymLink && 
gnome_cmd_data.options.filter.file_types[GnomeCmdData::GcmdFileType::G_FILE_IS_SYMLINK])
+        returnValue = FALSE;
+    if (gFileIsHidden && 
gnome_cmd_data.options.filter.file_types[GnomeCmdData::GcmdFileType::G_FILE_IS_HIDDEN])
+        returnValue = FALSE;
+    if (gFileIsVirtual && 
gnome_cmd_data.options.filter.file_types[GnomeCmdData::GcmdFileType::G_FILE_IS_VIRTUAL])
+        returnValue = FALSE;
+    if (gFileIsVolatile && 
gnome_cmd_data.options.filter.file_types[GnomeCmdData::GcmdFileType::G_FILE_IS_VOLATILE])
+        returnValue = FALSE;
+    if (gnome_cmd_data.options.filter.file_types[GnomeCmdData::GcmdFileType::G_FILE_IS_BACKUP]
+        && patlist_matches (gnome_cmd_data.options.backup_pattern_list, fileNameString))
+        returnValue = FALSE;
+
+    g_free(fileNameString);
+
+    return returnValue;
 }
 
 
diff --git a/src/gnome-cmd-main-menu.cc b/src/gnome-cmd-main-menu.cc
index a53a95ba..e1d23b0e 100644
--- a/src/gnome-cmd-main-menu.cc
+++ b/src/gnome-cmd-main-menu.cc
@@ -456,8 +456,8 @@ static void init (GnomeCmdMainMenu *main_menu)
     gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_ui_manager_get_widget (uiManager, 
"/MainMenuBar/ViewMenu/ShowDeviceList")), gnome_cmd_data.show_devlist);
     gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_ui_manager_get_widget (uiManager, 
"/MainMenuBar/ViewMenu/ShowCommandLine")), gnome_cmd_data.cmdline_visibility);
     gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_ui_manager_get_widget (uiManager, 
"/MainMenuBar/ViewMenu/ShowButtonbar")), gnome_cmd_data.buttonbar_visibility);
-    gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_ui_manager_get_widget (uiManager, 
"/MainMenuBar/ViewMenu/ShowHiddenFiles")), !gnome_cmd_data.options.filter.hidden);
-    gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_ui_manager_get_widget (uiManager, 
"/MainMenuBar/ViewMenu/ShowBackupFiles")), !gnome_cmd_data.options.filter.backup);
+    gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_ui_manager_get_widget (uiManager, 
"/MainMenuBar/ViewMenu/ShowHiddenFiles")), 
!gnome_cmd_data.options.filter.file_types[GnomeCmdData::G_FILE_IS_HIDDEN]);
+    gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_ui_manager_get_widget (uiManager, 
"/MainMenuBar/ViewMenu/ShowBackupFiles")), 
!gnome_cmd_data.options.filter.file_types[GnomeCmdData::G_FILE_IS_BACKUP]);
     gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (gtk_ui_manager_get_widget (uiManager, 
"/MainMenuBar/ViewMenu/HorizontalOrientation")), gnome_cmd_data.horizontal_orientation);
 
     g_signal_connect (gnome_cmd_con_list_get (), "list-changed", G_CALLBACK (on_con_list_list_changed), 
main_menu);
diff --git a/src/gnome-cmd-main-win.cc b/src/gnome-cmd-main-win.cc
index bbf5ccdb..5ad29848 100644
--- a/src/gnome-cmd-main-win.cc
+++ b/src/gnome-cmd-main-win.cc
@@ -1074,7 +1074,8 @@ gboolean GnomeCmdMainWin::key_pressed(GdkEventKey *event)
         {
             case GDK_H:
             case GDK_h:
-                gnome_cmd_data.options.filter.hidden = !gnome_cmd_data.options.filter.hidden;
+                gnome_cmd_data.options.filter.file_types[GnomeCmdData::G_FILE_IS_HIDDEN] =
+                    !gnome_cmd_data.options.filter.file_types[GnomeCmdData::G_FILE_IS_HIDDEN];
                 gnome_cmd_data.save();
                 return TRUE;
             default:
diff --git a/src/gnome-cmd-user-actions.cc b/src/gnome-cmd-user-actions.cc
index fbd12d70..7e080f1f 100644
--- a/src/gnome-cmd-user-actions.cc
+++ b/src/gnome-cmd-user-actions.cc
@@ -1487,7 +1487,7 @@ void view_hidden_files (GtkToggleAction *toggleAction, gpointer not_used)
     if (!GTK_WIDGET_REALIZED (main_win)) return;
 
     auto active = gtk_toggle_action_get_active(toggleAction);
-    g_settings_set_boolean (gcmd_user_actions.settings->filter, GCMD_SETTINGS_FILTER_DOTFILE, !active);
+    g_settings_set_boolean (gcmd_user_actions.settings->filter, GCMD_SETTINGS_FILTER_HIDE_HIDDEN, !active);
 }
 
 
@@ -1496,7 +1496,7 @@ void view_backup_files (GtkToggleAction *toggleAction, gpointer not_used)
     if (!GTK_WIDGET_REALIZED (main_win)) return;
 
     auto active = gtk_toggle_action_get_active(toggleAction);
-    g_settings_set_boolean (gcmd_user_actions.settings->filter, GCMD_SETTINGS_FILTER_BACKUP, !active);
+    g_settings_set_boolean (gcmd_user_actions.settings->filter, GCMD_SETTINGS_FILTER_HIDE_BACKUPS, !active);
 }
 
 


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