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



commit a576a084c7b4d7224c873f61711cea862416cea0
Author: Uwe Scholz <uwescholz src gnome org>
Date:   Sun Jun 5 18:30:19 2016 +0200

    Adds buttonbar_visibility option to GSettings (now known as show-buttonbar)

 data/org.gnome.gnome-commander.gschema.xml |   10 +++++-----
 src/gnome-cmd-data.cc                      |   21 +++++++++++++++++++--
 src/gnome-cmd-data.h                       |    1 +
 src/gnome-cmd-user-actions.cc              |    3 +--
 4 files changed, 26 insertions(+), 9 deletions(-)
---
diff --git a/data/org.gnome.gnome-commander.gschema.xml b/data/org.gnome.gnome-commander.gschema.xml
index cda97a1..a84341d 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -209,6 +209,11 @@
       <summary>Show toolbar</summary>
       <description>Defines if the toolbar is shown.</description>
     </key>
+    <key name="show-buttonbar" type="b">
+      <default l10n="messages">true</default>
+      <summary>Show buttonbar</summary>
+      <description>Defines if the buttonbar is shown.</description>
+    </key>
     <key name="symlink-prefix" type="s">
       <default l10n="messages">''</default>
       <summary></summary>
@@ -408,11 +413,6 @@
       <summary></summary>
       <description></description>
     </key>
-    <key name="buttonbar-visibility" type="b">
-      <default l10n="messages">true</default>
-      <summary></summary>
-      <description></description>
-    </key>
     <key name="viewer" type="s">
       <default l10n="messages">'scite %s'</default>
       <summary></summary>
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 19da652..6bcb1b2 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -234,6 +234,15 @@ void on_show_toolbar_changed ()
     }
 }
 
+void on_show_buttonbar_changed ()
+{
+    if (gnome_cmd_data.buttonbar_visibility != g_settings_get_boolean 
(gnome_cmd_data.options.gcmd_settings->general, GCMD_SETTINGS_SHOW_BUTTONBAR))
+    {
+        gnome_cmd_data.buttonbar_visibility = g_settings_get_boolean 
(gnome_cmd_data.options.gcmd_settings->general, GCMD_SETTINGS_SHOW_BUTTONBAR);
+        main_win->update_buttonbar_visibility();
+    }
+}
+
 void on_horizontal_orientation_changed ()
 {
     gboolean horizontal_orientation;
@@ -372,6 +381,11 @@ static void gcmd_connect_gsettings_signals(GcmdSettings *gs)
                       NULL);
 
     g_signal_connect (gs->general,
+                      "changed::show-buttonbar",
+                      G_CALLBACK (on_show_buttonbar_changed),
+                      NULL);
+
+    g_signal_connect (gs->general,
                       "changed::horizontal-orientation",
                       G_CALLBACK (on_horizontal_orientation_changed),
                       NULL);
@@ -1840,6 +1854,9 @@ void GnomeCmdData::migrate_all_data_to_gsettings()
         //toolbar_visibility
         migrate_data_int_value_into_gsettings(gnome_cmd_data_get_bool ("/programs/toolbar_visibility", TRUE) 
? 1 : 0,
                                                         options.gcmd_settings->general, 
GCMD_SETTINGS_SHOW_TOOLBAR);
+        //buttonbar_visibility
+        migrate_data_int_value_into_gsettings(gnome_cmd_data_get_bool ("/programs/buttonbar_visibility", 
TRUE) ? 1 : 0,
+                                                        options.gcmd_settings->general, 
GCMD_SETTINGS_SHOW_BUTTONBAR);
         // 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
@@ -2030,7 +2047,7 @@ void GnomeCmdData::load()
     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 = g_settings_get_boolean (options.gcmd_settings->general, GCMD_SETTINGS_SHOW_CMDLINE);
-    buttonbar_visibility = gnome_cmd_data_get_bool ("/programs/buttonbar_visibility", TRUE);
+    buttonbar_visibility = g_settings_get_boolean (options.gcmd_settings->general, 
GCMD_SETTINGS_SHOW_BUTTONBAR);
 
     if (gui_update_rate < MIN_GUI_UPDATE_RATE)
         gui_update_rate = MIN_GUI_UPDATE_RATE;
@@ -2566,7 +2583,7 @@ void GnomeCmdData::save()
     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));
     set_gsettings_when_changed      (options.gcmd_settings->general, GCMD_SETTINGS_SHOW_CMDLINE, 
&(cmdline_visibility));
-    gnome_cmd_data_set_bool   ("/programs/buttonbar_visibility", buttonbar_visibility);
+    set_gsettings_when_changed      (options.gcmd_settings->general, GCMD_SETTINGS_SHOW_BUTTONBAR, 
&(buttonbar_visibility));
 
     if (priv->symlink_prefix && *priv->symlink_prefix && strcmp(priv->symlink_prefix, _("link to %s"))!=0)
         gnome_cmd_data_set_string ("/options/symlink_prefix", priv->symlink_prefix);
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index 9dcc3b1..65dcf04 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -78,6 +78,7 @@ GcmdSettings *gcmd_settings_new (void);
 #define GCMD_SETTINGS_SHOW_DEVLIST                    "show-devlist"
 #define GCMD_SETTINGS_SHOW_CMDLINE                    "show-cmdline"
 #define GCMD_SETTINGS_SHOW_TOOLBAR                    "show-toolbar"
+#define GCMD_SETTINGS_SHOW_BUTTONBAR                  "show-buttonbar"
 
 #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 2ee97f6..d40b961 100644
--- a/src/gnome-cmd-user-actions.cc
+++ b/src/gnome-cmd-user-actions.cc
@@ -1562,8 +1562,7 @@ void view_buttonbar (GtkMenuItem *menuitem, gpointer not_used)
     if (!GTK_WIDGET_REALIZED (main_win)) return;
 
     GtkCheckMenuItem *checkitem = (GtkCheckMenuItem *) menuitem;
-    gnome_cmd_data.buttonbar_visibility = checkitem->active;
-    main_win->update_buttonbar_visibility();
+    g_settings_set_boolean (gcmd_user_actions.settings->general, GCMD_SETTINGS_SHOW_BUTTONBAR, 
checkitem->active);
 }
 
 


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