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



commit 452a5b44aa24202161e4a679bcda8b0532009afa
Author: Uwe Scholz <uwescholz src gnome org>
Date:   Tue May 17 20:58:29 2016 +0200

    Adds show_socket filter option to GSettings migration (now known as hide-socket)

 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 cf649f2..89e67c8 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -328,7 +328,7 @@
     </key>
     <key name="hide-socket" type="b">
       <default>false</default>
-      <summary></summary>
+      <summary>Hide sockets</summary>
     </key>
     <key name="hide-char-device" type="b">
       <default>false</default>
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 6757e9c..3389625 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -144,6 +144,9 @@ void on_filter_changed ()
     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_SOCKET);
+    gnome_cmd_data.options.filter.file_types[GNOME_VFS_FILE_TYPE_SOCKET] = filter;
+
     main_win->update_view();
 }
 
@@ -208,6 +211,11 @@ static void gcmd_connect_gsettings_signals(GcmdSettings *gs)
                       G_CALLBACK (on_filter_changed),
                       NULL);
 
+    g_signal_connect (gs->filter,
+                      "changed::hide-socket",
+                      G_CALLBACK (on_filter_changed),
+                      NULL);
+
 }
 
 
@@ -1567,6 +1575,9 @@ void GnomeCmdData::migrate_all_data_to_gsettings()
         //show_fifo
         migrate_data_int_value_into_gsettings(gnome_cmd_data_get_bool ("/options/show_fifo", FALSE) ? 1 : 0,
                                                         options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_FIFO);
+        //show_socket
+        migrate_data_int_value_into_gsettings(gnome_cmd_data_get_bool ("/options/show_socket", FALSE) ? 1 : 
0,
+                                                        options.gcmd_settings->filter, 
GCMD_SETTINGS_FILTER_HIDE_SOCKET);
         // 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
@@ -1688,7 +1699,7 @@ void GnomeCmdData::load()
     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] = gnome_cmd_data_get_bool ("/options/show_socket", 
FALSE);
+    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] = gnome_cmd_data_get_bool 
("/options/show_char_device", FALSE);
     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_SYMBOLIC_LINK] = gnome_cmd_data_get_bool 
("/options/show_symbolic_link", FALSE);
@@ -2233,7 +2244,7 @@ void GnomeCmdData::save()
     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]));
-    gnome_cmd_data_set_bool   ("/options/show_socket", 
options.filter.file_types[GNOME_VFS_FILE_TYPE_SOCKET]);
+    set_gsettings_when_changed      (options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_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]);
     gnome_cmd_data_set_bool   ("/options/show_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]);
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index 59906e4..ad69234 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -68,6 +68,7 @@ GcmdSettings *gcmd_settings_new (void);
 #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"
 
 struct GnomeCmdConRemote;
 


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