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



commit 2957c5b92ab436464846480637d5f0662bfc1fe1
Author: Uwe Scholz <uwescholz src gnome org>
Date:   Sun Jun 5 00:09:29 2016 +0200

    Adds cmdline_visibility option to GSettings (now known as show-cmdline)

 data/org.gnome.gnome-commander.gschema.xml |    6 +++---
 src/gnome-cmd-data.cc                      |   21 +++++++++++++++++++--
 src/gnome-cmd-data.h                       |    1 +
 src/gnome-cmd-user-actions.cc              |    3 ++-
 4 files changed, 25 insertions(+), 6 deletions(-)
---
diff --git a/data/org.gnome.gnome-commander.gschema.xml b/data/org.gnome.gnome-commander.gschema.xml
index 7e72a00..70055f4 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -199,10 +199,10 @@
       <summary>Show device list</summary>
       <description>Defines if list of devices is shown.</description>
     </key>
-    <key name="cmdline-visibility" type="b">
+    <key name="show-cmdline" type="b">
       <default>true</default>
-      <summary></summary>
-      <description></description>
+      <summary>Show command line</summary>
+      <description>Defines if command line is shown.</description>
     </key>
     <key name="symlink-prefix" type="s">
       <default l10n="messages">''</default>
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 49e02fe..bce8c2c 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -216,6 +216,15 @@ void on_show_devlist_changed ()
     main_win->fs(INACTIVE)->update_show_devlist();
 }
 
+void on_show_cmdline_changed ()
+{
+    gboolean show_cmdline;
+
+    show_cmdline = g_settings_get_boolean (gnome_cmd_data.options.gcmd_settings->general, 
GCMD_SETTINGS_SHOW_CMDLINE);
+    gnome_cmd_data.cmdline_visibility = show_cmdline;
+    main_win->update_cmdline_visibility();
+}
+
 void on_horizontal_orientation_changed ()
 {
     gboolean horizontal_orientation;
@@ -344,6 +353,11 @@ static void gcmd_connect_gsettings_signals(GcmdSettings *gs)
                       NULL);
 
     g_signal_connect (gs->general,
+                      "changed::show-cmdline",
+                      G_CALLBACK (on_show_cmdline_changed),
+                      NULL);
+
+    g_signal_connect (gs->general,
                       "changed::horizontal-orientation",
                       G_CALLBACK (on_horizontal_orientation_changed),
                       NULL);
@@ -1806,6 +1820,9 @@ void GnomeCmdData::migrate_all_data_to_gsettings()
         //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);
+        //cmdline_visibility
+        migrate_data_int_value_into_gsettings(gnome_cmd_data_get_bool ("/options/cmdline_visibility", TRUE) 
? 1 : 0,
+                                                        options.gcmd_settings->general, 
GCMD_SETTINGS_SHOW_CMDLINE);
         // 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
@@ -1995,7 +2012,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);
     show_devlist = g_settings_get_boolean (options.gcmd_settings->general, GCMD_SETTINGS_SHOW_DEVLIST);
-    cmdline_visibility = gnome_cmd_data_get_bool ("/options/cmdline_visibility", TRUE);
+    cmdline_visibility = g_settings_get_boolean (options.gcmd_settings->general, GCMD_SETTINGS_SHOW_CMDLINE);
     buttonbar_visibility = gnome_cmd_data_get_bool ("/programs/buttonbar_visibility", TRUE);
 
     if (gui_update_rate < MIN_GUI_UPDATE_RATE)
@@ -2531,7 +2548,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));
     set_gsettings_when_changed      (options.gcmd_settings->general, GCMD_SETTINGS_SHOW_DEVLIST, 
&(show_devlist));
-    gnome_cmd_data_set_bool   ("/options/cmdline_visibility", cmdline_visibility);
+    set_gsettings_when_changed      (options.gcmd_settings->general, GCMD_SETTINGS_SHOW_CMDLINE, 
&(cmdline_visibility));
     gnome_cmd_data_set_bool   ("/programs/buttonbar_visibility", buttonbar_visibility);
 
     if (priv->symlink_prefix && *priv->symlink_prefix && strcmp(priv->symlink_prefix, _("link to %s"))!=0)
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index 96f1af5..f11b82e 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -76,6 +76,7 @@ GcmdSettings *gcmd_settings_new (void);
 #define GCMD_SETTINGS_HORIZONTAL_ORIENTATION          "horizontal-orientation"
 #define GCMD_SETTINGS_SHOW_DEVBUTTONS                 "show-devbuttons"
 #define GCMD_SETTINGS_SHOW_DEVLIST                    "show-devlist"
+#define GCMD_SETTINGS_SHOW_CMDLINE                    "show-cmdline"
 
 #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 2a7c839..2e5a5f1 100644
--- a/src/gnome-cmd-user-actions.cc
+++ b/src/gnome-cmd-user-actions.cc
@@ -1579,7 +1579,8 @@ void view_cmdline (GtkMenuItem *menuitem, gpointer not_used)
 
     GtkCheckMenuItem *checkitem = (GtkCheckMenuItem *) menuitem;
     gnome_cmd_data.cmdline_visibility = checkitem->active;
-    main_win->update_cmdline_visibility();
+    g_settings_set_boolean (gcmd_user_actions.settings->general, GCMD_SETTINGS_SHOW_CMDLINE, 
gnome_cmd_data.cmdline_visibility);
+    /* main_win->update_cmdline_visibility(); is executed by on_show_cmdline_changed() */
 }
 
 


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