diff options
author | Timo Sirainen <cras@irssi.org> | 2001-03-03 21:16:40 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-03-03 21:16:40 +0000 |
commit | 9a5b97164e99d90f91ef497acad05480795ec5a8 (patch) | |
tree | 075df577ce9900b568b5f74b6af75f2d14d1d436 /src | |
parent | 71188305732d7637bb0a61f51f87567d21e5400f (diff) | |
download | irssi-9a5b97164e99d90f91ef497acad05480795ec5a8.zip |
Always save theme to ~/.irssi/ no matter where it was read from.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1323 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r-- | src/fe-common/core/themes.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/src/fe-common/core/themes.c b/src/fe-common/core/themes.c index 317b3bf5..a2a9f806 100644 --- a/src/fe-common/core/themes.c +++ b/src/fe-common/core/themes.c @@ -938,27 +938,15 @@ static void theme_save(THEME_REC *theme) g_hash_table_foreach(theme->modules, (GHFunc) module_save, config); - ok = TRUE; - path = g_strdup(theme->path); - if (config_write(config, NULL, 0660) == -1) { - /* we probably tried to save to global directory - where we didn't have access.. try saving it to - home dir instead. */ - char *str; - - /* check that we really didn't try to save - it to home dir.. */ - g_free(path); - path = g_strdup_printf("%s/.irssi/%s", g_get_home_dir(), - g_basename(theme->path)); - str = strrchr(path, '/'); - if (strncmp(theme->path, path, (int) (path-str)) == 0 || - config_write(config, path, 0660) == -1) - ok = FALSE; - } + /* always save the theme to ~/.irssi/ */ + path = g_strdup_printf("%s/.irssi/%s", g_get_home_dir(), + g_basename(theme->path)); + ok = config_write(config, path, 0660) == 0; + printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, ok ? TXT_THEME_SAVED : TXT_THEME_SAVE_FAILED, path, config_last_error(config)); + g_free(path); config_close(config); } |