SF.net SVN: geany:[5101] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Fri Jul 9 17:15:17 UTC 2010


Revision: 5101
          http://geany.svn.sourceforge.net/geany/?rev=5101&view=rev
Author:   ntrel
Date:     2010-07-09 17:15:16 +0000 (Fri, 09 Jul 2010)

Log Message:
-----------
Use Stash to save statusbar_template setting, instead of the
load/save-settings signal.
Add ui_init_prefs().

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/main.c
    trunk/src/ui_utils.c
    trunk/src/ui_utils.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-07-09 15:14:55 UTC (rev 5100)
+++ trunk/ChangeLog	2010-07-09 17:15:16 UTC (rev 5101)
@@ -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  <nick(dot)treleaven(at)btinternet(dot)com>

Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c	2010-07-09 15:14:55 UTC (rev 5100)
+++ trunk/src/main.c	2010-07-09 17:15:16 UTC (rev 5101)
@@ -997,8 +997,9 @@
 	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

Modified: trunk/src/ui_utils.c
===================================================================
--- trunk/src/ui_utils.c	2010-07-09 15:14:55 UTC (rev 5100)
+++ trunk/src/ui_utils.c	2010-07-09 17:15:16 UTC (rev 5101)
@@ -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_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 @@
 {
 	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");

Modified: trunk/src/ui_utils.h
===================================================================
--- trunk/src/ui_utils.h	2010-07-09 15:14:55 UTC (rev 5100)
+++ trunk/src/ui_utils.h	2010-07-09 17:15:16 UTC (rev 5101)
@@ -219,6 +219,8 @@
 
 void ui_init(void);
 
+void ui_init_prefs(void);
+
 void ui_finalize(void);
 
 void ui_init_toolbar_widgets(void);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list