[gnome-commander/GSettings] Fixed things so changing size-disp-mode within gconf-editor instantly takes effect
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander/GSettings] Fixed things so changing size-disp-mode within gconf-editor instantly takes effect
- Date: Fri, 13 May 2016 20:53:34 +0000 (UTC)
commit 8cd5c20369ace7ae67ddd1e4b2964d50b6eac581
Author: Uwe Scholz <uwescholz src gnome org>
Date: Fri May 13 22:36:16 2016 +0200
Fixed things so changing size-disp-mode within gconf-editor instantly takes effect
src/gnome-cmd-data.cc | 90 +++++------------------------------------
src/gnome-cmd-data.h | 1 +
src/gnome-cmd-main-win.cc | 7 +++
src/gnome-cmd-main-win.h | 1 +
src/gnome-cmd-user-actions.cc | 3 +-
src/main.cc | 2 +-
6 files changed, 21 insertions(+), 83 deletions(-)
---
diff --git a/src/gnome-cmd-data.cc b/src/gnome-cmd-data.cc
index b987d72..ccd6be9 100644
--- a/src/gnome-cmd-data.cc
+++ b/src/gnome-cmd-data.cc
@@ -78,75 +78,14 @@ static void gcmd_settings_dispose (GObject *object)
G_OBJECT_CLASS (gcmd_settings_parent_class)->dispose (object);
}
-static void set_font (GcmdSettings *gs,
- const gchar *font)
+void on_size_display_mode_changed ()
{
- //Hier muss jetzt die Schrift in den Panels aktualisiert werden!
- printf("%s\n", font);
-}
-
-static void on_system_font_changed (GSettings *settings,
- const gchar *key,
- GcmdSettings *gs)
-{
-
- gboolean use_default_font;
+ gint size_disp_mode;
- use_default_font = g_settings_get_boolean (gs->general,
- GCMD_SETTINGS_USE_DEFAULT_FONT);
+ size_disp_mode = g_settings_get_enum (gnome_cmd_data.options.gcmd_settings->general,
GCMD_SETTINGS_SIZE_DISP_MODE);
+ gnome_cmd_data.options.size_disp_mode = (GnomeCmdSizeDispMode) size_disp_mode;
- if (use_default_font)
- {
- gchar *font;
-
- font = g_settings_get_string (settings, key);
- set_font (gs, font);
- g_free (font);
- }
-}
-
-static void on_use_default_font_changed (GSettings *settings,
- const gchar *key,
- GcmdSettings *gs)
-{
- gboolean def;
- gchar *font;
-
- def = g_settings_get_boolean (settings, key);
-
- if (def)
- {
- font = g_settings_get_string (gs->interface,
- GCMD_SETTINGS_SYSTEM_FONT);
- }
- else
- {
- font = g_settings_get_string (gs->general,
- GCMD_SETTINGS_PANEL_FONT);
- }
-
- set_font (gs, font);
-
- g_free (font);
-}
-
-static void on_general_font_changed (GSettings *settings,
- const gchar *key,
- GcmdSettings *gs)
-{
- gboolean use_default_font;
-
- use_default_font = g_settings_get_boolean (gs->general,
- GCMD_SETTINGS_USE_DEFAULT_FONT);
-
- if (!use_default_font)
- {
- gchar *font;
-
- font = g_settings_get_string (settings, key);
- set_font (gs, font);
- g_free (font);
- }
+ main_win->update_view();
}
static void gcmd_settings_class_init (GcmdSettingsClass *klass)
@@ -167,20 +106,11 @@ static void gcmd_settings_init (GcmdSettings *gs)
gs->interface = g_settings_new ("org.gnome.desktop.interface");
gs->general = g_settings_new (GCMD_PREF_GENERAL);
- g_signal_connect (gs->interface,
- "changed::monospace-font-name",
- G_CALLBACK (on_system_font_changed),
- gs);
-
g_signal_connect (gs->general,
- "changed::use-default-font",
- G_CALLBACK (on_use_default_font_changed),
- gs);
+ "changed::size-display-mode",
+ G_CALLBACK (on_size_display_mode_changed),
+ NULL);
- g_signal_connect (gs->general,
- "changed::panel-font",
- G_CALLBACK (on_general_font_changed),
- gs);
}
@@ -1460,7 +1390,6 @@ void GnomeCmdData::free()
*/
void GnomeCmdData::migrate_all_data_to_gsettings()
{
- options.gcmd_settings = gcmd_settings_new();
gchar *xml_cfg_path = config_dir ? g_build_filename (config_dir, PACKAGE ".xml", NULL) :
g_build_filename (g_get_home_dir (), "." PACKAGE, PACKAGE ".xml", NULL);
gchar *package_config_path = gnome_config_get_real_path(PACKAGE);
@@ -1494,7 +1423,7 @@ void GnomeCmdData::migrate_all_data_to_gsettings()
// size_disp_mode
ihelper = migrate_data_int_value_into_gsettings(gnome_cmd_data_get_int ("/options/size_disp_mode",
GNOME_CMD_SIZE_DISP_MODE_POWERED),
options.gcmd_settings->general,
GCMD_SETTINGS_SIZE_DISP_MODE);
- g_settings_set_enum (options.gcmd_settings->general, GCMD_SETTINGS_SIZE_DISP_MODE, ihelper);
+ //g_settings_set_enum (options.gcmd_settings->general, GCMD_SETTINGS_SIZE_DISP_MODE, ihelper);
// ToDo: Move old xml-file to ~/.gnome-commander/gnome-commander.xml.backup
// Ã la save_devices_old ("devices.backup");
@@ -1512,6 +1441,7 @@ void GnomeCmdData::migrate_all_data_to_gsettings()
void GnomeCmdData::load()
{
+ options.gcmd_settings = gcmd_settings_new();
gchar *xml_cfg_path = config_dir ? g_build_filename (config_dir, PACKAGE ".xml", NULL) :
g_build_filename (g_get_home_dir (), "." PACKAGE, PACKAGE ".xml", NULL);
gchar *document_icon_dir = g_strconcat (GNOME_PREFIX, "/share/pixmaps/document-icons/", NULL);
diff --git a/src/gnome-cmd-data.h b/src/gnome-cmd-data.h
index 2ccf86f..db0dea9 100644
--- a/src/gnome-cmd-data.h
+++ b/src/gnome-cmd-data.h
@@ -520,6 +520,7 @@ void gnome_cmd_data_set_main_win_pos (gint x, gint y);
const gchar *gnome_cmd_data_get_symlink_prefix ();
void gnome_cmd_data_set_symlink_prefix (const gchar *value);
+void on_use_default_font_changed();
extern GnomeCmdData gnome_cmd_data;
diff --git a/src/gnome-cmd-main-win.cc b/src/gnome-cmd-main-win.cc
index 20a5049..8f1672e 100644
--- a/src/gnome-cmd-main-win.cc
+++ b/src/gnome-cmd-main-win.cc
@@ -898,6 +898,13 @@ GnomeCmdFileSelector *GnomeCmdMainWin::fs(FileSelectorID id) const
}
+void GnomeCmdMainWin::update_view()
+{
+ gnome_cmd_style_create (gnome_cmd_data.options);
+ update_style();
+}
+
+
void GnomeCmdMainWin::update_style()
{
g_return_if_fail (priv != NULL);
diff --git a/src/gnome-cmd-main-win.h b/src/gnome-cmd-main-win.h
index 6dc2594..8521fb7 100644
--- a/src/gnome-cmd-main-win.h
+++ b/src/gnome-cmd-main-win.h
@@ -89,6 +89,7 @@ struct GnomeCmdMainWin
void focus_file_lists();
void refocus();
+ void update_view();
void update_style();
void update_bookmarks();
void update_toolbar_visibility();
diff --git a/src/gnome-cmd-user-actions.cc b/src/gnome-cmd-user-actions.cc
index 55406cf..0617efe 100644
--- a/src/gnome-cmd-user-actions.cc
+++ b/src/gnome-cmd-user-actions.cc
@@ -1819,8 +1819,7 @@ void options_edit (GtkMenuItem *menuitem, gpointer not_used)
{
if (gnome_cmd_options_dialog (*main_win, gnome_cmd_data.options))
{
- gnome_cmd_style_create (gnome_cmd_data.options);
- main_win->update_style();
+ main_win->update_view();
gnome_cmd_data.save();
}
diff --git a/src/main.cc b/src/main.cc
index 6aa8a2d..f0a9276 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -145,8 +145,8 @@ int main (int argc, char *argv[])
/* Load Settings */
IMAGE_init ();
gcmd_user_actions.init();
- gnome_cmd_data.migrate_all_data_to_gsettings();
gnome_cmd_data.load();
+ gnome_cmd_data.migrate_all_data_to_gsettings();
app = unique_app_new ("org.gnome.GnomeCommander", NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]