[gnome-commander/GSettings] Adds cmdline-history/lineXX to GSettings (now known as cmdline-history)
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander/GSettings] Adds cmdline-history/lineXX to GSettings (now known as cmdline-history)
- Date: Sat, 30 Jul 2016 10:33:35 +0000 (UTC)
commit 628a7582a6a697bb29e5af99493b48826b944829
Author: Uwe Scholz <uwescholz src gnome org>
Date: Sat Jul 30 12:08:49 2016 +0200
Adds cmdline-history/lineXX to GSettings (now known as cmdline-history)
data/org.gnome.gnome-commander.gschema.xml | 13 +++++++------
src/gnome-cmd-data.cc | 28 ++++++++++++++++++++++++++--
src/gnome-cmd-data.h | 1 +
3 files changed, 34 insertions(+), 8 deletions(-)
---
diff --git a/data/org.gnome.gnome-commander.gschema.xml b/data/org.gnome.gnome-commander.gschema.xml
index c02b21c..ccb944c 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -15,7 +15,6 @@
<child name="internal-viewer" schema="org.gnome.gnome-commander.preferences.internal-viewer"/>
<child name="local-bookmarks" schema="org.gnome.gnome-commander.preferences.local-bookmarks"/>
<child name="smb-bookmarks" schema="org.gnome.gnome-commander.preferences.smb-bookmarks"/>
- <child name="cmdline-history" schema="org.gnome.gnome-commander.preferences.cmdline-history"/>
</schema>
<enum id="org.gnome.gnome-commander.preferences.general.size-display-mode-enum">
@@ -208,6 +207,13 @@
<summary>MIME icon directory</summary>
<description>Directory in which MIME icons are located.</description>
</key>
+ <key name="cmdline-history" type="as">
+ <default>[]</default>
+ <summary>Commandline history</summary>
+ <description>
+ This string array represents the history of commands executed in the command line.
+ </description>
+ </key>
<key name="cmdline-history-length" type="u">
<default>16</default>
<range min="0" max="16"/>
@@ -1157,11 +1163,6 @@
<description></description>
</key>
</schema>
- <schema gettext-domain="gnome-commander" id="org.gnome.gnome-commander.preferences.cmdline-history"
path="/org/gnome/gnome-commander/preferences/cmdline-history/">
- <key name="line" type="as">
- <default>['']</default>
- </key>
- </schema>
<schema gettext-domain="gnome-commander" id="org.gnome.gnome-commander.plugins.file-roller-plugin"
path="/org/gnome/gnome-commander/plugins/file-roller-plugin/">
<key name="default-type" type="s">
<default l10n="messages">'.zip'</default>
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 5dc01e5..093dc4e 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -2417,7 +2417,7 @@ inline void GnomeCmdData::save_cmdline_history()
cmdline_history = gnome_cmd_cmdline_get_history (main_win->get_cmdline());
- gnome_cmd_data_set_string_history ("/cmdline-history/line%d", cmdline_history);
+ set_gsettings_string_array_from_glist(options.gcmd_settings->general, GCMD_SETTINGS_CMDLINE_HISTORY,
cmdline_history);
}
@@ -2499,7 +2499,7 @@ inline GList* GnomeCmdData::get_list_from_gsettings_string_array (GSettings *set
inline void GnomeCmdData::load_cmdline_history()
{
- cmdline_history = load_string_history ("/cmdline-history/line%d", -1);
+ cmdline_history = get_list_from_gsettings_string_array (options.gcmd_settings->general,
GCMD_SETTINGS_CMDLINE_HISTORY);
}
@@ -3021,6 +3021,30 @@ void GnomeCmdData::migrate_all_data_to_gsettings()
migrate_data_string_value_into_gsettings(gnome_cmd_data_get_string ("/plugins/auto_load0",
"libfileroller.so"),
options.gcmd_settings->plugins,
GCMD_SETTINGS_PLUGINS_AUTOLOAD);
}
+ //cmdline-history/lineXX -> migrate the string into a gsettings string array
+ GList *cmdline_history_for_migration = NULL;
+ cmdline_history_for_migration = load_string_history ("/cmdline-history/line%d", -1);
+ if (cmdline_history_for_migration && cmdline_history_for_migration->data)
+ {
+ GList *list_pointer;
+ list_pointer = cmdline_history_for_migration;
+ gint ii, array_size = 0;
+ for (;list_pointer; list_pointer=list_pointer->next)
+ ++array_size;
+ gchar** str_array;
+ str_array = (gchar**) g_malloc ((array_size + 1)*sizeof(char*));
+
+ list_pointer = cmdline_history_for_migration;
+ for (ii = 0; list_pointer; list_pointer=list_pointer->next, ++ii)
+ {
+ str_array[ii] = g_strdup((const gchar*) list_pointer->data);
+ }
+ str_array[ii] = NULL;
+ g_settings_set_strv(options.gcmd_settings->general, GCMD_SETTINGS_CMDLINE_HISTORY, str_array);
+
+ g_free(str_array);
+ g_list_free(cmdline_history_for_migration);
+ }
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 b3d460d..3bdd9f2 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -72,6 +72,7 @@ GcmdSettings *gcmd_settings_new (void);
#define GCMD_SETTINGS_DEV_ICON_SIZE "dev-icon-size"
#define GCMD_SETTINGS_ICON_SCALE_QUALITY "icon-scale-quality"
#define GCMD_SETTINGS_MIME_ICON_DIR "mime-icon-dir"
+#define GCMD_SETTINGS_CMDLINE_HISTORY "cmdline-history"
#define GCMD_SETTINGS_CMDLINE_HISTORY_LENGTH "cmdline-history-length"
#define GCMD_SETTINGS_HORIZONTAL_ORIENTATION "horizontal-orientation"
#define GCMD_SETTINGS_SHOW_DEVBUTTONS "show-devbuttons"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]