[gnome-commander/GSettings] Adds differ to GSettings (now known as differ-cmd)



commit 8a57963c28518428f73363821412672955ade1c6
Author: Uwe Scholz <uwescholz src gnome org>
Date:   Tue Jul 5 19:21:48 2016 +0200

    Adds differ to GSettings (now known as differ-cmd)

 data/org.gnome.gnome-commander.gschema.xml |    8 +++++---
 src/gnome-cmd-data.cc                      |   20 ++++++++++++++++++--
 src/gnome-cmd-data.h                       |    3 ++-
 3 files changed, 25 insertions(+), 6 deletions(-)
---
diff --git a/data/org.gnome.gnome-commander.gschema.xml b/data/org.gnome.gnome-commander.gschema.xml
index 7ac7b43..ef5d4fc 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -523,10 +523,12 @@
           This string defines the command for starting the editor.
       </description>
     </key>
-    <key name="differ" type="s">
+    <key name="differ-cmd" type="s">
       <default l10n="messages">'meld %s'</default>
-      <summary></summary>
-      <description></description>
+      <summary>Differ command</summary>
+      <description>
+          This string defines the command for starting the diff tool.
+      </description>
     </key>
     <key name="terminal" type="s">
       <default l10n="messages">'xfce4-terminal -x %s'</default>
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 7bd687b..649d95d 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -781,6 +781,14 @@ void on_editor_cmd_changed()
     gnome_cmd_data.options.editor = editor_cmd;
 }
 
+void on_differ_cmd_changed()
+{
+    gchar *differ_cmd;
+
+    differ_cmd = g_settings_get_string (gnome_cmd_data.options.gcmd_settings->programs, 
GCMD_SETTINGS_DIFFER_CMD);
+    gnome_cmd_data.options.differ = differ_cmd;
+}
+
 static void gcmd_settings_class_init (GcmdSettingsClass *klass)
 {
     GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -1147,6 +1155,11 @@ static void gcmd_connect_gsettings_signals(GcmdSettings *gs)
                       G_CALLBACK (on_editor_cmd_changed),
                       NULL);
 
+    g_signal_connect (gs->programs,
+                      "changed::differ-cmd",
+                      G_CALLBACK (on_differ_cmd_changed),
+                      NULL);
+
 }
 
 
@@ -2792,6 +2805,9 @@ void GnomeCmdData::migrate_all_data_to_gsettings()
         //editor
         migrate_data_string_value_into_gsettings(gnome_cmd_data_get_string ("/programs/editor", "gedit %s"),
                                                         options.gcmd_settings->programs, 
GCMD_SETTINGS_EDITOR_CMD);
+        //differ
+        migrate_data_string_value_into_gsettings(gnome_cmd_data_get_string ("/programs/differ", "meld %s"),
+                                                        options.gcmd_settings->programs, 
GCMD_SETTINGS_DIFFER_CMD);
 
         g_free(color);
         // ToDo: Move old xml-file to ~/.gnome-commander/gnome-commander.xml.backup
@@ -3172,7 +3188,7 @@ void GnomeCmdData::load()
 
     options.viewer = g_settings_get_string(options.gcmd_settings->programs, GCMD_SETTINGS_VIEWER_CMD);
     options.editor = g_settings_get_string(options.gcmd_settings->programs, GCMD_SETTINGS_EDITOR_CMD);
-    options.differ = gnome_cmd_data_get_string ("/programs/differ", "meld %s");
+    options.differ = g_settings_get_string(options.gcmd_settings->programs, GCMD_SETTINGS_DIFFER_CMD);
     options.sendto = gnome_cmd_data_get_string ("/programs/sendto", "nautilus-sendto %s");
     options.termopen = gnome_cmd_data_get_string ("/programs/terminal_open", "gnome-terminal");
     options.termexec = gnome_cmd_data_get_string ("/programs/terminal_exec", "gnome-terminal -e %s");
@@ -3703,7 +3719,7 @@ void GnomeCmdData::save()
 
     set_gsettings_when_changed      (options.gcmd_settings->programs, GCMD_SETTINGS_VIEWER_CMD, 
options.viewer);
     set_gsettings_when_changed      (options.gcmd_settings->programs, GCMD_SETTINGS_EDITOR_CMD, 
options.editor);
-    gnome_cmd_data_set_string ("/programs/differ", options.differ);
+    set_gsettings_when_changed      (options.gcmd_settings->programs, GCMD_SETTINGS_DIFFER_CMD, 
options.differ);
     gnome_cmd_data_set_string ("/programs/sendto", options.sendto);
     gnome_cmd_data_set_string ("/programs/terminal_open", options.termopen);
     gnome_cmd_data_set_string ("/programs/terminal_exec", options.termexec);
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index fb462ba..f693132 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -146,8 +146,9 @@ GcmdSettings *gcmd_settings_new (void);
 #define GCMD_PREF_PROGRAMS                            "org.gnome.gnome-commander.preferences.programs"
 #define GCMD_SETTINGS_DONT_DOWNLOAD                   "dont-download"
 #define GCMD_SETTINGS_USE_INTERNAL_VIEWER             "use-internal-viewer"
-#define GCMD_SETTINGS_VIEWER_CMD             "viewer-cmd"
+#define GCMD_SETTINGS_VIEWER_CMD                      "viewer-cmd"
 #define GCMD_SETTINGS_EDITOR_CMD                      "editor-cmd"
+#define GCMD_SETTINGS_DIFFER_CMD                      "differ-cmd"
 
 #define GCMD_PREF_KEYBINDINGS                         "org.gnome.gnome-commander.preferences.keybindings"
 #define GCMD_SETTINGS_QUICK_SEARCH_SHORTCUT           "quick-search"


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