[gnome-commander/GSettings] Adds last_mode to GSettings (now known as search-mode)



commit 49eafa8ed9f17696741544abb085d3f42e297561
Author: Uwe Scholz <uwescholz src gnome org>
Date:   Sun Jul 17 20:05:09 2016 +0200

    Adds last_mode to GSettings (now known as search-mode)

 data/org.gnome.gnome-commander.gschema.xml |   15 +++++++++++----
 src/gnome-cmd-data.cc                      |    7 +++++--
 src/gnome-cmd-data.h                       |    3 ++-
 3 files changed, 18 insertions(+), 7 deletions(-)
---
diff --git a/data/org.gnome.gnome-commander.gschema.xml b/data/org.gnome.gnome-commander.gschema.xml
index 6694df0..85abb7a 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -97,6 +97,11 @@
     <value nick="ALT+letter" value="1"/>
   </enum>
 
+  <enum id="org.gnome.gnome-commander.preferences.internal-viewer.search-mode-enum">
+    <value nick="text" value="0"/>
+    <value nick="hexadecimal" value="1"/>
+  </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>
@@ -984,10 +989,12 @@
           This option defines if searching within the internal viewer is case sensitive.
       </description>
     </key>
-    <key name="last-mode" type="i">
-      <default l10n="messages">0</default>
-      <summary></summary>
-      <description></description>
+    <key name="search-mode" enum='org.gnome.gnome-commander.preferences.internal-viewer.search-mode-enum'>
+      <default l10n="messages">'text'</default>
+      <summary>Search mode</summary>
+      <description>
+          This options defines the search mode of the internal viewer.
+      </description>
     </key>
     <key name="charset" type="s">
       <default l10n="messages">'UTF8'</default>
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 43ddded..89025f9 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -2392,7 +2392,7 @@ inline void GnomeCmdData::save_intviewer_defaults()
     gnome_cmd_data_set_string_history ("/internal_viewer/text_pattern%d", 
intviewer_defaults.text_patterns.ents);
     gnome_cmd_data_set_string_history ("/internal_viewer/hex_pattern%d", 
intviewer_defaults.hex_patterns.ents);
     set_gsettings_when_changed      (options.gcmd_settings->internalviewer, GCMD_SETTINGS_IV_CASE_SENSITIVE, 
&(intviewer_defaults.case_sensitive));
-    gnome_cmd_data_set_int ("/internal_viewer/last_mode", intviewer_defaults.search_mode);
+    set_gsettings_enum_when_changed (options.gcmd_settings->internalviewer, GCMD_SETTINGS_IV_SEARCH_MODE, 
intviewer_defaults.search_mode);
 }
 
 
@@ -2443,7 +2443,7 @@ inline void GnomeCmdData::load_intviewer_defaults()
     intviewer_defaults.text_patterns = load_string_history ("/internal_viewer/text_pattern%d", -1);
     intviewer_defaults.hex_patterns.ents = load_string_history ("/internal_viewer/hex_pattern%d", -1);
     intviewer_defaults.case_sensitive = g_settings_get_boolean (options.gcmd_settings->internalviewer, 
GCMD_SETTINGS_IV_CASE_SENSITIVE);
-    intviewer_defaults.search_mode = gnome_cmd_data_get_int ("/internal_viewer/last_mode", 0);
+    intviewer_defaults.search_mode = g_settings_get_enum (options.gcmd_settings->internalviewer, 
GCMD_SETTINGS_IV_SEARCH_MODE);
 }
 
 
@@ -2925,6 +2925,9 @@ void GnomeCmdData::migrate_all_data_to_gsettings()
         //case_sens
         migrate_data_int_value_into_gsettings(gnome_cmd_data_get_bool ("/internal_viewer/case_sens", FALSE) 
? 1 : 0,
                                               options.gcmd_settings->internalviewer, 
GCMD_SETTINGS_IV_CASE_SENSITIVE);
+        //last_mode
+        migrate_data_int_value_into_gsettings(gnome_cmd_data_get_int ("/internal_viewer/last_mode", 0),
+                                                        options.gcmd_settings->internalviewer, 
GCMD_SETTINGS_IV_SEARCH_MODE);
 
         g_free(color);
         // ToDo: Move old xml-file to ~/.gnome-commander/gnome-commander.xml.backup
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index 3a021a9..56d7cc1 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -166,6 +166,7 @@ GcmdSettings *gcmd_settings_new (void);
 
 #define GCMD_PREF_INTERNAL_VIEWER                     "org.gnome.gnome-commander.preferences.internal-viewer"
 #define GCMD_SETTINGS_IV_CASE_SENSITIVE               "case-sensitive-search"
+#define GCMD_SETTINGS_IV_SEARCH_MODE                  "search-mode"
 
 struct GnomeCmdConRemote;
 
@@ -520,7 +521,7 @@ struct GnomeCmdData
         History text_patterns;
         History hex_patterns;
         gboolean case_sensitive;
-        guint search_mode;
+        gint search_mode;
 
         IntViewerConfig(): text_patterns(INTVIEWER_HISTORY_SIZE),
                            hex_patterns(INTVIEWER_HISTORY_SIZE),


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