[gnome-commander/GSettings] Adds backup_pattern to GSettings (now known as backup-pattern)
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander/GSettings] Adds backup_pattern to GSettings (now known as backup-pattern)
- Date: Sun, 19 Jun 2016 18:59:25 +0000 (UTC)
commit 23c217ad6acccbb27cacc85e6ce6d5acd068312b
Author: Uwe Scholz <uwescholz src gnome org>
Date: Sun Jun 19 20:56:26 2016 +0200
Adds backup_pattern to GSettings (now known as backup-pattern)
data/org.gnome.gnome-commander.gschema.xml | 7 +++++--
src/gnome-cmd-data.cc | 22 ++++++++++++++++++++--
src/gnome-cmd-data.h | 1 +
3 files changed, 26 insertions(+), 4 deletions(-)
---
diff --git a/data/org.gnome.gnome-commander.gschema.xml b/data/org.gnome.gnome-commander.gschema.xml
index 1e45a1b..0ed8750 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -450,8 +450,11 @@
</key>
<key name="backup-pattern" type="s">
<default l10n="messages">'*~;*.bak'</default>
- <summary></summary>
- <description></description>
+ <summary>Backup file pattern</summary>
+ <description>
+ The given string defines suffixes (separated by semicolon) for files which
+ should by filtered out if backup files should by hidden.
+ </description>
</key>
</schema>
<schema gettext-domain="gnome-commander" id="org.gnome.gnome-commander.preferences.programs"
path="/org/gnome/gnome-commander/preferences/programs/">
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 0cbb1ee..278a387 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -167,6 +167,16 @@ void on_filter_changed ()
main_win->update_view();
}
+void on_backup_pattern_changed ()
+{
+ char *backup_pattern;
+
+ backup_pattern = g_settings_get_string (gnome_cmd_data.options.gcmd_settings->filter,
GCMD_SETTINGS_FILTER_BACKUP_PATTERN);
+ gnome_cmd_data.options.set_backup_pattern(backup_pattern);
+ main_win->update_view();
+ g_free(backup_pattern);
+}
+
void on_list_font_changed ()
{
char *list_font;
@@ -433,6 +443,11 @@ static void gcmd_connect_gsettings_signals(GcmdSettings *gs)
G_CALLBACK (on_filter_changed),
NULL);
+ g_signal_connect (gs->filter,
+ "changed::backup-pattern",
+ G_CALLBACK (on_backup_pattern_changed),
+ NULL);
+
g_signal_connect (gs->general,
"changed::extension-display-mode",
G_CALLBACK (on_ext_disp_mode_changed),
@@ -1945,6 +1960,9 @@ void GnomeCmdData::migrate_all_data_to_gsettings()
//hidden_filter
migrate_data_int_value_into_gsettings(gnome_cmd_data_get_bool ("/options/backup_filter", FALSE) ? 1
: 0,
options.gcmd_settings->filter,
GCMD_SETTINGS_FILTER_BACKUP);
+ //backup_pattern
+ migrate_data_string_value_into_gsettings(gnome_cmd_data_get_string ("/defaults/backup_pattern",
"*~;*.bak"),
+ options.gcmd_settings->filter,
GCMD_SETTINGS_FILTER_BACKUP_PATTERN);
//list_font
migrate_data_string_value_into_gsettings(gnome_cmd_data_get_string ("/options/list_font", "DejaVu
Sans Mono 8"),
options.gcmd_settings->general,
GCMD_SETTINGS_LIST_FONT);
@@ -2293,7 +2311,7 @@ void GnomeCmdData::load()
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);
- options.backup_pattern = gnome_cmd_data_get_string ("/defaults/backup_pattern", "*~;*.bak");
+ options.backup_pattern = g_settings_get_string (options.gcmd_settings->filter,
GCMD_SETTINGS_FILTER_BACKUP_PATTERN);
options.backup_pattern_list = patlist_new (options.backup_pattern);
main_win_state = (GdkWindowState) g_settings_get_uint (options.gcmd_settings->general,
GCMD_SETTINGS_MAIN_WIN_STATE);
@@ -2825,7 +2843,7 @@ void GnomeCmdData::save()
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);
- gnome_cmd_data_set_string ("/defaults/backup_pattern", options.backup_pattern);
+ set_gsettings_when_changed (options.gcmd_settings->filter, GCMD_SETTINGS_FILTER_BACKUP_PATTERN,
options.backup_pattern);
set_gsettings_when_changed (options.gcmd_settings->general, GCMD_SETTINGS_MAIN_WIN_STATE,
&(main_win_state));
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index e584419..71b7d09 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -103,6 +103,7 @@ GcmdSettings *gcmd_settings_new (void);
#define GCMD_SETTINGS_FILTER_HIDE_SYMBOLIC_LINK "hide-symbolic-link"
#define GCMD_SETTINGS_FILTER_DOTFILE "hide-dotfile"
#define GCMD_SETTINGS_FILTER_BACKUP "hide-backup-files"
+#define GCMD_SETTINGS_FILTER_BACKUP_PATTERN "backup-pattern"
#define GCMD_PREF_CONFIRM "org.gnome.gnome-commander.preferences.confirmations"
#define GCMD_SETTINGS_CONFIRM_DELETE "delete"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]