[gnome-commander/GSettings] Adds only_icon to GSettings (now known as only-icon)



commit ff73d659d53dcae14ffff0e54320654407ca9c35
Author: Uwe Scholz <uwescholz src gnome org>
Date:   Thu Jul 7 22:21:17 2016 +0200

    Adds only_icon to GSettings (now known as only-icon)

 data/org.gnome.gnome-commander.gschema.xml |    6 ++++--
 src/gnome-cmd-data.cc                      |   20 ++++++++++++++++++--
 src/gnome-cmd-data.h                       |    1 +
 3 files changed, 23 insertions(+), 4 deletions(-)
---
diff --git a/data/org.gnome.gnome-commander.gschema.xml b/data/org.gnome.gnome-commander.gschema.xml
index 57c84a6..eeb9134 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -567,8 +567,10 @@
   <schema gettext-domain="gnome-commander" id="org.gnome.gnome-commander.preferences.devices" 
path="/org/gnome/gnome-commander/preferences/devices/">
     <key name="only-icon" type="b">
       <default l10n="messages">false</default>
-      <summary></summary>
-      <description></description>
+      <summary>Only device icons</summary>
+      <description>
+          This option defines if only device icons should be shown instead of icons and text label.
+      </description>
     </key>
     <key name="skip-mounting" type="b">
       <default l10n="messages">false</default>
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 0e74c7f..67e6705 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -765,6 +765,14 @@ void on_skip_mounting_changed()
     gnome_cmd_data.options.skip_mounting = skip_mounting;
 }
 
+void on_dev_only_icon_changed()
+{
+    gboolean dev_only_icon;
+
+    dev_only_icon = g_settings_get_boolean (gnome_cmd_data.options.gcmd_settings->devices, 
GCMD_SETTINGS_ONLY_ICON);
+    gnome_cmd_data.options.device_only_icon = dev_only_icon;
+}
+
 void on_viewer_cmd_changed()
 {
     gchar *viewer_cmd;
@@ -1174,6 +1182,11 @@ static void gcmd_connect_gsettings_signals(GcmdSettings *gs)
                       G_CALLBACK (on_skip_mounting_changed),
                       NULL);
 
+    g_signal_connect (gs->devices,
+                      "changed::only-icon",
+                      G_CALLBACK (on_dev_only_icon_changed),
+                      NULL);
+
     g_signal_connect (gs->programs,
                       "changed::viewer-cmd",
                       G_CALLBACK (on_viewer_cmd_changed),
@@ -2869,6 +2882,9 @@ void GnomeCmdData::migrate_all_data_to_gsettings()
         //use_gcmd_block
         migrate_data_int_value_into_gsettings(gnome_cmd_data_get_bool ("/programs/use_gcmd_block", FALSE) ? 
1 : 0,
                                               options.gcmd_settings->programs, GCMD_SETTINGS_USE_GCMD_BLOCK);
+        //only_icon
+        migrate_data_int_value_into_gsettings(gnome_cmd_data_get_bool ("/devices/only_icon", FALSE) ? 1 : 0,
+                                              options.gcmd_settings->devices, GCMD_SETTINGS_ONLY_ICON);
 
         g_free(color);
         // ToDo: Move old xml-file to ~/.gnome-commander/gnome-commander.xml.backup
@@ -3255,7 +3271,7 @@ void GnomeCmdData::load()
     options.termexec = g_settings_get_string(options.gcmd_settings->programs, 
GCMD_SETTINGS_TERMINAL_EXEC_CMD);
     use_gcmd_block = g_settings_get_boolean(options.gcmd_settings->programs, GCMD_SETTINGS_USE_GCMD_BLOCK);
 
-    options.device_only_icon = gnome_cmd_data_get_bool ("/devices/only_icon", FALSE);
+    options.device_only_icon = g_settings_get_boolean(options.gcmd_settings->devices, 
GCMD_SETTINGS_ONLY_ICON);
 
     gnome_cmd_data_get_color_gnome_config ("/colors/ls_colors_black_fg", options.ls_colors_palette.black_fg);
     gnome_cmd_data_get_color_gnome_config ("/colors/ls_colors_black_bg", options.ls_colors_palette.black_bg);
@@ -3785,7 +3801,7 @@ void GnomeCmdData::save()
     set_gsettings_when_changed      (options.gcmd_settings->programs, GCMD_SETTINGS_TERMINAL_EXEC_CMD, 
options.termexec);
     set_gsettings_when_changed      (options.gcmd_settings->programs, GCMD_SETTINGS_USE_GCMD_BLOCK, 
&(use_gcmd_block));
 
-    gnome_cmd_data_set_bool   ("/devices/only_icon", options.device_only_icon);
+    set_gsettings_when_changed      (options.gcmd_settings->devices, GCMD_SETTINGS_ONLY_ICON, 
&(options.device_only_icon));
 
     const gchar *quick_connect_uri = gnome_cmd_con_get_uri (GNOME_CMD_CON (quick_connect));
 
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index 9ffc295..20a884c 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -159,6 +159,7 @@ GcmdSettings *gcmd_settings_new (void);
 
 #define GCMD_PREF_DEVICES                             "org.gnome.gnome-commander.preferences.devices"
 #define GCMD_SETTINGS_SKIP_MOUNTING                   "skip-mounting"
+#define GCMD_SETTINGS_ONLY_ICON                       "only-icon"
 
 struct GnomeCmdConRemote;
 


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