[gnome-commander/GSettings] Adds left_mouse_button_mode option to GSettings (now known as clicks-to-open-item)



commit 35db3c00cd77dcc900801f044ac103ae0283ade6
Author: Uwe Scholz <uwescholz src gnome org>
Date:   Sat May 21 22:19:11 2016 +0200

    Adds left_mouse_button_mode option to GSettings (now known as clicks-to-open-item)

 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 d83edfe..11cc7b0 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -45,6 +45,11 @@
     <value nick="both columns" value="2"/>
   </enum>
 
+  <enum id="org.gnome.gnome-commander.preferences.general.clicks-to-open-item">
+    <value nick="single" value="0"/>
+    <value nick="double" value="1"/>
+  </enum>
+
   <schema gettext-domain="gnome-commander" id="org.gnome.gnome-commander.preferences.general" 
path="/org/gnome/gnome-commander/preferences/general/">
     <key name="use-default-font" type="b">
       <default>true</default>
@@ -110,10 +115,12 @@
           Defines where the file name extension is displayed.
       </description>
     </key>
-    <key name="left-mouse-button-mode" type="i">
-      <default l10n="messages">1</default>
-      <summary></summary>
-      <description></description>
+    <key name="clicks-to-open-item" enum='org.gnome.gnome-commander.preferences.general.clicks-to-open-item'>
+      <default>'double'</default>
+      <summary>Clicks to open an item</summary>
+      <description>
+          Number of clicks for opening a file or folder.
+      </description>
     </key>
     <key name="left-mouse-button-unselects" type="b">
       <default>true</default>
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index e97451c..5108983 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -1669,6 +1669,9 @@ void GnomeCmdData::migrate_all_data_to_gsettings()
         //ext_disp_mode
         migrate_data_int_value_into_gsettings(gnome_cmd_data_get_int ("/options/ext_disp_mode", 
GNOME_CMD_EXT_DISP_BOTH),
                                                         options.gcmd_settings->general, 
GCMD_SETTINGS_EXT_DISP_MODE);
+        //left_mouse_button_mode
+        migrate_data_int_value_into_gsettings(gnome_cmd_data_get_int ("/options/left_mouse_button_mode", 
LEFT_BUTTON_OPENS_WITH_DOUBLE_CLICK),
+                                                        options.gcmd_settings->general, 
GCMD_SETTINGS_CLICKS_TO_OPEN_ITEM);
         // 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
@@ -1844,7 +1847,7 @@ void GnomeCmdData::load()
     options.list_font = g_settings_get_string (options.gcmd_settings->general, GCMD_SETTINGS_LIST_FONT);
 
     options.ext_disp_mode = (GnomeCmdExtDispMode) g_settings_get_enum (options.gcmd_settings->general, 
GCMD_SETTINGS_EXT_DISP_MODE);
-    options.left_mouse_button_mode = (LeftMouseButtonMode) gnome_cmd_data_get_int 
("/options/left_mouse_button_mode", LEFT_BUTTON_OPENS_WITH_DOUBLE_CLICK);
+    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 = gnome_cmd_data_get_bool ("/options/left_mouse_button_unselects", 
TRUE);
     options.middle_mouse_button_mode = (MiddleMouseButtonMode) gnome_cmd_data_get_int 
("/options/middle_mouse_button_mode", MIDDLE_BUTTON_GOES_UP_DIR);
     options.right_mouse_button_mode = (RightMouseButtonMode) gnome_cmd_data_get_int 
("/options/right_mouse_button_mode", RIGHT_BUTTON_POPUPS_MENU);
@@ -2378,7 +2381,7 @@ void GnomeCmdData::save()
     set_gsettings_when_changed      (options.gcmd_settings->general, GCMD_SETTINGS_LIST_FONT, 
options.list_font);
 
     set_gsettings_enum_when_changed (options.gcmd_settings->general, GCMD_SETTINGS_EXT_DISP_MODE, 
options.ext_disp_mode);
-    gnome_cmd_data_set_int    ("/options/left_mouse_button_mode", options.left_mouse_button_mode);
+    set_gsettings_enum_when_changed      (options.gcmd_settings->general, GCMD_SETTINGS_CLICKS_TO_OPEN_ITEM, 
options.left_mouse_button_mode);
     gnome_cmd_data_set_bool   ("/options/left_mouse_button_unselects", options.left_mouse_button_unselects);
     gnome_cmd_data_set_int    ("/options/middle_mouse_button_mode", options.middle_mouse_button_mode);
     gnome_cmd_data_set_int    ("/options/right_mouse_button_mode", options.right_mouse_button_mode);
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index 0358b32..a0963e9 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -64,6 +64,7 @@ GcmdSettings *gcmd_settings_new (void);
 #define GCMD_SETTINGS_DATE_DISP_FORMAT                "date-disp-format"
 #define GCMD_SETTINGS_LIST_FONT                       "list-font"
 #define GCMD_SETTINGS_EXT_DISP_MODE                   "extension-display-mode"
+#define GCMD_SETTINGS_CLICKS_TO_OPEN_ITEM             "clicks-to-open-item"
 
 #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]