[gnome-commander/GSettings] Adds list_orientation option to GSettings (now known as horizontal-orientation)



commit 9270b01aef415fce94dc9e0c14f2538039740339
Author: Uwe Scholz <uwescholz src gnome org>
Date:   Mon May 30 22:54:49 2016 +0200

    Adds list_orientation option to GSettings (now known as horizontal-orientation)

 data/org.gnome.gnome-commander.gschema.xml |    8 +++++---
 src/gnome-cmd-data.cc                      |   22 ++++++++++++++++++++--
 src/gnome-cmd-data.h                       |    1 +
 3 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 4ab9010..420ba7f 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -177,10 +177,12 @@
       <default>16</default>
       <summary>Commandline history length</summary>
     </key>
-    <key name="list-orientation" type="b">
+    <key name="horizontal-orientation" type="b">
       <default>false</default>
-      <summary></summary>
-      <description></description>
+      <summary>Horizontal orientation</summary>
+      <description>
+          Defines if the orientation of the file panes should be horizontal or not.
+      </description>
     </key>
     <key name="gui-update-rate" type="i">
       <default l10n="messages">100</default>
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 23f4df4..d8c320e 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -195,6 +195,16 @@ void on_icon_size_changed ()
     main_win->update_view();
 }
 
+void on_list_orientation_changed ()
+{
+    gboolean list_orientation;
+
+    list_orientation = g_settings_get_boolean (gnome_cmd_data.options.gcmd_settings->general, 
GCMD_SETTINGS_LIST_ORIENTATION);
+    gnome_cmd_data.list_orientation = list_orientation;
+
+    main_win->update_list_orientation();
+}
+
 static void gcmd_settings_class_init (GcmdSettingsClass *klass)
 {
     GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -301,6 +311,11 @@ static void gcmd_connect_gsettings_signals(GcmdSettings *gs)
                       G_CALLBACK (on_icon_size_changed),
                       NULL);
 
+    g_signal_connect (gs->general,
+                      "changed::list-orientation",
+                      G_CALLBACK (on_list_orientation_changed),
+                      NULL);
+
 }
 
 
@@ -1750,6 +1765,9 @@ void GnomeCmdData::migrate_all_data_to_gsettings()
         //middle_mouse_button_mode
         migrate_data_int_value_into_gsettings(gnome_cmd_data_get_int ("/options/middle_mouse_button_mode", 
MIDDLE_BUTTON_GOES_UP_DIR),
                                                         options.gcmd_settings->general, 
GCMD_SETTINGS_MIDDLE_MOUSE_BUTTON_MODE);
+        //list_orientation
+        migrate_data_int_value_into_gsettings(gnome_cmd_data_get_bool ("/options/list_orientation", FALSE) ? 
1 : 0,
+                                                        options.gcmd_settings->general, 
GCMD_SETTINGS_LIST_ORIENTATION);
         // 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
@@ -1931,7 +1949,7 @@ void GnomeCmdData::load()
     options.icon_scale_quality = (GdkInterpType) g_settings_get_enum (options.gcmd_settings->general, 
GCMD_SETTINGS_ICON_SCALE_QUALITY);
     options.theme_icon_dir = g_settings_get_string(options.gcmd_settings->general, 
GCMD_SETTINGS_MIME_ICON_DIR);
     cmdline_history_length = g_settings_get_uint (options.gcmd_settings->general, 
GCMD_SETTINGS_CMDLINE_HISTORY_LENGTH);
-    list_orientation = gnome_cmd_data_get_bool ("/options/list_orientation", FALSE);
+    list_orientation = g_settings_get_boolean (options.gcmd_settings->general, 
GCMD_SETTINGS_LIST_ORIENTATION);
     gui_update_rate = gnome_cmd_data_get_int ("/options/gui_update_rate", DEFAULT_GUI_UPDATE_RATE);
     priv->main_win_pos[0] = gnome_cmd_data_get_int ("/options/main_win_pos_x", -1);
     priv->main_win_pos[1] = gnome_cmd_data_get_int ("/options/main_win_pos_y", -1);
@@ -2461,7 +2479,7 @@ void GnomeCmdData::save()
     set_gsettings_enum_when_changed (options.gcmd_settings->general, GCMD_SETTINGS_ICON_SCALE_QUALITY, 
options.icon_scale_quality);
     set_gsettings_when_changed      (options.gcmd_settings->general, GCMD_SETTINGS_MIME_ICON_DIR, 
options.theme_icon_dir);
     set_gsettings_when_changed      (options.gcmd_settings->general, GCMD_SETTINGS_CMDLINE_HISTORY_LENGTH, 
&(cmdline_history_length));
-    gnome_cmd_data_set_bool   ("/options/list_orientation", list_orientation);
+    set_gsettings_when_changed      (options.gcmd_settings->general, GCMD_SETTINGS_LIST_ORIENTATION, 
&(list_orientation));
     gnome_cmd_data_set_int    ("/options/gui_update_rate", gui_update_rate);
 
     gnome_cmd_data_set_bool   ("/programs/honor_expect_uris", options.honor_expect_uris);
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index ee1bcc0..3ae5b03 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -73,6 +73,7 @@ GcmdSettings *gcmd_settings_new (void);
 #define GCMD_SETTINGS_ICON_SCALE_QUALITY              "icon-scale-quality"
 #define GCMD_SETTINGS_MIME_ICON_DIR                   "mime-icon-dir"
 #define GCMD_SETTINGS_CMDLINE_HISTORY_LENGTH          "cmdline-history-length"
+#define GCMD_SETTINGS_LIST_ORIENTATION                "horizontal-orientation"
 
 #define GCMD_PREF_FILTER                              "org.gnome.gnome-commander.preferences.filter"
 #define GCMD_SETTINGS_FILTER_HIDE_UNKNOWN             "hide-unknown"


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