[gnome-commander/GSettings] Adds confirm_move_overwrite to GSettings (now known as confirm-move-overwrite)



commit cb8e7d003f743c659a1429d1d9e0e458c96dacc5
Author: Uwe Scholz <uwescholz src gnome org>
Date:   Sun Jun 19 12:57:11 2016 +0200

    Adds confirm_move_overwrite to GSettings (now known as confirm-move-overwrite)

 data/org.gnome.gnome-commander.gschema.xml |   14 ++++++++------
 src/gnome-cmd-data.cc                      |   20 ++++++++++++++++++--
 src/gnome-cmd-data.h                       |    1 +
 3 files changed, 27 insertions(+), 8 deletions(-)
---
diff --git a/data/org.gnome.gnome-commander.gschema.xml b/data/org.gnome.gnome-commander.gschema.xml
index b704ed5..d871d18 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -78,7 +78,7 @@
     <value nick="delete" value="1"/>
   </enum>
 
-  <enum id="org.gnome.gnome-commander.preferences.confirmation.confirm-copy-overwrite-enum">
+  <enum id="org.gnome.gnome-commander.preferences.confirmation.confirm-overwrite-enum">
     <value nick="skip all" value="0"/>
     <value nick="query" value="1"/>
     <value nick="overwrite silently" value="2"/>
@@ -370,17 +370,19 @@
           This setting defines the default active option in the delete confirmation dialog.
       </description>
     </key>
-    <key name="confirm-copy-overwrite" 
enum="org.gnome.gnome-commander.preferences.confirmation.confirm-copy-overwrite-enum">
+    <key name="confirm-copy-overwrite" 
enum="org.gnome.gnome-commander.preferences.confirmation.confirm-overwrite-enum">
       <default l10n="messages">'query'</default>
       <summary>Confirm copy overwrite</summary>
       <description>
           This option defines the default behavior when items will be overwritten by a copy command.
       </description>
     </key>
-    <key name="move-overwrite" type="i">
-      <default l10n="messages">1</default>
-      <summary></summary>
-      <description></description>
+    <key name="confirm-move-overwrite" 
enum="org.gnome.gnome-commander.preferences.confirmation.confirm-overwrite-enum">
+      <default l10n="messages">'query'</default>
+      <summary>Confirm move overwrite</summary>
+      <description>
+        This option defines the default behavior when items will be overwritten by a move command.
+      </description>
     </key>
     <key name="confirm-mouse-dnd" type="b">
       <default l10n="messages">true</default>
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 3fcb62a..ba81b73 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -300,6 +300,14 @@ void on_confirm_copy_overwrite_changed ()
     gnome_cmd_data.options.confirm_copy_overwrite = (GnomeCmdConfirmOverwriteMode) confirm_copy_overwrite;
 }
 
+void on_confirm_move_overwrite_changed ()
+{
+    gint confirm_move_overwrite;
+
+    confirm_move_overwrite = g_settings_get_enum (gnome_cmd_data.options.gcmd_settings->confirm, 
GCMD_SETTINGS_CONFIRM_MOVE_OVERWRITE);
+    gnome_cmd_data.options.confirm_move_overwrite = (GnomeCmdConfirmOverwriteMode) confirm_move_overwrite;
+}
+
 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);
@@ -471,6 +479,11 @@ static void gcmd_connect_gsettings_signals(GcmdSettings *gs)
                       G_CALLBACK (on_confirm_copy_overwrite_changed),
                       NULL);
 
+    g_signal_connect (gs->confirm,
+                      "changed::confirm-move-overwrite",
+                      G_CALLBACK (on_confirm_move_overwrite_changed),
+                      NULL);
+
 }
 
 
@@ -1987,6 +2000,9 @@ void GnomeCmdData::migrate_all_data_to_gsettings()
         //confirm_copy_overwrite
         migrate_data_int_value_into_gsettings(gnome_cmd_data_get_int ("/confirm/copy_overwrite", 
GNOME_CMD_CONFIRM_OVERWRITE_QUERY),
                                                         options.gcmd_settings->confirm, 
GCMD_SETTINGS_CONFIRM_COPY_OVERWRITE);
+        //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);
         // 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
@@ -2098,7 +2114,7 @@ void GnomeCmdData::load()
     options.confirm_delete = g_settings_get_boolean (options.gcmd_settings->confirm, 
GCMD_SETTINGS_CONFIRM_DELETE);
     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) gnome_cmd_data_get_int 
("/confirm/move_overwrite", GNOME_CMD_CONFIRM_OVERWRITE_QUERY);
+    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.filter.file_types[GNOME_VFS_FILE_TYPE_UNKNOWN] = g_settings_get_boolean 
(options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_HIDE_UNKNOWN);
@@ -2645,7 +2661,7 @@ void GnomeCmdData::save()
     set_gsettings_when_changed      (options.gcmd_settings->confirm, GCMD_SETTINGS_CONFIRM_DELETE, 
&(options.confirm_delete));
     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);
-    gnome_cmd_data_set_int    ("/confirm/move_overwrite", options.confirm_move_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->filter, GCMD_SETTINGS_FILTER_HIDE_UNKNOWN, 
&(options.filter.file_types[GNOME_VFS_FILE_TYPE_UNKNOWN]));
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index bbb9b52..cc8a313 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -106,6 +106,7 @@ GcmdSettings *gcmd_settings_new (void);
 #define GCMD_SETTINGS_CONFIRM_DELETE                  "confirm-delete"
 #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"
 
 struct GnomeCmdConRemote;
 


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