From 9a5b97164e99d90f91ef497acad05480795ec5a8 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sat, 3 Mar 2001 21:16:40 +0000 Subject: [PATCH] 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 --- src/fe-common/core/themes.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 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; + /* 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; - /* 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; - } printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, ok ? TXT_THEME_SAVED : TXT_THEME_SAVE_FAILED, path, config_last_error(config)); + g_free(path); config_close(config); }