[gnome-commander/GSettings] Adds con_list_visibility option to GSettings (now known as show-devlist)



commit d145bc0a18aa673bc0702fc5ce0797a5db94f983
Author: Uwe Scholz <uwescholz src gnome org>
Date:   Sat Jun 4 22:32:35 2016 +0200

    Adds con_list_visibility option to GSettings (now known as show-devlist)

 data/org.gnome.gnome-commander.gschema.xml |    6 +++---
 src/gnome-cmd-data.cc                      |   23 +++++++++++++++++++++--
 src/gnome-cmd-data.h                       |    1 +
 src/gnome-cmd-user-actions.cc              |    1 +
 4 files changed, 26 insertions(+), 5 deletions(-)
---
diff --git a/data/org.gnome.gnome-commander.gschema.xml b/data/org.gnome.gnome-commander.gschema.xml
index 110fe07..7e72a00 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -194,10 +194,10 @@
       <summary>Show device buttons</summary>
       <description>Defines if device buttons are shown.</description>
     </key>
-    <key name="con-list-visibility" type="b">
+    <key name="show-devlist" type="b">
       <default>true</default>
-      <summary></summary>
-      <description></description>
+      <summary>Show device list</summary>
+      <description>Defines if list of devices is shown.</description>
     </key>
     <key name="cmdline-visibility" type="b">
       <default>true</default>
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index cd569b8..0f7696d 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -205,6 +205,17 @@ void on_show_devbuttons_changed ()
     main_win->fs(INACTIVE)->update_show_devbuttons();
 }
 
+void on_show_devlist_changed ()
+{
+    gboolean show_devlist;
+
+    show_devlist = g_settings_get_boolean (gnome_cmd_data.options.gcmd_settings->general, 
GCMD_SETTINGS_SHOW_DEVLIST);
+    gnome_cmd_data.concombo_visibility = show_devlist;
+
+    main_win->fs(ACTIVE)->update_concombo_visibility();
+    main_win->fs(INACTIVE)->update_concombo_visibility();
+}
+
 void on_horizontal_orientation_changed ()
 {
     gboolean horizontal_orientation;
@@ -328,6 +339,11 @@ static void gcmd_connect_gsettings_signals(GcmdSettings *gs)
                       NULL);
 
     g_signal_connect (gs->general,
+                      "changed::show-devlist",
+                      G_CALLBACK (on_show_devlist_changed),
+                      NULL);
+
+    g_signal_connect (gs->general,
                       "changed::horizontal-orientation",
                       G_CALLBACK (on_horizontal_orientation_changed),
                       NULL);
@@ -1787,6 +1803,9 @@ void GnomeCmdData::migrate_all_data_to_gsettings()
         //conbuttons_visibility
         migrate_data_int_value_into_gsettings(gnome_cmd_data_get_bool ("/options/conbuttons_visibility", 
TRUE) ? 1 : 0,
                                                         options.gcmd_settings->general, 
GCMD_SETTINGS_SHOW_DEVBUTTONS);
+        //con_list_visibility
+        migrate_data_int_value_into_gsettings(gnome_cmd_data_get_bool ("/options/con_list_visibility", TRUE) 
? 1 : 0,
+                                                        options.gcmd_settings->general, 
GCMD_SETTINGS_SHOW_DEVLIST);
         // 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
@@ -1975,7 +1994,7 @@ void GnomeCmdData::load()
 
     toolbar_visibility = gnome_cmd_data_get_bool ("/programs/toolbar_visibility", TRUE);
     show_devbuttons = g_settings_get_boolean (options.gcmd_settings->general, GCMD_SETTINGS_SHOW_DEVBUTTONS);
-    concombo_visibility = gnome_cmd_data_get_bool ("/options/con_list_visibility", TRUE);
+    concombo_visibility = g_settings_get_boolean (options.gcmd_settings->general, 
GCMD_SETTINGS_SHOW_DEVLIST);
     cmdline_visibility = gnome_cmd_data_get_bool ("/options/cmdline_visibility", TRUE);
     buttonbar_visibility = gnome_cmd_data_get_bool ("/programs/buttonbar_visibility", TRUE);
 
@@ -2511,7 +2530,7 @@ void GnomeCmdData::save()
 
     gnome_cmd_data_set_bool   ("/programs/toolbar_visibility", toolbar_visibility);
     set_gsettings_when_changed      (options.gcmd_settings->general, GCMD_SETTINGS_SHOW_DEVBUTTONS, 
&(show_devbuttons));
-    gnome_cmd_data_set_bool   ("/options/con_list_visibility", concombo_visibility);
+    set_gsettings_when_changed      (options.gcmd_settings->general, GCMD_SETTINGS_SHOW_DEVLIST, 
&(concombo_visibility));
     gnome_cmd_data_set_bool   ("/options/cmdline_visibility", cmdline_visibility);
     gnome_cmd_data_set_bool   ("/programs/buttonbar_visibility", buttonbar_visibility);
 
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index 35fcea1..0462286 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -75,6 +75,7 @@ GcmdSettings *gcmd_settings_new (void);
 #define GCMD_SETTINGS_CMDLINE_HISTORY_LENGTH          "cmdline-history-length"
 #define GCMD_SETTINGS_HORIZONTAL_ORIENTATION          "horizontal-orientation"
 #define GCMD_SETTINGS_SHOW_DEVBUTTONS                 "show-devbuttons"
+#define GCMD_SETTINGS_SHOW_DEVLIST                    "show-devlist"
 
 #define GCMD_PREF_FILTER                              "org.gnome.gnome-commander.preferences.filter"
 #define GCMD_SETTINGS_FILTER_HIDE_UNKNOWN             "hide-unknown"
diff --git a/src/gnome-cmd-user-actions.cc b/src/gnome-cmd-user-actions.cc
index 6adbec3..ba555d5 100644
--- a/src/gnome-cmd-user-actions.cc
+++ b/src/gnome-cmd-user-actions.cc
@@ -1547,6 +1547,7 @@ void view_concombo (GtkMenuItem *menuitem, gpointer not_used)
 
     GtkCheckMenuItem *checkitem = (GtkCheckMenuItem *) menuitem;
     gnome_cmd_data.concombo_visibility = checkitem->active;
+    g_settings_set_boolean (gcmd_user_actions.settings->general, GCMD_SETTINGS_SHOW_DEVLIST, 
gnome_cmd_data.concombo_visibility);
     get_fs (ACTIVE)->update_concombo_visibility();
     get_fs (INACTIVE)->update_concombo_visibility();
 }


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