diff options
author | Timo Sirainen <cras@irssi.org> | 2000-07-22 22:05:29 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-07-22 22:05:29 +0000 |
commit | d9b661a1fb3178fd0a6d7e58aee811a9d499feb8 (patch) | |
tree | f81d3a9613a4a4618b9bc3bb4ab4b59b73c7816e /src/core | |
parent | 511f95ccafaefe48688f37cbe8c7b0e59d509b41 (diff) | |
download | irssi-d9b661a1fb3178fd0a6d7e58aee811a9d499feb8.zip |
Moved /SAVE and /RELOAD to fe-common. Print "config saved" and
"config reloaded" messages.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@510 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/commands.c | 19 | ||||
-rw-r--r-- | src/core/settings.c | 12 | ||||
-rw-r--r-- | src/core/settings.h | 4 |
3 files changed, 9 insertions, 26 deletions
diff --git a/src/core/commands.c b/src/core/commands.c index 48489db7..31626a25 100644 --- a/src/core/commands.c +++ b/src/core/commands.c @@ -673,21 +673,6 @@ static void cmd_cd(const char *data) g_free(str); } -static void cmd_reload(const char *data) -{ - char *fname; - - fname = *data != '\0' ? g_strdup(data) : - g_strdup_printf("%s/.irssi/config", g_get_home_dir()); - settings_reread(fname); - g_free(fname); -} - -static void cmd_save(const char *data) -{ - settings_save(*data != '\0' ? data : NULL); -} - void commands_init(void) { commands = NULL; @@ -701,8 +686,6 @@ void commands_init(void) command_bind("eval", NULL, (SIGNAL_FUNC) cmd_eval); command_bind("cd", NULL, (SIGNAL_FUNC) cmd_cd); - command_bind("reload", NULL, (SIGNAL_FUNC) cmd_reload); - command_bind("save", NULL, (SIGNAL_FUNC) cmd_save); } void commands_deinit(void) @@ -714,6 +697,4 @@ void commands_deinit(void) command_unbind("eval", (SIGNAL_FUNC) cmd_eval); command_unbind("cd", (SIGNAL_FUNC) cmd_cd); - command_unbind("reload", (SIGNAL_FUNC) cmd_reload); - command_unbind("save", (SIGNAL_FUNC) cmd_save); } diff --git a/src/core/settings.c b/src/core/settings.c index b9d73d1d..5fa61064 100644 --- a/src/core/settings.c +++ b/src/core/settings.c @@ -285,7 +285,7 @@ static void init_configfile(void) signal(SIGTERM, sig_term); } -void settings_reread(const char *fname) +int settings_reread(const char *fname) { CONFIG_REC *tempconfig; char *str; @@ -298,7 +298,7 @@ void settings_reread(const char *fname) if (tempconfig == NULL) { signal_emit("gui dialog", 2, "error", g_strerror(errno)); - return; + return FALSE; } if (config_last_error(tempconfig) != NULL) { @@ -308,7 +308,7 @@ void settings_reread(const char *fname) g_free(str); config_close(tempconfig); - return; + return FALSE; } config_close(mainconfig); @@ -316,20 +316,22 @@ void settings_reread(const char *fname) signal_emit("setup changed", 0); signal_emit("setup reread", 0); + return TRUE; } -void settings_save(const char *fname) +int settings_save(const char *fname) { char *str; if (config_write(mainconfig, fname, 0660) == 0) - return; + return TRUE; /* error */ str = g_strdup_printf(_("Couldn't save configuration file: %s"), config_last_error(mainconfig)); signal_emit("gui dialog", 2, "error", str); g_free(str); + return FALSE; } void settings_init(void) diff --git a/src/core/settings.h b/src/core/settings.h index 583e0dd6..0a53a6ee 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -54,8 +54,8 @@ GSList *settings_get_sorted(void); SETTINGS_REC *settings_get_record(const char *key); /* if `fname' is NULL, the default is used */ -void settings_reread(const char *fname); -void settings_save(const char *fname); +int settings_reread(const char *fname); +int settings_save(const char *fname); void settings_init(void); void settings_deinit(void); |