[gnome-commander/get_rid_of_xml] Add search history to gSettings
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander/get_rid_of_xml] Add search history to gSettings
- Date: Sun, 30 Dec 2018 17:53:57 +0000 (UTC)
commit c36611bbd0134aa3c0151feedb4371e03c09e632
Author: Uwe Scholz <u scholz83 gmx de>
Date: Mon Dec 17 23:20:18 2018 +0100
Add search history to gSettings
data/org.gnome.gnome-commander.gschema.xml | 14 ++++++++++++++
src/gnome-cmd-data.cc | 20 ++++++++++++++++++++
src/gnome-cmd-data.h | 3 +++
3 files changed, 37 insertions(+)
---
diff --git a/data/org.gnome.gnome-commander.gschema.xml b/data/org.gnome.gnome-commander.gschema.xml
index 988dec88..1a797450 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -493,6 +493,20 @@
This option defines the height of the search window.
</description>
</key>
+ <key name="search-text-history" type="as">
+ <default>[]</default>
+ <summary>Search text history</summary>
+ <description>
+ This string array represents the history of text searches in the search tool.
+ </description>
+ </key>
+ <key name="search-pattern-history" type="as">
+ <default>[]</default>
+ <summary>Search pattern history</summary>
+ <description>
+ This string array represents the history of regular expression searches in the search tool.
+ </description>
+ </key>
</schema>
<schema gettext-domain="gnome-commander" id="org.gnome.gnome-commander.preferences.network"
path="/org/gnome/gnome-commander/preferences/network/">
<key name="quick-connect-uri" type="s">
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 331605ba..aa28858f 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -2457,6 +2457,23 @@ void GnomeCmdData::save_directory_history()
}
+void GnomeCmdData::save_search_history()
+{
+ if (!gnome_cmd_data.options.save_search_history_on_exit)
+ return;
+
+ set_gsettings_string_array_from_glist(
+ options.gcmd_settings->general,
+ GCMD_SETTINGS_SEARCH_PATTERN_HISTORY,
+ search_defaults.name_patterns.ents);
+
+ set_gsettings_string_array_from_glist(
+ options.gcmd_settings->general,
+ GCMD_SETTINGS_SEARCH_TEXT_HISTORY,
+ search_defaults.content_patterns.ents);
+}
+
+
inline void GnomeCmdData::save_intviewer_defaults()
{
set_gsettings_string_array_from_glist(options.gcmd_settings->internalviewer,
GCMD_SETTINGS_IV_SEARCH_PATTERN_TEXT, intviewer_defaults.text_patterns.ents);
@@ -3093,6 +3110,8 @@ void GnomeCmdData::load()
options.save_search_history_on_exit = g_settings_get_boolean (options.gcmd_settings->general,
GCMD_SETTINGS_SAVE_SEARCH_HISTORY_ON_EXIT);
search_defaults.height = g_settings_get_uint(options.gcmd_settings->general,
GCMD_SETTINGS_SEARCH_WIN_HEIGHT);
search_defaults.width = g_settings_get_uint(options.gcmd_settings->general,
GCMD_SETTINGS_SEARCH_WIN_WIDTH);
+ search_defaults.content_patterns.ents = get_list_from_gsettings_string_array
(options.gcmd_settings->general, GCMD_SETTINGS_SEARCH_TEXT_HISTORY);
+ search_defaults.name_patterns.ents = get_list_from_gsettings_string_array
(options.gcmd_settings->general, GCMD_SETTINGS_SEARCH_PATTERN_HISTORY);
options.always_show_tabs = g_settings_get_boolean (options.gcmd_settings->general,
GCMD_SETTINGS_ALWAYS_SHOW_TABS);
options.tab_lock_indicator = (TabLockIndicator) g_settings_get_enum (options.gcmd_settings->general,
GCMD_SETTINGS_TAB_LOCK_INDICATOR);
@@ -3712,6 +3731,7 @@ void GnomeCmdData::save()
save_fav_apps_via_gsettings ();
save_cmdline_history ();
save_directory_history ();
+ save_search_history ();
save_advrename_profiles();
save_intviewer_defaults();
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index 145bb69b..a7ce8a94 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -128,6 +128,8 @@ GcmdSettings *gcmd_settings_new (void);
#define GCMD_SETTINGS_DIRECTORY_HISTORY "directory-history"
#define GCMD_SETTINGS_SEARCH_WIN_WIDTH "search-win-width"
#define GCMD_SETTINGS_SEARCH_WIN_HEIGHT "search-win-height"
+#define GCMD_SETTINGS_SEARCH_PATTERN_HISTORY "search-pattern-history"
+#define GCMD_SETTINGS_SEARCH_TEXT_HISTORY "search-text-history"
#define GCMD_PREF_FILTER "org.gnome.gnome-commander.preferences.filter"
#define GCMD_SETTINGS_FILTER_HIDE_UNKNOWN "hide-unknown"
@@ -628,6 +630,7 @@ struct GnomeCmdData
gboolean save_auto_load_plugins();
void save_cmdline_history();
void save_directory_history();
+ void save_search_history();
void save_intviewer_defaults();
void save_devices_via_gsettings();
void save_fav_apps_via_gsettings();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]