[gnome-commander/GSettings] Adds icon_size option to GSettings (now known as icon-size)
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander/GSettings] Adds icon_size option to GSettings (now known as icon-size)
- Date: Sat, 21 May 2016 21:27:36 +0000 (UTC)
commit cdaf686261a252309c99dae0b1ef3fa36d162b6a
Author: Uwe Scholz <uwescholz src gnome org>
Date: Sat May 21 23:27:10 2016 +0200
Adds icon_size option to GSettings (now known as icon-size)
data/org.gnome.gnome-commander.gschema.xml | 8 ++++----
src/gnome-cmd-data.cc | 22 ++++++++++++++++++++--
src/gnome-cmd-data.h | 1 +
3 files changed, 25 insertions(+), 6 deletions(-)
---
diff --git a/data/org.gnome.gnome-commander.gschema.xml b/data/org.gnome.gnome-commander.gschema.xml
index 1ddd381..6a959a3 100644
--- a/data/org.gnome.gnome-commander.gschema.xml
+++ b/data/org.gnome.gnome-commander.gschema.xml
@@ -141,10 +141,10 @@
Defines what happens when the right mouse button is clicked on an item.
</description>
</key>
- <key name="icon-size" type="i">
- <default l10n="messages">16</default>
- <summary></summary>
- <description></description>
+ <key name="icon-size" type="u">
+ <default>16</default>
+ <summary>Icon size</summary>
+ <description>Size of icons in the file pane.</description>
</key>
<key name="dev-icon-size" type="i">
<default l10n="messages">16</default>
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index 59459b9..894ba7a 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -185,6 +185,16 @@ void on_ext_disp_mode_changed ()
main_win->update_view();
}
+void on_icon_size_changed ()
+{
+ guint icon_size;
+
+ icon_size = g_settings_get_uint (gnome_cmd_data.options.gcmd_settings->general, GCMD_SETTINGS_ICON_SIZE);
+ gnome_cmd_data.options.icon_size = icon_size;
+
+ main_win->update_view();
+}
+
static void gcmd_settings_class_init (GcmdSettingsClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -286,6 +296,11 @@ static void gcmd_connect_gsettings_signals(GcmdSettings *gs)
G_CALLBACK (on_ext_disp_mode_changed),
NULL);
+ g_signal_connect (gs->general,
+ "changed::icon-size",
+ G_CALLBACK (on_icon_size_changed),
+ NULL);
+
}
@@ -1678,6 +1693,9 @@ void GnomeCmdData::migrate_all_data_to_gsettings()
//right_mouse_button_mode
migrate_data_int_value_into_gsettings(gnome_cmd_data_get_int ("/options/right_mouse_button_mode",
LEFT_BUTTON_OPENS_WITH_DOUBLE_CLICK),
options.gcmd_settings->general,
GCMD_SETTINGS_RIGHT_MOUSE_BUTTON_MODE);
+ //icon_size
+ migrate_data_int_value_into_gsettings(gnome_cmd_data_get_int ("/options/icon_size", 16),
+ options.gcmd_settings->general,
GCMD_SETTINGS_ICON_SIZE);
// ToDo: Move old xml-file to ~/.gnome-commander/gnome-commander.xml.backup
// à la save_devices_old ("devices.backup");
// and move .gnome2/gnome-commander to .gnome2/gnome-commander.backup
@@ -1857,7 +1875,7 @@ void GnomeCmdData::load()
options.left_mouse_button_unselects = g_settings_get_boolean (options.gcmd_settings->general,
GCMD_SETTINGS_LEFT_MOUSE_BUTTON_UNSELECTS);
options.middle_mouse_button_mode = (MiddleMouseButtonMode) gnome_cmd_data_get_int
("/options/middle_mouse_button_mode", MIDDLE_BUTTON_GOES_UP_DIR);
options.right_mouse_button_mode = (RightMouseButtonMode) g_settings_get_enum
(options.gcmd_settings->general, GCMD_SETTINGS_RIGHT_MOUSE_BUTTON_MODE);
- options.icon_size = gnome_cmd_data_get_int ("/options/icon_size", 16);
+ options.icon_size = g_settings_get_uint (options.gcmd_settings->general, GCMD_SETTINGS_ICON_SIZE);
dev_icon_size = gnome_cmd_data_get_int ("/options/dev_icon_size", 16);
options.icon_scale_quality = (GdkInterpType) gnome_cmd_data_get_int ("/options/icon_scale_quality",
GDK_INTERP_HYPER);
options.theme_icon_dir = gnome_cmd_data_get_string ("/options/theme_icon_dir", theme_icon_dir);
@@ -2391,7 +2409,7 @@ void GnomeCmdData::save()
set_gsettings_when_changed (options.gcmd_settings->general,
GCMD_SETTINGS_LEFT_MOUSE_BUTTON_UNSELECTS, &(options.left_mouse_button_unselects));
gnome_cmd_data_set_int ("/options/middle_mouse_button_mode", options.middle_mouse_button_mode);
set_gsettings_enum_when_changed (options.gcmd_settings->general, GCMD_SETTINGS_RIGHT_MOUSE_BUTTON_MODE,
options.right_mouse_button_mode);
- gnome_cmd_data_set_int ("/options/icon_size", options.icon_size);
+ set_gsettings_when_changed (options.gcmd_settings->general, GCMD_SETTINGS_ICON_SIZE,
&(options.icon_size));
gnome_cmd_data_set_int ("/options/dev_icon_size", dev_icon_size);
gnome_cmd_data_set_int ("/options/icon_scale_quality", options.icon_scale_quality);
gnome_cmd_data_set_string ("/options/theme_icon_dir", options.theme_icon_dir);
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index 8d25931..b77fe71 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -67,6 +67,7 @@ GcmdSettings *gcmd_settings_new (void);
#define GCMD_SETTINGS_CLICKS_TO_OPEN_ITEM "clicks-to-open-item"
#define GCMD_SETTINGS_LEFT_MOUSE_BUTTON_UNSELECTS "left-mouse-btn-unselects"
#define GCMD_SETTINGS_RIGHT_MOUSE_BUTTON_MODE "right-mouse-btn-mode"
+#define GCMD_SETTINGS_ICON_SIZE "icon-size"
#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]