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



commit a2d686392183a35acc9331359e9e4ca3b9a78af5
Author: Uwe Scholz <uwescholz src gnome org>
Date:   Sun Jun 19 12:42:30 2016 +0200

    Adds confirm_copy_overwrite to GSettings (now known as confirm-copy-overwrite)

 data/org.gnome.gnome-commander.gschema.xml |   16 ++++++++++++----
 src/gnome-cmd-data.cc                      |   20 ++++++++++++++++++--
 src/gnome-cmd-data.h                       |    1 +
 3 files changed, 31 insertions(+), 6 deletions(-)
---
diff --git a/data/org.gnome.gnome-commander.gschema.xml b/data/org.gnome.gnome-commander.gschema.xml
index d099d10..b704ed5 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -78,6 +78,12 @@
     <value nick="delete" value="1"/>
   </enum>
 
+  <enum id="org.gnome.gnome-commander.preferences.confirmation.confirm-copy-overwrite-enum">
+    <value nick="skip all" value="0"/>
+    <value nick="query" value="1"/>
+    <value nick="overwrite silently" value="2"/>
+  </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>
@@ -364,10 +370,12 @@
           This setting defines the default active option in the delete confirmation dialog.
       </description>
     </key>
-    <key name="copy-overwrite" type="i">
-      <default l10n="messages">1</default>
-      <summary></summary>
-      <description></description>
+    <key name="confirm-copy-overwrite" 
enum="org.gnome.gnome-commander.preferences.confirmation.confirm-copy-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>
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 6feb035..96bcd2e 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -292,6 +292,14 @@ void on_confirm_delete_default_changed ()
     gnome_cmd_data.options.confirm_delete_default = (GtkButtonsType) confirm_delete_default;
 }
 
+void on_confirm_copy_overwrite_changed ()
+{
+    gint confirm_copy_overwrite;
+
+    confirm_copy_overwrite = g_settings_get_enum (gnome_cmd_data.options.gcmd_settings->confirm, 
GCMD_SETTINGS_CONFIRM_COPY_OVERWRITE);
+    gnome_cmd_data.options.confirm_copy_overwrite = (GnomeCmdConfirmOverwriteMode) confirm_copy_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);
@@ -458,6 +466,11 @@ static void gcmd_connect_gsettings_signals(GcmdSettings *gs)
                       G_CALLBACK (on_confirm_delete_default_changed),
                       NULL);
 
+    g_signal_connect (gs->confirm,
+                      "changed::confirm-copy-overwrite",
+                      G_CALLBACK (on_confirm_copy_overwrite_changed),
+                      NULL);
+
 }
 
 
@@ -1971,6 +1984,9 @@ void GnomeCmdData::migrate_all_data_to_gsettings()
         //delete_default
         migrate_data_int_value_into_gsettings(gnome_cmd_data_get_int ("/confirm/delete_default", 1),
                                                         options.gcmd_settings->confirm, 
GCMD_SETTINGS_CONFIRM_DELETE_DEFAULT);
+        //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);
         // 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
@@ -2081,7 +2097,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) gnome_cmd_data_get_int 
("/confirm/copy_overwrite", GNOME_CMD_CONFIRM_OVERWRITE_QUERY);
+    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_mouse_dnd = gnome_cmd_data_get_bool ("/confirm/confirm_mouse_dnd", TRUE);
 
@@ -2628,7 +2644,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);
-    gnome_cmd_data_set_int    ("/confirm/copy_overwrite", options.confirm_copy_overwrite);
+    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);
     gnome_cmd_data_set_bool   ("/confirm/confirm_mouse_dnd", options.confirm_mouse_dnd);
 
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index e29b658..bbb9b52 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -105,6 +105,7 @@ GcmdSettings *gcmd_settings_new (void);
 #define GCMD_PREF_CONFIRM                             "org.gnome.gnome-commander.preferences.confirmation"
 #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"
 
 struct GnomeCmdConRemote;
 


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