[gnome-commander/GSettings] Adds quick search matching options to GSettings
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander/GSettings] Adds quick search matching options to GSettings
- Date: Sun, 3 Jul 2016 14:31:02 +0000 (UTC)
commit 625c612c3dbc5b96d271e9296fc7f70f84034767
Author: Uwe Scholz <uwescholz src gnome org>
Date: Sun Jul 3 16:08:54 2016 +0200
Adds quick search matching options to GSettings
data/org.gnome.gnome-commander.gschema.xml | 24 ++++++++++-------
src/gnome-cmd-data.cc | 40 +++++++++++++++++++++++++---
src/gnome-cmd-data.h | 2 +
3 files changed, 52 insertions(+), 14 deletions(-)
---
diff --git a/data/org.gnome.gnome-commander.gschema.xml b/data/org.gnome.gnome-commander.gschema.xml
index 731f245..0b221ef 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -371,6 +371,20 @@
This option defines if multiple instances are allowed.
</description>
</key>
+ <key name="quick-search-exact-match-begin" type="b">
+ <default l10n="messages">true</default>
+ <summary>Quick search exact match begin</summary>
+ <description>
+ This option defines if quicksearch should match explicitely at the beginning of an item name.
+ </description>
+ </key>
+ <key name="quick-search-exact-match-end" type="b">
+ <default l10n="messages">false</default>
+ <summary>Quick search exact match end</summary>
+ <description>
+ This option defines if quicksearch should match explicitely at the end of an item name.
+ </description>
+ </key>
</schema>
<schema gettext-domain="gnome-commander" id="org.gnome.gnome-commander.preferences.quick-connect"
path="/org/gnome/gnome-commander/preferences/quick-connect/">
<key name="uri" type="s">
@@ -525,16 +539,6 @@
<summary></summary>
<description></description>
</key>
- <key name="quick-search-exact-match-begin" type="b">
- <default l10n="messages">true</default>
- <summary></summary>
- <description></description>
- </key>
- <key name="quick-search-exact-match-end" type="b">
- <default l10n="messages">true</default>
- <summary></summary>
- <description></description>
- </key>
<key name="terminal-open" type="s">
<default l10n="messages">'xfce4-terminal'</default>
<summary></summary>
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index d43ea4e..345e54c 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -713,6 +713,22 @@ void on_quick_search_shortcut_changed()
gnome_cmd_data.options.quick_search = (GnomeCmdQuickSearchShortcut) quick_search;
}
+void on_quick_search_exact_match_begin_changed()
+{
+ gboolean quick_search_exact_match;
+
+ quick_search_exact_match = g_settings_get_boolean (gnome_cmd_data.options.gcmd_settings->general,
GCMD_SETTINGS_QUICK_SEARCH_EXACT_MATCH_BEGIN);
+ gnome_cmd_data.options.quick_search_exact_match_begin = quick_search_exact_match;
+}
+
+void on_quick_search_exact_match_end_changed()
+{
+ gboolean quick_search_exact_match;
+
+ quick_search_exact_match = g_settings_get_boolean (gnome_cmd_data.options.gcmd_settings->general,
GCMD_SETTINGS_QUICK_SEARCH_EXACT_MATCH_END);
+ gnome_cmd_data.options.quick_search_exact_match_end = quick_search_exact_match;
+}
+
static void gcmd_settings_class_init (GcmdSettingsClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -1054,6 +1070,16 @@ static void gcmd_connect_gsettings_signals(GcmdSettings *gs)
G_CALLBACK (on_quick_search_shortcut_changed),
NULL);
+ g_signal_connect (gs->general,
+ "changed::quick-search-exact-match-begin",
+ G_CALLBACK (on_quick_search_exact_match_begin_changed),
+ NULL);
+
+ g_signal_connect (gs->general,
+ "changed::quick-search-exact-match-end",
+ G_CALLBACK (on_quick_search_exact_match_end_changed),
+ NULL);
+
}
@@ -2683,6 +2709,12 @@ void GnomeCmdData::migrate_all_data_to_gsettings()
//alt_quick_search
migrate_data_int_value_into_gsettings(gnome_cmd_data_get_bool ("/programs/alt_quick_search", FALSE)
? 1 : 0,
options.gcmd_settings->keybindings,
GCMD_SETTINGS_QUICK_SEARCH_SHORTCUT);
+ //quick_search_exact_match_begin
+ migrate_data_int_value_into_gsettings(gnome_cmd_data_get_bool
("/programs/quick_search_exact_match_begin", TRUE) ? 1 : 0,
+ options.gcmd_settings->general,
GCMD_SETTINGS_QUICK_SEARCH_EXACT_MATCH_BEGIN);
+ //quick_search_exact_match_end
+ migrate_data_int_value_into_gsettings(gnome_cmd_data_get_bool
("/programs/quick_search_exact_match_end", FALSE) ? 1 : 0,
+ options.gcmd_settings->general,
GCMD_SETTINGS_QUICK_SEARCH_EXACT_MATCH_END);
g_free(color);
// ToDo: Move old xml-file to ~/.gnome-commander/gnome-commander.xml.backup
@@ -3049,8 +3081,8 @@ void GnomeCmdData::load()
options.allow_multiple_instances = g_settings_get_boolean (options.gcmd_settings->general,
GCMD_SETTINGS_MULTIPLE_INSTANCES);
options.use_internal_viewer = g_settings_get_boolean (options.gcmd_settings->programs,
GCMD_SETTINGS_USE_INTERNAL_VIEWER);
options.quick_search = (GnomeCmdQuickSearchShortcut) g_settings_get_enum
(options.gcmd_settings->keybindings, GCMD_SETTINGS_QUICK_SEARCH_SHORTCUT);
- options.quick_search_exact_match_begin = gnome_cmd_data_get_bool
("/programs/quick_search_exact_match_begin", TRUE);
- options.quick_search_exact_match_end = gnome_cmd_data_get_bool
("/programs/quick_search_exact_match_end", FALSE);
+ options.quick_search_exact_match_begin = g_settings_get_boolean (options.gcmd_settings->general,
GCMD_SETTINGS_QUICK_SEARCH_EXACT_MATCH_BEGIN);
+ options.quick_search_exact_match_end = g_settings_get_boolean (options.gcmd_settings->general,
GCMD_SETTINGS_QUICK_SEARCH_EXACT_MATCH_END);
options.skip_mounting = gnome_cmd_data_get_bool ("/programs/skip_mounting", FALSE);
options.symlink_prefix = g_settings_get_string(options.gcmd_settings->general,
GCMD_SETTINGS_SYMLINK_PREFIX);
@@ -3577,8 +3609,8 @@ void GnomeCmdData::save()
set_gsettings_when_changed (options.gcmd_settings->programs, GCMD_SETTINGS_DONT_DOWNLOAD,
&(options.honor_expect_uris));
set_gsettings_when_changed (options.gcmd_settings->programs, GCMD_SETTINGS_USE_INTERNAL_VIEWER,
&(options.use_internal_viewer));
- gnome_cmd_data_set_bool ("/programs/quick_search_exact_match_begin",
options.quick_search_exact_match_begin);
- gnome_cmd_data_set_bool ("/programs/quick_search_exact_match_end",
options.quick_search_exact_match_end);
+ set_gsettings_when_changed (options.gcmd_settings->general,
GCMD_SETTINGS_QUICK_SEARCH_EXACT_MATCH_BEGIN, &(options.quick_search_exact_match_begin));
+ set_gsettings_when_changed (options.gcmd_settings->general,
GCMD_SETTINGS_QUICK_SEARCH_EXACT_MATCH_END, &(options.quick_search_exact_match_end));
gnome_cmd_data_set_bool ("/programs/skip_mounting", options.skip_mounting);
set_gsettings_when_changed (options.gcmd_settings->general, GCMD_SETTINGS_SHOW_TOOLBAR,
&(show_toolbar));
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index 182e1bb..9c2147d 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -92,6 +92,8 @@ GcmdSettings *gcmd_settings_new (void);
#define GCMD_SETTINGS_SELECT_DIRS "select-dirs"
#define GCMD_SETTINGS_CASE_SENSITIVE "case-sensitive"
#define GCMD_SETTINGS_MULTIPLE_INSTANCES "allow-multiple-instances"
+#define GCMD_SETTINGS_QUICK_SEARCH_EXACT_MATCH_BEGIN "quick-search-exact-match-begin"
+#define GCMD_SETTINGS_QUICK_SEARCH_EXACT_MATCH_END "quick-search-exact-match-end"
#define GCMD_PREF_FILTER "org.gnome.gnome-commander.preferences.filter"
#define GCMD_SETTINGS_FILTER_HIDE_UNKNOWN "hide-unknown"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]