[gnome-commander/GSettings] Adds confirm_mouse_dnd to GSettings (now known as confirm-mouse-drag-and-drop)



commit 7457b9aee431960566bbe14c5d5a6d109e34ddaa
Author: Uwe Scholz <uwescholz src gnome org>
Date:   Sun Jun 19 13:25:55 2016 +0200

    Adds confirm_mouse_dnd to GSettings (now known as confirm-mouse-drag-and-drop)

 data/org.gnome.gnome-commander.gschema.xml |    8 +++++---
 src/gnome-cmd-data.cc                      |   20 ++++++++++++++++++--
 src/gnome-cmd-data.h                       |    1 +
 3 files changed, 24 insertions(+), 5 deletions(-)
---
diff --git a/data/org.gnome.gnome-commander.gschema.xml b/data/org.gnome.gnome-commander.gschema.xml
index d871d18..c15536e 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -384,10 +384,12 @@
         This option defines the default behavior when items will be overwritten by a move command.
       </description>
     </key>
-    <key name="confirm-mouse-dnd" type="b">
+    <key name="confirm-mouse-drag-and-drop" type="b">
       <default l10n="messages">true</default>
-      <summary></summary>
-      <description></description>
+      <summary>Confirm mouse drag and drop</summary>
+      <description>
+          This options defines the behavior of mouse drag and drop operations.
+      </description>
     </key>
   </schema>
   <schema gettext-domain="gnome-commander" id="org.gnome.gnome-commander.preferences.filter" 
path="/org/gnome/gnome-commander/preferences/filter/">
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index ba81b73..4373706 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -308,6 +308,14 @@ void on_confirm_move_overwrite_changed ()
     gnome_cmd_data.options.confirm_move_overwrite = (GnomeCmdConfirmOverwriteMode) confirm_move_overwrite;
 }
 
+void on_mouse_drag_and_drop_changed ()
+{
+    gboolean confirm_mouse_dnd;
+
+    confirm_mouse_dnd = g_settings_get_boolean (gnome_cmd_data.options.gcmd_settings->confirm, 
GCMD_SETTINGS_CONFIRM_MOUSE_DRAG_AND_DROP);
+    gnome_cmd_data.options.confirm_mouse_dnd = confirm_mouse_dnd;
+}
+
 void on_symlink_string_changed ()
 {
     gnome_cmd_data.options.symlink_prefix = g_settings_get_string 
(gnome_cmd_data.options.gcmd_settings->general, GCMD_SETTINGS_SYMLINK_PREFIX);
@@ -484,6 +492,11 @@ static void gcmd_connect_gsettings_signals(GcmdSettings *gs)
                       G_CALLBACK (on_confirm_move_overwrite_changed),
                       NULL);
 
+    g_signal_connect (gs->confirm,
+                      "changed::confirm-mouse-drag-and-drop",
+                      G_CALLBACK (on_mouse_drag_and_drop_changed),
+                      NULL);
+
 }
 
 
@@ -2003,6 +2016,9 @@ void GnomeCmdData::migrate_all_data_to_gsettings()
         //confirm_move_overwrite
         migrate_data_int_value_into_gsettings(gnome_cmd_data_get_int ("/confirm/move_overwrite", 
GNOME_CMD_CONFIRM_OVERWRITE_QUERY),
                                                         options.gcmd_settings->confirm, 
GCMD_SETTINGS_CONFIRM_MOVE_OVERWRITE);
+        //confirm_mouse_dnd
+        migrate_data_int_value_into_gsettings(gnome_cmd_data_get_bool ("/confirm/confirm_mouse_dnd", TRUE) ? 
1 : 0,
+                                                        options.gcmd_settings->confirm, 
GCMD_SETTINGS_CONFIRM_MOUSE_DRAG_AND_DROP);
         // 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
@@ -2115,7 +2131,7 @@ void GnomeCmdData::load()
     options.confirm_delete_default = (GtkButtonsType) g_settings_get_enum (options.gcmd_settings->confirm, 
GCMD_SETTINGS_CONFIRM_DELETE_DEFAULT);
     options.confirm_copy_overwrite = (GnomeCmdConfirmOverwriteMode) g_settings_get_enum 
(options.gcmd_settings->confirm, GCMD_SETTINGS_CONFIRM_COPY_OVERWRITE);
     options.confirm_move_overwrite = (GnomeCmdConfirmOverwriteMode) g_settings_get_enum 
(options.gcmd_settings->confirm, GCMD_SETTINGS_CONFIRM_MOVE_OVERWRITE);
-    options.confirm_mouse_dnd = gnome_cmd_data_get_bool ("/confirm/confirm_mouse_dnd", TRUE);
+    options.confirm_mouse_dnd = g_settings_get_boolean (options.gcmd_settings->confirm, 
GCMD_SETTINGS_CONFIRM_MOUSE_DRAG_AND_DROP);
 
     options.filter.file_types[GNOME_VFS_FILE_TYPE_UNKNOWN] = g_settings_get_boolean 
(options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_UNKNOWN);
     options.filter.file_types[GNOME_VFS_FILE_TYPE_REGULAR] = g_settings_get_boolean 
(options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_REGULAR);
@@ -2662,7 +2678,7 @@ void GnomeCmdData::save()
     set_gsettings_enum_when_changed (options.gcmd_settings->confirm, GCMD_SETTINGS_CONFIRM_DELETE_DEFAULT, 
options.confirm_delete_default);
     set_gsettings_enum_when_changed (options.gcmd_settings->confirm, GCMD_SETTINGS_CONFIRM_COPY_OVERWRITE, 
options.confirm_copy_overwrite);
     set_gsettings_enum_when_changed (options.gcmd_settings->confirm, GCMD_SETTINGS_CONFIRM_MOVE_OVERWRITE, 
options.confirm_move_overwrite);
-    gnome_cmd_data_set_bool   ("/confirm/confirm_mouse_dnd", options.confirm_mouse_dnd);
+    set_gsettings_when_changed      (options.gcmd_settings->confirm, 
GCMD_SETTINGS_CONFIRM_MOUSE_DRAG_AND_DROP, &(options.confirm_mouse_dnd));
 
     set_gsettings_when_changed      (options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_UNKNOWN, 
&(options.filter.file_types[GNOME_VFS_FILE_TYPE_UNKNOWN]));
     set_gsettings_when_changed      (options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_REGULAR, 
&(options.filter.file_types[GNOME_VFS_FILE_TYPE_REGULAR]));
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index cc8a313..d7ac281 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -107,6 +107,7 @@ GcmdSettings *gcmd_settings_new (void);
 #define GCMD_SETTINGS_CONFIRM_DELETE_DEFAULT          "confirm-delete-default"
 #define GCMD_SETTINGS_CONFIRM_COPY_OVERWRITE          "confirm-copy-overwrite"
 #define GCMD_SETTINGS_CONFIRM_MOVE_OVERWRITE          "confirm-move-overwrite"
+#define GCMD_SETTINGS_CONFIRM_MOUSE_DRAG_AND_DROP     "confirm-mouse-drag-and-drop"
 
 struct GnomeCmdConRemote;
 


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