SF.net SVN: geany:[4403] trunk
ntrel at users.sourceforge.net
ntrel at xxxxx
Thu Nov 5 18:03:34 UTC 2009
Revision: 4403
http://geany.svn.sourceforge.net/geany/?rev=4403&view=rev
Author: ntrel
Date: 2009-11-05 18:03:34 +0000 (Thu, 05 Nov 2009)
Log Message:
-----------
Use default color scheme if pref color scheme file doesn't exist.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/highlighting.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-11-05 18:02:08 UTC (rev 4402)
+++ trunk/ChangeLog 2009-11-05 18:03:34 UTC (rev 4403)
@@ -5,6 +5,8 @@
instead.
* src/callbacks.c:
Show number of files saved on status bar when using Save All.
+ * src/highlighting.c:
+ Use default color scheme if pref color scheme file doesn't exist.
2009-11-04 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/src/highlighting.c
===================================================================
--- trunk/src/highlighting.c 2009-11-05 18:02:08 UTC (rev 4402)
+++ trunk/src/highlighting.c 2009-11-05 18:03:34 UTC (rev 4403)
@@ -530,6 +530,7 @@
static void load_named_styles(GKeyFile *config, GKeyFile *config_home)
{
const gchar *scheme = editor_prefs.color_scheme;
+ gboolean free_kf = FALSE;
if (named_style_hash)
g_hash_table_destroy(named_style_hash); /* reloading */
@@ -538,10 +539,20 @@
if (NZV(scheme))
{
- config = utils_key_file_new(
- utils_build_path(app->datadir, GEANY_COLORSCHEMES_SUBDIR, scheme, NULL));
- config_home = utils_key_file_new(
- utils_build_path(app->configdir, GEANY_COLORSCHEMES_SUBDIR, scheme, NULL));
+ gchar *path, *path_home;
+
+ path = g_build_path(G_DIR_SEPARATOR_S, app->datadir, GEANY_COLORSCHEMES_SUBDIR, scheme, NULL);
+ path_home = g_build_path(G_DIR_SEPARATOR_S, app->configdir, GEANY_COLORSCHEMES_SUBDIR, scheme, NULL);
+
+ if (g_file_test(path, G_FILE_TEST_EXISTS) || g_file_test(path_home, G_FILE_TEST_EXISTS))
+ {
+ config = utils_key_file_new(path);
+ config_home = utils_key_file_new(path_home);
+ free_kf = TRUE;
+ }
+ /* if color scheme is missing, use default */
+ g_free(path);
+ g_free(path_home);
}
/* first set default to the "default" named style */
add_named_style(config, "default");
@@ -553,7 +564,7 @@
/* home overrides any system named style */
get_named_styles(config_home);
- if (NZV(scheme))
+ if (free_kf)
{
g_key_file_free(config);
g_key_file_free(config_home);
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