[gnome-commander/GSettings] Adds show_directory filter option to GSettings migration (now known as hide-directory)



commit 62892082ad3d59bca401c60738266a7d9ac52489
Author: Uwe Scholz <uwescholz src gnome org>
Date:   Tue May 17 20:23:24 2016 +0200

    Adds show_directory filter option to GSettings migration (now known as hide-directory)

 data/org.gnome.gnome-commander.gschema.xml |    2 +-
 src/gnome-cmd-data.cc                      |   17 +++++++++++++----
 src/gnome-cmd-data.h                       |    1 +
 3 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/data/org.gnome.gnome-commander.gschema.xml b/data/org.gnome.gnome-commander.gschema.xml
index 3d0d5a8..fa25bf9 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -321,7 +321,7 @@
     </key>
     <key name="hide-directory" type="b">
       <default>false</default>
-      <summary></summary>
+      <summary>Hide directories</summary>
       <description></description>
     </key>
     <key name="hide-fifo" type="b">
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index dc13ee1..cad02de 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -138,6 +138,9 @@ void on_filter_changed ()
     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;
 
+    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;
+
     main_win->update_view();
 }
 
@@ -192,6 +195,11 @@ static void gcmd_connect_gsettings_signals(GcmdSettings *gs)
                       G_CALLBACK (on_filter_changed),
                       NULL);
 
+    g_signal_connect (gs->filter,
+                      "changed::hide-directory",
+                      G_CALLBACK (on_filter_changed),
+                      NULL);
+
 }
 
 
@@ -1542,11 +1550,12 @@ void GnomeCmdData::migrate_all_data_to_gsettings()
         //show_unknown
         migrate_data_int_value_into_gsettings(gnome_cmd_data_get_bool ("/options/show_unknown", FALSE) ? 1 : 
0,
                                                         options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_UNKNOWN);
-
         //show_regular
         migrate_data_int_value_into_gsettings(gnome_cmd_data_get_bool ("/options/show_regular", FALSE) ? 1 : 
0,
                                                         options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_REGULAR);
-
+        //show_directory
+        migrate_data_int_value_into_gsettings(gnome_cmd_data_get_bool ("/options/show_directory", FALSE) ? 1 
: 0,
+                                                        options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_DIRECTORY);
         // ToDo: Move old xml-file to ~/.gnome-commander/gnome-commander.xml.backup
         //       à la save_devices_old ("devices.backup");
         //       and move .gnome2/gnome-commander to .gnome2/gnome-commander.backup
@@ -1666,7 +1675,7 @@ void GnomeCmdData::load()
 
     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] = gnome_cmd_data_get_bool 
("/options/show_directory", FALSE);
+    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] = gnome_cmd_data_get_bool ("/options/show_fifo", 
FALSE);
     options.filter.file_types[GNOME_VFS_FILE_TYPE_SOCKET] = gnome_cmd_data_get_bool ("/options/show_socket", 
FALSE);
     options.filter.file_types[GNOME_VFS_FILE_TYPE_CHARACTER_DEVICE] = gnome_cmd_data_get_bool 
("/options/show_char_device", FALSE);
@@ -2211,7 +2220,7 @@ void GnomeCmdData::save()
 
     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]));
-    gnome_cmd_data_set_bool   ("/options/show_directory", 
options.filter.file_types[GNOME_VFS_FILE_TYPE_DIRECTORY]);
+    set_gsettings_when_changed      (options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_DIRECTORY, 
&(options.filter.file_types[GNOME_VFS_FILE_TYPE_DIRECTORY]));
     gnome_cmd_data_set_bool   ("/options/show_fifo", options.filter.file_types[GNOME_VFS_FILE_TYPE_FIFO]);
     gnome_cmd_data_set_bool   ("/options/show_socket", 
options.filter.file_types[GNOME_VFS_FILE_TYPE_SOCKET]);
     gnome_cmd_data_set_bool   ("/options/show_char_device", 
options.filter.file_types[GNOME_VFS_FILE_TYPE_CHARACTER_DEVICE]);
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index 02379fb..85b8ca2 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -66,6 +66,7 @@ GcmdSettings *gcmd_settings_new (void);
 #define GCMD_PREF_FILTER                              "org.gnome.gnome-commander.preferences.filter"
 #define GCMD_SETTINGS_FILTER_HIDE_UNKNOWN             "hide-unknown"
 #define GCMD_SETTINGS_FILTER_HIDE_REGULAR             "hide-regular"
+#define GCMD_SETTINGS_FILTER_HIDE_DIRECTORY           "hide-directory"
 
 struct GnomeCmdConRemote;
 


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