[gnome-commander/GSettings] Adds graphical layout mode (layout) to GSettings migration
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander/GSettings] Adds graphical layout mode (layout) to GSettings migration
- Date: Sun, 15 May 2016 13:33:47 +0000 (UTC)
commit 1481fd59128bde68aaca83d96cbc33a4568a3bd3
Author: Uwe Scholz <uwescholz src gnome org>
Date: Sat May 14 20:28:33 2016 +0200
Adds graphical layout mode (layout) to GSettings migration
data/org.gnome.gnome-commander.gschema.xml | 18 ++++++++++++++----
src/gnome-cmd-data.cc | 22 +++++++++++++++++++++-
src/gnome-cmd-data.h | 3 +++
3 files changed, 38 insertions(+), 5 deletions(-)
---
diff --git a/data/org.gnome.gnome-commander.gschema.xml b/data/org.gnome.gnome-commander.gschema.xml
index d460d0f..4218593 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -33,6 +33,12 @@
<value nick="numbers" value="1"/>
</enum>
+ <enum id="org.gnome.gnome-commander.preferences.graphical-layout-mode">
+ <value nick="off" value="0"/>
+ <value nick="file icons" value="1"/>
+ <value nick="MIME icons" value="2"/>
+ </enum>
+
<schema gettext-domain="gnome-commander" id="org.gnome.gnome-commander.preferences.general"
path="/org/gnome/gnome-commander/preferences/general/">
<key name="use-default-font" type="b">
<default>true</default>
@@ -62,10 +68,14 @@
results in an octal number representation (e.g. 644) of the mode bits pattern.
</description>
</key>
- <key name="layout" type="i">
- <default l10n="messages">2</default>
- <summary></summary>
- <description></description>
+ <key name="graphical-layout-mode" enum='org.gnome.gnome-commander.preferences.graphical-layout-mode'>
+ <default l10n="messages">'MIME icons'</default>
+ <summary>Defines the icon style of files in the file panes.</summary>
+ <description>
+ The option 'off' results in no graphical icon usage. The option 'file icons' results in the usage of
+ the same symbol for all files. The 'MIME icons' option results in a file type icon depending on
+ the files MIME type.
+ </description>
</key>
<key name="list-row-height" type="i">
<default l10n="messages">16</default>
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 26e8f0b..9af85ef 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -96,6 +96,16 @@ void on_perm_display_mode_changed ()
main_win->update_view();
}
+void on_graphical_layout_mode_changed ()
+{
+ gint graphical_layout_mode;
+
+ graphical_layout_mode = g_settings_get_enum (gnome_cmd_data.options.gcmd_settings->general,
GCMD_SETTINGS_GRAPHICAL_LAYOUT_MODE);
+ gnome_cmd_data.options.layout = (GnomeCmdLayout) graphical_layout_mode;
+
+ main_win->update_view();
+}
+
static void gcmd_settings_class_init (GcmdSettingsClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -121,6 +131,11 @@ static void gcmd_connect_gsettings_signals(GcmdSettings *gs)
"changed::perm-display-mode",
G_CALLBACK (on_perm_display_mode_changed),
NULL);
+
+ g_signal_connect (gs->general,
+ "changed::graphical-layout-mode",
+ G_CALLBACK (on_graphical_layout_mode_changed),
+ NULL);
}
@@ -1447,6 +1462,10 @@ void GnomeCmdData::migrate_all_data_to_gsettings()
ihelper = migrate_data_int_value_into_gsettings(gnome_cmd_data_get_int ("/options/perm_disp_mode",
GNOME_CMD_SIZE_DISP_MODE_POWERED),
options.gcmd_settings->general,
GCMD_SETTINGS_PERM_DISP_MODE);
g_settings_set_enum (options.gcmd_settings->general, GCMD_SETTINGS_PERM_DISP_MODE, ihelper);
+ // layout
+ ihelper = migrate_data_int_value_into_gsettings(gnome_cmd_data_get_int ("/options/layout",
GNOME_CMD_LAYOUT_MIME_ICONS),
+ options.gcmd_settings->general,
GCMD_SETTINGS_GRAPHICAL_LAYOUT_MODE);
+ g_settings_set_enum (options.gcmd_settings->general, GCMD_SETTINGS_GRAPHICAL_LAYOUT_MODE, ihelper);
// ToDo: Move old xml-file to ~/.gnome-commander/gnome-commander.xml.backup
// à la save_devices_old ("devices.backup");
@@ -1559,7 +1578,7 @@ void GnomeCmdData::load()
options.date_format = g_locale_from_utf8 (utf8_date_format, -1, NULL, NULL, NULL);
g_free (utf8_date_format);
- options.layout = (GnomeCmdLayout) gnome_cmd_data_get_int ("/options/layout",
GNOME_CMD_LAYOUT_MIME_ICONS);
+ options.layout = (GnomeCmdLayout) g_settings_get_enum (options.gcmd_settings->general,
GCMD_SETTINGS_GRAPHICAL_LAYOUT_MODE);
options.list_row_height = gnome_cmd_data_get_int ("/options/list_row_height", 16);
@@ -2016,6 +2035,7 @@ void GnomeCmdData::save()
{
g_settings_set_enum (options.gcmd_settings->general, GCMD_SETTINGS_SIZE_DISP_MODE,
options.size_disp_mode);
g_settings_set_enum (options.gcmd_settings->general, GCMD_SETTINGS_PERM_DISP_MODE,
options.perm_disp_mode);
+ g_settings_set_enum (options.gcmd_settings->general, GCMD_SETTINGS_GRAPHICAL_LAYOUT_MODE,
options.layout);
gnome_cmd_data_set_int ("/options/layout", options.layout);
gnome_cmd_data_set_int ("/options/list_row_height", options.list_row_height);
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index ccc8dcc..0c9bb9d 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -53,6 +53,7 @@ GcmdSettings *gcmd_settings_new (void);
#define GCMD_SETTINGS_SYSTEM_FONT "monospace-font-name"
#define GCMD_SETTINGS_SIZE_DISP_MODE "size-display-mode"
#define GCMD_SETTINGS_PERM_DISP_MODE "perm-display-mode"
+#define GCMD_SETTINGS_GRAPHICAL_LAYOUT_MODE "graphical-layout-mode"
#define GCMD_PREF_GENERAL "org.gnome.gnome-commander.preferences.general"
@@ -335,6 +336,8 @@ struct GnomeCmdData
fav_apps = apps;
}
gboolean is_name_double(const gchar *name);
+
+ void on_size_display_mode_changed();
};
struct Selection
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]