[gnome-commander/GSettings] Adds search-pattern-text and search-pattern-hex to GSettings
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander/GSettings] Adds search-pattern-text and search-pattern-hex to GSettings
- Date: Thu, 4 Aug 2016 20:28:42 +0000 (UTC)
commit 30f6e10de1e4ed04874e8188e589d949ee57bb21
Author: Uwe Scholz <uwescholz src gnome org>
Date: Thu Aug 4 22:24:04 2016 +0200
Adds search-pattern-text and search-pattern-hex to GSettings
TODO | 1 +
data/org.gnome.gnome-commander.gschema.xml | 20 ++++++++++++--------
src/gnome-cmd-data.cc | 14 ++++++++++----
src/gnome-cmd-data.h | 2 ++
4 files changed, 25 insertions(+), 12 deletions(-)
---
diff --git a/TODO b/TODO
index 1081268..8564b1f 100644
--- a/TODO
+++ b/TODO
@@ -81,6 +81,7 @@
* Adding the toolbar
* Multiple files browsing
* Preloading consecutive images
+* Load search history for hex mode
Discussed stuff
diff --git a/data/org.gnome.gnome-commander.gschema.xml b/data/org.gnome.gnome-commander.gschema.xml
index ccb944c..16273e4 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -1138,15 +1138,19 @@
<summary></summary>
<description></description>
</key>
- <key name="text-pattern14" type="s">
- <default l10n="messages">'color'</default>
- <summary></summary>
- <description></description>
+ <key name="search-pattern-text" type="as">
+ <default l10n="messages">[]</default>
+ <summary>Search pattern for text</summary>
+ <description>
+ This string array stores the history of text searches within the internal file viewer.
+ </description>
</key>
- <key name="text-pattern15" type="s">
- <default l10n="messages">'image'</default>
- <summary></summary>
- <description></description>
+ <key name="search-pattern-hex" type="as">
+ <default l10n="messages">[]</default>
+ <summary>Search pattern for hex values</summary>
+ <description>
+ This string array stores the history of searches for hex values within the internal file viewer.
+ </description>
</key>
</schema>
<schema gettext-domain="gnome-commander" id="org.gnome.gnome-commander.preferences.local-bookmarks"
path="/org/gnome/gnome-commander/preferences/local-bookmarks/">
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 6ce036c..1488916 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -2423,8 +2423,8 @@ inline void GnomeCmdData::save_cmdline_history()
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_string_array_from_glist(options.gcmd_settings->internalviewer,
GCMD_SETTINGS_IV_SEARCH_PATTERN_TEXT, intviewer_defaults.text_patterns.ents);
+ set_gsettings_string_array_from_glist(options.gcmd_settings->internalviewer,
GCMD_SETTINGS_IV_SEARCH_PATTERN_HEX, intviewer_defaults.hex_patterns.ents);
set_gsettings_when_changed (options.gcmd_settings->internalviewer, GCMD_SETTINGS_IV_CASE_SENSITIVE,
&(intviewer_defaults.case_sensitive));
set_gsettings_enum_when_changed (options.gcmd_settings->internalviewer, GCMD_SETTINGS_IV_SEARCH_MODE,
intviewer_defaults.search_mode);
}
@@ -2502,8 +2502,8 @@ inline void GnomeCmdData::load_search_defaults()
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.text_patterns = get_list_from_gsettings_string_array
(options.gcmd_settings->internalviewer, GCMD_SETTINGS_IV_SEARCH_PATTERN_TEXT);
+ intviewer_defaults.hex_patterns.ents = get_list_from_gsettings_string_array
(options.gcmd_settings->internalviewer, GCMD_SETTINGS_IV_SEARCH_PATTERN_HEX);
intviewer_defaults.case_sensitive = g_settings_get_boolean (options.gcmd_settings->internalviewer,
GCMD_SETTINGS_IV_CASE_SENSITIVE);
intviewer_defaults.search_mode = g_settings_get_enum (options.gcmd_settings->internalviewer,
GCMD_SETTINGS_IV_SEARCH_MODE);
}
@@ -3025,6 +3025,12 @@ void GnomeCmdData::migrate_all_data_to_gsettings()
//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);
+ //text_pattern0
+ migrate_data_string_value_into_gsettings(gnome_cmd_data_get_string
("/internal_viewer/text_pattern0", ""),
+ options.gcmd_settings->internalviewer,
GCMD_SETTINGS_IV_SEARCH_PATTERN_TEXT);
+ //hex_pattern0
+ migrate_data_string_value_into_gsettings(gnome_cmd_data_get_string ("/internal_viewer/hex_pattern0",
""),
+ options.gcmd_settings->internalviewer,
GCMD_SETTINGS_IV_SEARCH_PATTERN_HEX);
g_free(color);
// ToDo: Move old xml-file to ~/.gnome-commander/gnome-commander.xml.backup
// à la save_devices_old ("devices.backup");
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index eca76b2..1e5b394 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -168,6 +168,8 @@ 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"
+#define GCMD_SETTINGS_IV_SEARCH_PATTERN_TEXT "search-pattern-text"
+#define GCMD_SETTINGS_IV_SEARCH_PATTERN_HEX "search-pattern-hex"
#define GCMD_PREF_PLUGINS "org.gnome.gnome-commander.plugins.general"
#define GCMD_SETTINGS_PLUGINS_AUTOLOAD "autoload"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]