[gnome-commander/GSettings] Adds left_mouse_button_unselects option to GSettings (now known as left-mouse-btn-unselects)



commit b08a4417c7307d555114daf0d46e3990669fb3a9
Author: Uwe Scholz <uwescholz src gnome org>
Date:   Sat May 21 22:51:08 2016 +0200

    Adds left_mouse_button_unselects option to GSettings (now known as left-mouse-btn-unselects)

 data/org.gnome.gnome-commander.gschema.xml |    8 +++++---
 src/gnome-cmd-data.cc                      |    9 ++++++---
 src/gnome-cmd-data.h                       |    1 +
 3 files changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/data/org.gnome.gnome-commander.gschema.xml b/data/org.gnome.gnome-commander.gschema.xml
index 11cc7b0..b12e769 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -122,10 +122,12 @@
           Number of clicks for opening a file or folder.
       </description>
     </key>
-    <key name="left-mouse-button-unselects" type="b">
+    <key name="left-mouse-btn-unselects" type="b">
       <default>true</default>
-      <summary></summary>
-      <description></description>
+      <summary>Left mouse button unselects</summary>
+      <description>
+          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>
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 5108983..d658ad2 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -1672,6 +1672,9 @@ void GnomeCmdData::migrate_all_data_to_gsettings()
         //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);
+        //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);
         // 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
@@ -1848,7 +1851,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 = gnome_cmd_data_get_bool ("/options/left_mouse_button_unselects", 
TRUE);
+    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.icon_size = gnome_cmd_data_get_int ("/options/icon_size", 16);
@@ -2381,8 +2384,8 @@ 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);
-    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);
+    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);
     gnome_cmd_data_set_int    ("/options/icon_size", options.icon_size);
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index a0963e9..c6b71a3 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -65,6 +65,7 @@ GcmdSettings *gcmd_settings_new (void);
 #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_SETTINGS_LEFT_MOUSE_BUTTON_UNSELECTS     "left-mouse-btn-unselects"
 
 #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]