From ae4d82b7f16204f6dcd77792bd7cf394e8ad0549 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Fri, 9 Jul 2010 17:15:16 +0000 Subject: [PATCH] Use Stash to save statusbar_template setting, instead of the load/save-settings signal. Add ui_init_prefs(). git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5101 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 4 ++++ src/main.c | 3 ++- src/ui_utils.c | 22 +++++++++------------- src/ui_utils.h | 2 ++ 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/ChangeLog b/ChangeLog index a8a3a0a0..fc772c33 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,10 @@ * doc/geany.txt, doc/geany.html: Add note to restart Geany after installing/updating before editing hidden prefs. + * src/ui_utils.h, src/main.c, src/ui_utils.c: + Use Stash to save statusbar_template setting, instead of the + load/save-settings signal. + Add ui_init_prefs(). 2010-07-08 Nick Treleaven diff --git a/src/main.c b/src/main.c index 654834a1..d0298a38 100644 --- a/src/main.c +++ b/src/main.c @@ -997,8 +997,9 @@ gint main(gint argc, gchar **argv) encodings_init(); editor_init(); + /* init stash groups before loading keyfile */ configuration_init(); - /* init stash code before loading keyfile */ + ui_init_prefs(); search_init(); project_init(); #ifdef HAVE_PLUGINS diff --git a/src/ui_utils.c b/src/ui_utils.c index a29debf4..2a02b056 100644 --- a/src/ui_utils.c +++ b/src/ui_utils.c @@ -52,6 +52,8 @@ #include "toolbar.h" #include "geanymenubuttonaction.h" #include "main.h" +#include "stash.h" +#include "keyfile.h" GeanyInterfacePrefs interface_prefs; @@ -1995,19 +1997,16 @@ static void on_editor_menu_hide(GtkWidget *item) } -static void on_load_settings(GObject *obj, GKeyFile *config) +/* Currently ui_init() is called before keyfile.c stash group code is initialized, + * so this is called after that's done. */ +void ui_init_prefs(void) { - g_assert(statusbar_template == NULL); + StashGroup *group = stash_group_new(PACKAGE); - statusbar_template = utils_get_setting_string(config, - PACKAGE, "statusbar_template", ""); -} + configuration_add_pref_group(group, FALSE); + stash_group_set_write_once(group, TRUE); - -static void on_save_settings(GObject *obj, GKeyFile *config) -{ - if (!g_key_file_has_key(config, PACKAGE, "statusbar_template", NULL)) - g_key_file_set_string(config, PACKAGE, "statusbar_template", statusbar_template); + stash_group_add_string(group, &statusbar_template, "statusbar_template", ""); } @@ -2015,9 +2014,6 @@ void ui_init(void) { GtkWidget *item; - g_signal_connect(geany_object, "load-settings", G_CALLBACK(on_load_settings), NULL); - g_signal_connect(geany_object, "save-settings", G_CALLBACK(on_save_settings), NULL); - init_recent_files(); ui_widgets.statusbar = ui_lookup_widget(main_widgets.window, "statusbar"); diff --git a/src/ui_utils.h b/src/ui_utils.h index 771338e2..d062f7b2 100644 --- a/src/ui_utils.h +++ b/src/ui_utils.h @@ -219,6 +219,8 @@ GtkWidget *ui_label_set_markup(GtkLabel *label, const gchar *format, ...) G_GNUC void ui_init(void); +void ui_init_prefs(void); + void ui_finalize(void); void ui_init_toolbar_widgets(void);