[gnome-commander/GSettings] Adds show_block_device filter option to GSettings (now known as hide-block-device)



commit e8e3a70d1a0b1e18b3d8f5a76174d3e66f1b2b86
Author: Uwe Scholz <uwescholz src gnome org>
Date:   Tue May 17 22:29:00 2016 +0200

    Adds show_block_device filter option to GSettings (now known as hide-block-device)

 data/org.gnome.gnome-commander.gschema.xml |    2 +-
 src/gnome-cmd-data.cc                      |   15 +++++++++++++--
 src/gnome-cmd-data.h                       |    1 +
 3 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/data/org.gnome.gnome-commander.gschema.xml b/data/org.gnome.gnome-commander.gschema.xml
index 7a13b50..e435f97 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -336,7 +336,7 @@
     </key>
     <key name="hide-block-device" type="b">
       <default>false</default>
-      <summary></summary>
+      <summary>Hide block devices</summary>
     </key>
     <key name="hide-symbolic-link" type="b">
       <default>false</default>
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index a71b950..9e91791 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -150,6 +150,9 @@ void on_filter_changed ()
     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_BLOCK_DEVICE);
+    gnome_cmd_data.options.filter.file_types[GNOME_VFS_FILE_TYPE_BLOCK_DEVICE] = filter;
+
     main_win->update_view();
 }
 
@@ -224,6 +227,11 @@ static void gcmd_connect_gsettings_signals(GcmdSettings *gs)
                       G_CALLBACK (on_filter_changed),
                       NULL);
 
+    g_signal_connect (gs->filter,
+                      "changed::hide-block-device",
+                      G_CALLBACK (on_filter_changed),
+                      NULL);
+
 }
 
 
@@ -1589,6 +1597,9 @@ void GnomeCmdData::migrate_all_data_to_gsettings()
         //show_char_device
         migrate_data_int_value_into_gsettings(gnome_cmd_data_get_bool ("/options/show_char_device", FALSE) ? 
1 : 0,
                                                         options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_CHARACTER_DEVICE);
+        //show_block_device
+        migrate_data_int_value_into_gsettings(gnome_cmd_data_get_bool ("/options/show_block_device", FALSE) 
? 1 : 0,
+                                                        options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_BLOCK_DEVICE);
         // 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
@@ -1712,7 +1723,7 @@ void GnomeCmdData::load()
     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] = gnome_cmd_data_get_bool 
("/options/show_block_device", FALSE);
+    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] = gnome_cmd_data_get_bool 
("/options/show_symbolic_link", FALSE);
     options.filter.hidden = gnome_cmd_data_get_bool ("/options/hidden_filter", TRUE);
     options.filter.backup = gnome_cmd_data_get_bool ("/options/backup_filter", TRUE);
@@ -2257,7 +2268,7 @@ void GnomeCmdData::save()
     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]));
-    gnome_cmd_data_set_bool   ("/options/show_block_device", 
options.filter.file_types[GNOME_VFS_FILE_TYPE_BLOCK_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]));
     gnome_cmd_data_set_bool   ("/options/show_symbolic_link", 
options.filter.file_types[GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK]);
 
     gnome_cmd_data_set_bool   ("/options/hidden_filter", options.filter.hidden);
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index a099d8b..037cadd 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -70,6 +70,7 @@ GcmdSettings *gcmd_settings_new (void);
 #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"
 
 struct GnomeCmdConRemote;
 


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