[gnome-commander/GSettings] Adds middle_mouse_button_mode option to GSettings (now known as middle-mouse-btn-mode)



commit f26ac89d9358485cac9674022ab2f672bf9bb1c0
Author: Uwe Scholz <uwescholz src gnome org>
Date:   Tue May 24 21:59:23 2016 +0200

    Adds middle_mouse_button_mode option to GSettings (now known as middle-mouse-btn-mode)

 data/org.gnome.gnome-commander.gschema.xml |   15 +++++++++++----
 src/gnome-cmd-data.cc                      |    7 +++++--
 src/gnome-cmd-data.h                       |    1 +
 3 files changed, 17 insertions(+), 6 deletions(-)
---
diff --git a/data/org.gnome.gnome-commander.gschema.xml b/data/org.gnome.gnome-commander.gschema.xml
index b268d51..4ab9010 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -55,6 +55,11 @@
     <value nick="select" value="1"/>
   </enum>
 
+  <enum id="org.gnome.gnome-commander.preferences.general.middle-mouse-btn-mode">
+    <value nick="parent directory" value="0"/>
+    <value nick="new tab" value="1"/>
+  </enum>
+
   <enum id="org.gnome.gnome-commander.preferences.general.icon-scale-quality">
     <value nick="GDK_INTERP_NEAREST" value="0"/>
     <value nick="GDK_INTERP_TILES" value="1"/>
@@ -247,10 +252,12 @@
       <summary></summary>
       <description></description>
     </key>
-    <key name="middle-mouse-button-mode" type="i">
-      <default l10n="messages">1</default>
-      <summary></summary>
-      <description></description>
+    <key name="middle-mouse-btn-mode" 
enum="org.gnome.gnome-commander.preferences.general.middle-mouse-btn-mode">
+      <default l10n="messages">'parent directory'</default>
+      <summary>Middle mouse button mode</summary>
+      <description>
+          Defines what happens when the middle mouse button is clicked.
+      </description>
     </key>
     <key name="save-dirs-on-exit" type="b">
       <default l10n="messages">true</default>
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 2eb8e2e..4f2d1d4 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -1747,6 +1747,9 @@ void GnomeCmdData::migrate_all_data_to_gsettings()
         //cmdline_history_length
         migrate_data_int_value_into_gsettings(gnome_cmd_data_get_int ("/options/cmdline_history_length", 16),
                                                         options.gcmd_settings->general, 
GCMD_SETTINGS_CMDLINE_HISTORY_LENGTH);
+        //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);
         // 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
@@ -1921,7 +1924,7 @@ void GnomeCmdData::load()
     options.ext_disp_mode = (GnomeCmdExtDispMode) g_settings_get_enum (options.gcmd_settings->general, 
GCMD_SETTINGS_EXT_DISP_MODE);
     options.left_mouse_button_mode = (LeftMouseButtonMode) g_settings_get_enum 
(options.gcmd_settings->general, GCMD_SETTINGS_CLICKS_TO_OPEN_ITEM);
     options.left_mouse_button_unselects = g_settings_get_boolean (options.gcmd_settings->general, 
GCMD_SETTINGS_LEFT_MOUSE_BUTTON_UNSELECTS);
-    options.middle_mouse_button_mode = (MiddleMouseButtonMode) gnome_cmd_data_get_int 
("/options/middle_mouse_button_mode", MIDDLE_BUTTON_GOES_UP_DIR);
+    options.middle_mouse_button_mode = (MiddleMouseButtonMode) g_settings_get_enum 
(options.gcmd_settings->general, GCMD_SETTINGS_MIDDLE_MOUSE_BUTTON_MODE);
     options.right_mouse_button_mode = (RightMouseButtonMode) g_settings_get_enum 
(options.gcmd_settings->general, GCMD_SETTINGS_RIGHT_MOUSE_BUTTON_MODE);
     options.icon_size = g_settings_get_uint (options.gcmd_settings->general, GCMD_SETTINGS_ICON_SIZE);
     dev_icon_size = g_settings_get_uint (options.gcmd_settings->general, GCMD_SETTINGS_DEV_ICON_SIZE);
@@ -2451,7 +2454,7 @@ void GnomeCmdData::save()
     set_gsettings_enum_when_changed (options.gcmd_settings->general, GCMD_SETTINGS_EXT_DISP_MODE, 
options.ext_disp_mode);
     set_gsettings_enum_when_changed (options.gcmd_settings->general, GCMD_SETTINGS_CLICKS_TO_OPEN_ITEM, 
options.left_mouse_button_mode);
     set_gsettings_when_changed      (options.gcmd_settings->general, 
GCMD_SETTINGS_LEFT_MOUSE_BUTTON_UNSELECTS, &(options.left_mouse_button_unselects));
-    gnome_cmd_data_set_int    ("/options/middle_mouse_button_mode", options.middle_mouse_button_mode);
+    set_gsettings_enum_when_changed (options.gcmd_settings->general, GCMD_SETTINGS_MIDDLE_MOUSE_BUTTON_MODE, 
options.middle_mouse_button_mode);
     set_gsettings_enum_when_changed (options.gcmd_settings->general, GCMD_SETTINGS_RIGHT_MOUSE_BUTTON_MODE, 
options.right_mouse_button_mode);
     set_gsettings_when_changed      (options.gcmd_settings->general, GCMD_SETTINGS_ICON_SIZE, 
&(options.icon_size));
     set_gsettings_when_changed      (options.gcmd_settings->general, GCMD_SETTINGS_DEV_ICON_SIZE, 
&(dev_icon_size));
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index 087ea07..ee1bcc0 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -67,6 +67,7 @@ GcmdSettings *gcmd_settings_new (void);
 #define GCMD_SETTINGS_CLICKS_TO_OPEN_ITEM             "clicks-to-open-item"
 #define GCMD_SETTINGS_LEFT_MOUSE_BUTTON_UNSELECTS     "left-mouse-btn-unselects"
 #define GCMD_SETTINGS_RIGHT_MOUSE_BUTTON_MODE         "right-mouse-btn-mode"
+#define GCMD_SETTINGS_MIDDLE_MOUSE_BUTTON_MODE        "middle-mouse-btn-mode"
 #define GCMD_SETTINGS_ICON_SIZE                       "icon-size"
 #define GCMD_SETTINGS_DEV_ICON_SIZE                   "dev-icon-size"
 #define GCMD_SETTINGS_ICON_SCALE_QUALITY              "icon-scale-quality"


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