[gnome-commander] Adds option for saving/not saving the search history on exit
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] Adds option for saving/not saving the search history on exit
- Date: Thu, 21 Sep 2017 19:02:03 +0000 (UTC)
commit c06e9781df2d110934fc1470460df3cab4203692
Author: Uwe Scholz <uwescholz src gnome org>
Date: Thu Sep 21 21:01:34 2017 +0200
Adds option for saving/not saving the search history on exit
NEWS | 1 +
data/org.gnome.gnome-commander.gschema.xml | 7 +++++++
doc/C/releases.xml | 3 +++
src/dialogs/gnome-cmd-options-dialog.cc | 6 ++++++
src/gnome-cmd-data.cc | 28 +++++++++++++++++++++-------
src/gnome-cmd-data.h | 3 +++
6 files changed, 41 insertions(+), 7 deletions(-)
---
diff --git a/NEWS b/NEWS
index 9da04d9..f0a6164 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,7 @@ New features:
* [build] New documentation infrastructure: Use yelp-tools instead of gnome-doc-utils
* Quick search can be activated by just typing a letter, adjustable in the options tab
* Option for saving/not saving the command line history on exit
+ * Option for saving/not saving the search history on exit
Other changes:
* Increased minimum GTK version from 2.8.0 to 2.18.0
diff --git a/data/org.gnome.gnome-commander.gschema.xml b/data/org.gnome.gnome-commander.gschema.xml
index b59a47a..74ff1d3 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -325,6 +325,13 @@
Defines if the history of commands in the commandline is saved on exit.
</description>
</key>
+ <key name="save-search-history-on-exit" type="b">
+ <default>true</default>
+ <summary>Save search history on exit</summary>
+ <description>
+ Defines if the history of search patterns is saved on exit.
+ </description>
+ </key>
<key name="always-show-tabs" type="b">
<default>false</default>
<summary>Always show tab bar</summary>
diff --git a/doc/C/releases.xml b/doc/C/releases.xml
index 055d688..a66baad 100644
--- a/doc/C/releases.xml
+++ b/doc/C/releases.xml
@@ -44,6 +44,9 @@
<listitem>
<para>Option for saving/not saving the command line history on exit</para>
</listitem>
+ <listitem>
+ <para>Option for saving/not saving the search history on exit</para>
+ </listitem>
</itemizedlist>
</para>
<para>Other changes:</para>
diff --git a/src/dialogs/gnome-cmd-options-dialog.cc b/src/dialogs/gnome-cmd-options-dialog.cc
index 36511f4..8ee736a 100644
--- a/src/dialogs/gnome-cmd-options-dialog.cc
+++ b/src/dialogs/gnome-cmd-options-dialog.cc
@@ -220,6 +220,10 @@ static GtkWidget *create_general_tab (GtkWidget *parent, GnomeCmdData::Options &
gtk_box_pack_start (GTK_BOX (cat_box), check, FALSE, TRUE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), cfg.save_cmdline_history_on_exit);
+ check = create_check (parent, _("Search history"), "save_search_history");
+ gtk_box_pack_start (GTK_BOX (cat_box), check, FALSE, TRUE, 0);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), cfg.save_search_history_on_exit);
+
return frame;
}
@@ -242,6 +246,7 @@ inline void store_general_options (GtkWidget *dialog, GnomeCmdData::Options &cfg
GtkWidget *save_tabs = lookup_widget (dialog, "save_tabs");
GtkWidget *save_dir_history = lookup_widget (dialog, "save_dir_history");
GtkWidget *save_cmdline_history = lookup_widget (dialog, "save_cmdline_history");
+ GtkWidget *save_search_history = lookup_widget (dialog, "save_search_history");
cfg.left_mouse_button_mode = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (lmb_singleclick_radio)) ?
GnomeCmdData::LEFT_BUTTON_OPENS_WITH_SINGLE_CLICK : GnomeCmdData::LEFT_BUTTON_OPENS_WITH_DOUBLE_CLICK;
@@ -268,6 +273,7 @@ inline void store_general_options (GtkWidget *dialog, GnomeCmdData::Options &cfg
cfg.save_tabs_on_exit = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (save_tabs));
cfg.save_dir_history_on_exit = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (save_dir_history));
cfg.save_cmdline_history_on_exit = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(save_cmdline_history));
+ cfg.save_search_history_on_exit = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (save_search_history));
}
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index a6ea232..231f561 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -1349,6 +1349,7 @@ GnomeCmdData::Options::Options(const Options &cfg)
save_tabs_on_exit = cfg.save_tabs_on_exit;
save_dir_history_on_exit = cfg.save_dir_history_on_exit;
save_cmdline_history_on_exit = cfg.save_cmdline_history_on_exit;
+ save_search_history_on_exit = cfg.save_search_history_on_exit;
symlink_prefix = g_strdup (cfg.symlink_prefix);
main_win_pos[0] = cfg.main_win_pos[0];
main_win_pos[1] = cfg.main_win_pos[1];
@@ -1411,6 +1412,7 @@ GnomeCmdData::Options &GnomeCmdData::Options::operator = (const Options &cfg)
save_tabs_on_exit = cfg.save_tabs_on_exit;
save_dir_history_on_exit = cfg.save_dir_history_on_exit;
save_cmdline_history_on_exit = cfg.save_cmdline_history_on_exit;
+ save_search_history_on_exit = cfg.save_search_history_on_exit;
symlink_prefix = g_strdup (cfg.symlink_prefix);
main_win_pos[0] = cfg.main_win_pos[0];
main_win_pos[1] = cfg.main_win_pos[1];
@@ -3626,6 +3628,7 @@ void GnomeCmdData::load()
options.save_tabs_on_exit = g_settings_get_boolean (options.gcmd_settings->general,
GCMD_SETTINGS_SAVE_TABS_ON_EXIT);
options.save_dir_history_on_exit = g_settings_get_boolean (options.gcmd_settings->general,
GCMD_SETTINGS_SAVE_DIR_HISTORY_ON_EXIT);
options.save_cmdline_history_on_exit = g_settings_get_boolean (options.gcmd_settings->general,
GCMD_SETTINGS_SAVE_CMDLINE_HISTORY_ON_EXIT);
+ options.save_search_history_on_exit = g_settings_get_boolean (options.gcmd_settings->general,
GCMD_SETTINGS_SAVE_SEARCH_HISTORY_ON_EXIT);
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);
@@ -4234,6 +4237,7 @@ void GnomeCmdData::save()
set_gsettings_when_changed (options.gcmd_settings->general, GCMD_SETTINGS_SAVE_TABS_ON_EXIT,
&(options.save_tabs_on_exit));
set_gsettings_when_changed (options.gcmd_settings->general, GCMD_SETTINGS_SAVE_DIR_HISTORY_ON_EXIT,
&(options.save_dir_history_on_exit));
set_gsettings_when_changed (options.gcmd_settings->general,
GCMD_SETTINGS_SAVE_CMDLINE_HISTORY_ON_EXIT, &(options.save_cmdline_history_on_exit));
+ set_gsettings_when_changed (options.gcmd_settings->general,
GCMD_SETTINGS_SAVE_SEARCH_HISTORY_ON_EXIT, &(options.save_search_history_on_exit));
set_gsettings_when_changed (options.gcmd_settings->general, GCMD_SETTINGS_ALWAYS_SHOW_TABS,
&(options.always_show_tabs));
set_gsettings_enum_when_changed (options.gcmd_settings->general, GCMD_SETTINGS_TAB_LOCK_INDICATOR,
options.tab_lock_indicator);
@@ -4672,7 +4676,14 @@ XML::xstream &operator << (XML::xstream &xml, GnomeCmdData::Selection &cfg)
xml << XML::tag("Profile") << XML::attr("name") << XML::escape(cfg.name);
xml << XML::tag("Pattern") << XML::attr("syntax") << (cfg.syntax==Filter::TYPE_REGEX ? "regex" :
"shell")
- << XML::attr("match-case") << 0 << XML::chardata() <<
XML::escape(cfg.filename_pattern) << XML::endtag();
+ << XML::attr("match-case") << 0 << XML::chardata();
+
+ if (!strcmp("Default", cfg.name.c_str()) && gnome_cmd_data.options.save_search_history_on_exit)
+ xml << XML::escape(cfg.filename_pattern);
+ else
+ xml << "";
+ xml << XML::endtag()
+
xml << XML::tag("Subdirectories") << XML::attr("max-depth") << cfg.max_depth << XML::endtag();
xml << XML::tag("Text") << XML::attr("content-search") << cfg.content_search <<
XML::attr("match-case") << cfg.match_case << XML::chardata() << XML::escape(cfg.text_pattern) <<
XML::endtag();
@@ -4689,15 +4700,18 @@ XML::xstream &operator << (XML::xstream &xml, GnomeCmdData::SearchConfig &cfg)
xml << XML::tag("WindowSize") << XML::attr("width") << cfg.width << XML::attr("height") <<
cfg.height << XML::endtag();
xml << cfg.default_profile;
- xml << XML::tag("History");
+ if (gnome_cmd_data.options.save_search_history_on_exit)
+ {
+ xml << XML::tag("History");
- for (GList *i=cfg.name_patterns.ents; i; i=i->next)
- xml << XML::tag("Pattern") << XML::chardata() << XML::escape((const gchar *) i->data) <<
XML::endtag();
+ for (GList *i=cfg.name_patterns.ents; i; i=i->next)
+ xml << XML::tag("Pattern") << XML::chardata() << XML::escape((const gchar *) i->data) <<
XML::endtag();
- for (GList *i=cfg.content_patterns.ents; i; i=i->next)
- xml << XML::tag("Text") << XML::chardata() << XML::escape((const gchar *) i->data) <<
XML::endtag();
+ for (GList *i=cfg.content_patterns.ents; i; i=i->next)
+ xml << XML::tag("Text") << XML::chardata() << XML::escape((const gchar *) i->data) <<
XML::endtag();
- xml << XML::endtag();
+ xml << XML::endtag();
+ }
xml << XML::endtag();
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index 82c912f..d92de33 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -87,6 +87,7 @@ GcmdSettings *gcmd_settings_new (void);
#define GCMD_SETTINGS_SAVE_TABS_ON_EXIT "save-tabs-on-exit"
#define GCMD_SETTINGS_SAVE_DIR_HISTORY_ON_EXIT "save-dir-history-on-exit"
#define GCMD_SETTINGS_SAVE_CMDLINE_HISTORY_ON_EXIT "save-cmdline-history-on-exit"
+#define GCMD_SETTINGS_SAVE_SEARCH_HISTORY_ON_EXIT "save-search-history-on-exit"
#define GCMD_SETTINGS_ALWAYS_SHOW_TABS "always-show-tabs"
#define GCMD_SETTINGS_TAB_LOCK_INDICATOR "tab-lock-indicator"
#define GCMD_SETTINGS_MAIN_WIN_STATE "main-win-state"
@@ -263,6 +264,7 @@ struct GnomeCmdData
gboolean save_tabs_on_exit;
gboolean save_dir_history_on_exit;
gboolean save_cmdline_history_on_exit;
+ gboolean save_search_history_on_exit;
gchar *symlink_prefix;
gint main_win_pos[2];
// Format
@@ -322,6 +324,7 @@ struct GnomeCmdData
save_tabs_on_exit(TRUE),
save_dir_history_on_exit(TRUE),
save_cmdline_history_on_exit(TRUE),
+ save_search_history_on_exit(TRUE),
symlink_prefix(NULL),
size_disp_mode(GNOME_CMD_SIZE_DISP_MODE_POWERED),
perm_disp_mode(GNOME_CMD_PERM_DISP_MODE_TEXT),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]