[gnome-commander] New option to decide if the commandline history should be saved on exit
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] New option to decide if the commandline history should be saved on exit
- Date: Sun, 10 Sep 2017 20:16:19 +0000 (UTC)
commit 3addbed6cbf2336cb2754ab629407e7a0f27de19
Author: Uwe Scholz <uwescholz src gnome org>
Date: Sun Sep 10 22:03:37 2017 +0200
New option to decide if the commandline history should be saved on exit
data/org.gnome.gnome-commander.gschema.xml | 7 +++++++
src/dialogs/gnome-cmd-options-dialog.cc | 6 ++++++
src/gnome-cmd-data.cc | 21 ++++++++++++++-------
src/gnome-cmd-data.h | 3 +++
4 files changed, 30 insertions(+), 7 deletions(-)
---
diff --git a/data/org.gnome.gnome-commander.gschema.xml b/data/org.gnome.gnome-commander.gschema.xml
index 51a6bd2..b59a47a 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -318,6 +318,13 @@
Defines if the history of visited directories is saved on exit.
</description>
</key>
+ <key name="save-cmdline-history-on-exit" type="b">
+ <default>true</default>
+ <summary>Save commandline history on exit</summary>
+ <description>
+ Defines if the history of commands in the commandline 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/src/dialogs/gnome-cmd-options-dialog.cc b/src/dialogs/gnome-cmd-options-dialog.cc
index 5a6c0f6..36511f4 100644
--- a/src/dialogs/gnome-cmd-options-dialog.cc
+++ b/src/dialogs/gnome-cmd-options-dialog.cc
@@ -216,6 +216,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_dir_history_on_exit);
+ check = create_check (parent, _("Commandline history"), "save_cmdline_history");
+ 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);
+
return frame;
}
@@ -237,6 +241,7 @@ inline void store_general_options (GtkWidget *dialog, GnomeCmdData::Options &cfg
GtkWidget *save_dirs = lookup_widget (dialog, "save_dirs");
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");
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;
@@ -262,6 +267,7 @@ inline void store_general_options (GtkWidget *dialog, GnomeCmdData::Options &cfg
cfg.save_dirs_on_exit = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (save_dirs));
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));
}
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index ad0809c..152055d 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -1348,6 +1348,7 @@ GnomeCmdData::Options::Options(const Options &cfg)
save_dirs_on_exit = cfg.save_dirs_on_exit;
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;
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];
@@ -1409,6 +1410,7 @@ GnomeCmdData::Options &GnomeCmdData::Options::operator = (const Options &cfg)
save_dirs_on_exit = cfg.save_dirs_on_exit;
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;
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];
@@ -2494,14 +2496,17 @@ gboolean GnomeCmdData::set_gsettings_string_array_from_glist (GSettings *setting
}
-inline void GnomeCmdData::save_cmdline_history()
+void GnomeCmdData::save_cmdline_history()
{
- if (!cmdline_visibility)
- return;
-
- cmdline_history = gnome_cmd_cmdline_get_history (main_win->get_cmdline());
-
- set_gsettings_string_array_from_glist(options.gcmd_settings->general, GCMD_SETTINGS_CMDLINE_HISTORY,
cmdline_history);
+ if (options.save_cmdline_history_on_exit)
+ {
+ cmdline_history = gnome_cmd_cmdline_get_history (main_win->get_cmdline());
+ set_gsettings_string_array_from_glist(options.gcmd_settings->general, GCMD_SETTINGS_CMDLINE_HISTORY,
cmdline_history);
+ }
+ else
+ {
+ set_gsettings_string_array_from_glist(options.gcmd_settings->general, GCMD_SETTINGS_CMDLINE_HISTORY,
NULL);
+ }
}
@@ -3609,6 +3614,7 @@ void GnomeCmdData::load()
options.save_dirs_on_exit = g_settings_get_boolean (options.gcmd_settings->general,
GCMD_SETTINGS_SAVE_DIRS_ON_EXIT);
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.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);
@@ -4215,6 +4221,7 @@ void GnomeCmdData::save()
set_gsettings_when_changed (options.gcmd_settings->general, GCMD_SETTINGS_SAVE_DIRS_ON_EXIT,
&(options.save_dirs_on_exit));
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_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);
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index 28e4370..82c912f 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -86,6 +86,7 @@ GcmdSettings *gcmd_settings_new (void);
#define GCMD_SETTINGS_SAVE_DIRS_ON_EXIT "save-dirs-on-exit"
#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_ALWAYS_SHOW_TABS "always-show-tabs"
#define GCMD_SETTINGS_TAB_LOCK_INDICATOR "tab-lock-indicator"
#define GCMD_SETTINGS_MAIN_WIN_STATE "main-win-state"
@@ -261,6 +262,7 @@ struct GnomeCmdData
gboolean save_dirs_on_exit;
gboolean save_tabs_on_exit;
gboolean save_dir_history_on_exit;
+ gboolean save_cmdline_history_on_exit;
gchar *symlink_prefix;
gint main_win_pos[2];
// Format
@@ -319,6 +321,7 @@ struct GnomeCmdData
save_dirs_on_exit(FALSE),
save_tabs_on_exit(TRUE),
save_dir_history_on_exit(TRUE),
+ save_cmdline_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]