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



commit b915edba5b47e63d9d4b360233406e5cbb4cbf76
Author: Uwe Scholz <uwescholz src gnome org>
Date:   Sat May 21 23:09:57 2016 +0200

    Adds right_mouse_button_mode option to GSettings (now known as right-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 b12e769..1ddd381 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -50,6 +50,11 @@
     <value nick="double" value="1"/>
   </enum>
 
+  <enum id="org.gnome.gnome-commander.preferences.general.right-mouse-btn-mode">
+    <value nick="popup" value="0"/>
+    <value nick="select" 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>
@@ -129,10 +134,12 @@
           Defines if a click on an unselected item unselects already selected items.
       </description>
     </key>
-    <key name="right-mouse-button-mode" type="i">
-      <default l10n="messages">0</default>
-      <summary></summary>
-      <description></description>
+    <key name="right-mouse-btn-mode" 
enum='org.gnome.gnome-commander.preferences.general.right-mouse-btn-mode'>
+      <default l10n="messages">'popup'</default>
+      <summary>Right mouse button mode</summary>
+      <description>
+        Defines what happens when the right mouse button is clicked on an item.
+      </description>
     </key>
     <key name="icon-size" type="i">
       <default l10n="messages">16</default>
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index d658ad2..59459b9 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -1675,6 +1675,9 @@ void GnomeCmdData::migrate_all_data_to_gsettings()
         //left_mouse_button_unselects
         migrate_data_int_value_into_gsettings(gnome_cmd_data_get_bool 
("/options/left_mouse_button_unselects", TRUE) ? 1 : 0,
                                                         options.gcmd_settings->general, 
GCMD_SETTINGS_LEFT_MOUSE_BUTTON_UNSELECTS);
+        //right_mouse_button_mode
+        migrate_data_int_value_into_gsettings(gnome_cmd_data_get_int ("/options/right_mouse_button_mode", 
LEFT_BUTTON_OPENS_WITH_DOUBLE_CLICK),
+                                                        options.gcmd_settings->general, 
GCMD_SETTINGS_RIGHT_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
@@ -1853,7 +1856,7 @@ void GnomeCmdData::load()
     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.right_mouse_button_mode = (RightMouseButtonMode) gnome_cmd_data_get_int 
("/options/right_mouse_button_mode", RIGHT_BUTTON_POPUPS_MENU);
+    options.right_mouse_button_mode = (RightMouseButtonMode) g_settings_get_enum 
(options.gcmd_settings->general, GCMD_SETTINGS_RIGHT_MOUSE_BUTTON_MODE);
     options.icon_size = gnome_cmd_data_get_int ("/options/icon_size", 16);
     dev_icon_size = gnome_cmd_data_get_int ("/options/dev_icon_size", 16);
     options.icon_scale_quality = (GdkInterpType) gnome_cmd_data_get_int ("/options/icon_scale_quality", 
GDK_INTERP_HYPER);
@@ -2387,7 +2390,7 @@ void GnomeCmdData::save()
     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);
-    gnome_cmd_data_set_int    ("/options/right_mouse_button_mode", options.right_mouse_button_mode);
+    set_gsettings_enum_when_changed (options.gcmd_settings->general, GCMD_SETTINGS_RIGHT_MOUSE_BUTTON_MODE, 
options.right_mouse_button_mode);
     gnome_cmd_data_set_int    ("/options/icon_size", options.icon_size);
     gnome_cmd_data_set_int    ("/options/dev_icon_size", dev_icon_size);
     gnome_cmd_data_set_int    ("/options/icon_scale_quality", options.icon_scale_quality);
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index c6b71a3..8d25931 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -66,6 +66,7 @@ GcmdSettings *gcmd_settings_new (void);
 #define GCMD_SETTINGS_EXT_DISP_MODE                   "extension-display-mode"
 #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_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]