[gnome-commander/GSettings] Adds use_ls_colors to GSettings (now known as use-ls-colors)
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander/GSettings] Adds use_ls_colors to GSettings (now known as use-ls-colors)
- Date: Sat, 2 Jul 2016 21:52:08 +0000 (UTC)
commit 22e21f5b8c2b45e577c298a6b94056c7e3f5cbf1
Author: Uwe Scholz <uwescholz src gnome org>
Date: Fri Jul 1 23:21:36 2016 +0200
Adds use_ls_colors to GSettings (now known as use-ls-colors)
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 2975342..547f17e 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -755,8 +755,11 @@
</key>
<key name="use-ls-colors" type="b">
<default l10n="messages">false</default>
- <summary></summary>
- <description></description>
+ <summary>Use LS colors</summary>
+ <description>
+ This option triggers if the value of the environment variable
+ LS_COLORS should be used to dye files and folders.
+ </description>
</key>
<key name="ls-colors-black-fg" type="s">
<default l10n="messages">'#000000'</default>
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 5114338..977d059 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -468,6 +468,16 @@ void on_custom_color_changed()
main_win->update_view();
}
+void on_use_ls_colors_changed()
+{
+ gboolean use_ls_colors;
+
+ use_ls_colors = g_settings_get_boolean (gnome_cmd_data.options.gcmd_settings->colors,
GCMD_SETTINGS_COLORS_USE_LS_COLORS);
+ gnome_cmd_data.options.use_ls_colors = use_ls_colors;
+
+ main_win->update_view();
+}
+
static void gcmd_settings_class_init (GcmdSettingsClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -703,6 +713,11 @@ static void gcmd_connect_gsettings_signals(GcmdSettings *gs)
"changed::custom-curs-bg",
G_CALLBACK (on_custom_color_changed),
NULL);
+
+ g_signal_connect (gs->colors,
+ "changed::use-ls-colors",
+ G_CALLBACK (on_use_ls_colors_changed),
+ NULL);
}
@@ -2251,6 +2266,9 @@ void GnomeCmdData::migrate_all_data_to_gsettings()
gnome_cmd_data_get_color_gnome_config ("/colors/curs_bg", color);
migrate_data_string_value_into_gsettings(gdk_color_to_string (color),
options.gcmd_settings->colors,
GCMD_SETTINGS_COLORS_CURS_BG);
+ //use_ls_colors
+ migrate_data_int_value_into_gsettings(gnome_cmd_data_get_bool ("/colors/use_ls_colors", TRUE) ? 1 :
0,
+ options.gcmd_settings->colors,
GCMD_SETTINGS_COLORS_USE_LS_COLORS);
g_free(color);
// ToDo: Move old xml-file to ~/.gnome-commander/gnome-commander.xml.backup
@@ -2476,7 +2494,7 @@ void GnomeCmdData::load()
options.color_mode = gcmd_owner.is_root() ? (GnomeCmdColorMode) g_settings_get_enum
(options.gcmd_settings->colors, GCMD_SETTINGS_COLORS_THEME)
: (GnomeCmdColorMode) GNOME_CMD_COLOR_DEEP_BLUE;
- options.use_ls_colors = gnome_cmd_data_get_bool ("/colors/use_ls_colors", FALSE);
+ options.use_ls_colors = g_settings_get_boolean (options.gcmd_settings->colors,
GCMD_SETTINGS_COLORS_USE_LS_COLORS);
options.ls_colors_palette.black_fg = gdk_color_new (0, 0, 0);
options.ls_colors_palette.black_bg = gdk_color_new (0, 0, 0);
@@ -3012,7 +3030,7 @@ void GnomeCmdData::save()
set_gsettings_color_when_changed (options.gcmd_settings->colors, GCMD_SETTINGS_COLORS_CURS_FG,
options.color_themes[GNOME_CMD_COLOR_CUSTOM].curs_fg);
set_gsettings_color_when_changed (options.gcmd_settings->colors, GCMD_SETTINGS_COLORS_CURS_BG,
options.color_themes[GNOME_CMD_COLOR_CUSTOM].curs_bg);
- gnome_cmd_data_set_bool ("/colors/use_ls_colors", options.use_ls_colors);
+ set_gsettings_when_changed (options.gcmd_settings->colors, GCMD_SETTINGS_COLORS_USE_LS_COLORS,
&(options.use_ls_colors));
gnome_cmd_data_set_color ("/colors/ls_colors_black_fg", options.ls_colors_palette.black_fg);
gnome_cmd_data_set_color ("/colors/ls_colors_black_bg", options.ls_colors_palette.black_bg);
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index 2545e32..a2c8146 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -122,6 +122,7 @@ GcmdSettings *gcmd_settings_new (void);
#define GCMD_SETTINGS_COLORS_SEL_BG "custom-sel-bg"
#define GCMD_SETTINGS_COLORS_CURS_FG "custom-curs-fg"
#define GCMD_SETTINGS_COLORS_CURS_BG "custom-curs-bg"
+#define GCMD_SETTINGS_COLORS_USE_LS_COLORS "use-ls-colors"
struct GnomeCmdConRemote;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]