diff options
author | Timo Sirainen <cras@irssi.org> | 2001-02-21 19:19:24 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-02-21 19:19:24 +0000 |
commit | 930ccf5238c03ea84bd1b5f1b2d26de7077d3c04 (patch) | |
tree | db78b19f4c99348ee82d48bc51e83f04cb4e57dc /src | |
parent | a04a1c6f218422ad17bd73aa4ebab135244b3f64 (diff) | |
download | irssi-930ccf5238c03ea84bd1b5f1b2d26de7077d3c04.zip |
/SAVEWINDOWS -> /LAYOUT SAVE. Added /LAYOUT RESET. Initialize GLib log
-> Irssi windows _after_ windows are created..
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1278 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r-- | src/fe-common/core/Makefile.am | 4 | ||||
-rw-r--r-- | src/fe-common/core/fe-common-core.c | 22 | ||||
-rw-r--r-- | src/fe-common/core/formats.c | 2 | ||||
-rw-r--r-- | src/fe-common/core/module-formats.c | 3 | ||||
-rw-r--r-- | src/fe-common/core/module-formats.h | 3 | ||||
-rw-r--r-- | src/fe-common/core/window-commands.c | 17 | ||||
-rw-r--r-- | src/fe-common/core/window-save.h | 10 | ||||
-rw-r--r-- | src/fe-common/core/windows-layout.c (renamed from src/fe-common/core/window-save.c) | 22 | ||||
-rw-r--r-- | src/fe-common/core/windows-layout.h | 11 |
9 files changed, 57 insertions, 37 deletions
diff --git a/src/fe-common/core/Makefile.am b/src/fe-common/core/Makefile.am index 0c7081cf..9913cfe8 100644 --- a/src/fe-common/core/Makefile.am +++ b/src/fe-common/core/Makefile.am @@ -35,7 +35,7 @@ libfe_common_core_a_SOURCES = \ window-activity.c \ window-commands.c \ window-items.c \ - window-save.c \ + windows-layout.c \ fe-windows.c noinst_HEADERS = \ @@ -56,5 +56,5 @@ noinst_HEADERS = \ themes.h \ translation.h \ window-items.h \ - window-save.h \ + windows-layout.h \ fe-windows.h diff --git a/src/fe-common/core/fe-common-core.c b/src/fe-common/core/fe-common-core.c index b1fa9af5..39d5ae3f 100644 --- a/src/fe-common/core/fe-common-core.c +++ b/src/fe-common/core/fe-common-core.c @@ -40,7 +40,7 @@ #include "fe-channels.h" #include "fe-windows.h" #include "window-items.h" -#include "window-save.h" +#include "windows-layout.h" #include <signal.h> @@ -170,7 +170,7 @@ void fe_common_core_init(void) window_activity_init(); window_commands_init(); window_items_init(); - window_save_init(); + windows_layout_init(); fe_core_commands_init(); fe_channels_init(); @@ -211,7 +211,7 @@ void fe_common_core_deinit(void) window_activity_deinit(); window_commands_deinit(); window_items_deinit(); - window_save_deinit(); + windows_layout_deinit(); fe_core_commands_deinit(); fe_channels_deinit(); @@ -258,7 +258,7 @@ static void create_windows(void) { WINDOW_REC *window; - windows_restore(); + windows_layout_restore(); if (windows != NULL) return; @@ -323,11 +323,6 @@ static void autoconnect_servers(void) void fe_common_core_finish_init(void) { - g_log_set_handler(G_LOG_DOMAIN, - (GLogLevelFlags) (G_LOG_LEVEL_CRITICAL | - G_LOG_LEVEL_WARNING), - (GLogFunc) glog_func, NULL); - signal_emit("irssi init read settings", 0); #ifdef SIGPIPE @@ -345,5 +340,12 @@ void fe_common_core_finish_init(void) } create_windows(); - autoconnect_servers(); + + /* _after_ windows are created.. */ + g_log_set_handler(G_LOG_DOMAIN, + (GLogLevelFlags) (G_LOG_LEVEL_CRITICAL | + G_LOG_LEVEL_WARNING), + (GLogFunc) glog_func, NULL); + + autoconnect_servers(); } diff --git a/src/fe-common/core/formats.c b/src/fe-common/core/formats.c index 107bc497..7faf3d2a 100644 --- a/src/fe-common/core/formats.c +++ b/src/fe-common/core/formats.c @@ -268,7 +268,9 @@ static char *format_get_text_args(TEXT_DEST_REC *dest, char *ret; ret = parse_special((char **) &text, + active_win == NULL ? NULL : active_win->active_server, + active_win == NULL ? NULL : active_win->active, arglist, &need_free, NULL, 0); diff --git a/src/fe-common/core/module-formats.c b/src/fe-common/core/module-formats.c index 9f9438b3..5b062612 100644 --- a/src/fe-common/core/module-formats.c +++ b/src/fe-common/core/module-formats.c @@ -41,7 +41,8 @@ FORMAT_REC fecommon_core_formats[] = { { "windowlist_header", "Ref Name Active item Server Level", 0 }, { "windowlist_line", "$[3]0 %|$[20]1 $[15]2 $[15]3 $4", 5, { 1, 0, 0, 0, 0 } }, { "windowlist_footer", "", 0 }, - { "windows_saved", "State of windows saved (/SAVE is still needed to update configuration file)", 0 }, + { "windows_layout_saved", "Layout of windows is now remembered next time you start irssi", 0 }, + { "windows_layout_reset", "Layout of windows reset to defaults", 0 }, /* ---- */ { NULL, "Server", 0 }, diff --git a/src/fe-common/core/module-formats.h b/src/fe-common/core/module-formats.h index 068ab027..2b634833 100644 --- a/src/fe-common/core/module-formats.h +++ b/src/fe-common/core/module-formats.h @@ -19,7 +19,8 @@ enum { TXT_WINDOWLIST_HEADER, TXT_WINDOWLIST_LINE, TXT_WINDOWLIST_FOOTER, - TXT_WINDOWS_SAVED, + TXT_WINDOWS_LAYOUT_SAVED, + TXT_WINDOWS_LAYOUT_RESET, TXT_FILL_2, diff --git a/src/fe-common/core/window-commands.c b/src/fe-common/core/window-commands.c index 049d74e1..9e9f961a 100644 --- a/src/fe-common/core/window-commands.c +++ b/src/fe-common/core/window-commands.c @@ -30,7 +30,7 @@ #include "themes.h" #include "fe-windows.h" #include "window-items.h" -#include "window-save.h" +#include "windows-layout.h" #include "printtext.h" static void cmd_window(const char *data, void *server, WI_ITEM_REC *item) @@ -448,10 +448,9 @@ static void cmd_window_theme(const char *data) } } -/* SYNTAX: SAVEWINDOWS */ -static void cmd_savewindows(void) +static void cmd_layout(const char *data, SERVER_REC *server, WI_ITEM_REC *item) { - windows_save(); + command_runsub("layout", data, server, item); } /* SYNTAX: FOREACH WINDOW <command> */ @@ -496,7 +495,11 @@ void window_commands_init(void) command_bind("window move right", NULL, (SIGNAL_FUNC) cmd_window_move_right); command_bind("window list", NULL, (SIGNAL_FUNC) cmd_window_list); command_bind("window theme", NULL, (SIGNAL_FUNC) cmd_window_theme); - command_bind("savewindows", NULL, (SIGNAL_FUNC) cmd_savewindows); + command_bind("layout", NULL, (SIGNAL_FUNC) cmd_layout); + /* SYNTAX: LAYOUT SAVE */ + command_bind("layout save", NULL, (SIGNAL_FUNC) windows_layout_save); + /* SYNTAX: LAYOUT RESET */ + command_bind("layout reset", NULL, (SIGNAL_FUNC) windows_layout_reset); command_bind("foreach window", NULL, (SIGNAL_FUNC) cmd_foreach_window); command_set_options("window number", "sticky"); @@ -528,6 +531,8 @@ void window_commands_deinit(void) command_unbind("window move right", (SIGNAL_FUNC) cmd_window_move_right); command_unbind("window list", (SIGNAL_FUNC) cmd_window_list); command_unbind("window theme", (SIGNAL_FUNC) cmd_window_theme); - command_unbind("savewindows", (SIGNAL_FUNC) cmd_savewindows); + command_unbind("layout", (SIGNAL_FUNC) cmd_layout); + command_unbind("layout save", (SIGNAL_FUNC) windows_layout_save); + command_unbind("layout reset", (SIGNAL_FUNC) windows_layout_reset); command_unbind("foreach window", (SIGNAL_FUNC) cmd_foreach_window); } diff --git a/src/fe-common/core/window-save.h b/src/fe-common/core/window-save.h deleted file mode 100644 index 80d801db..00000000 --- a/src/fe-common/core/window-save.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __WINDOW_SAVE_H -#define __WINDOW_SAVE_H - -void windows_restore(void); -void windows_save(void); - -void window_save_init(void); -void window_save_deinit(void); - -#endif diff --git a/src/fe-common/core/window-save.c b/src/fe-common/core/windows-layout.c index 3626cc83..814127fb 100644 --- a/src/fe-common/core/window-save.c +++ b/src/fe-common/core/windows-layout.c @@ -1,7 +1,7 @@ /* - window-save.c : irssi + windows-layout.c : irssi - Copyright (C) 2000 Timo Sirainen + Copyright (C) 2000-2001 Timo Sirainen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -76,7 +76,7 @@ static void window_add_items(WINDOW_REC *window, CONFIG_NODE *node) } } -void windows_restore(void) +void windows_layout_restore(void) { WINDOW_REC *window; CONFIG_NODE *node; @@ -164,7 +164,7 @@ static void window_save(WINDOW_REC *window, CONFIG_NODE *node) signal_emit("window save", 2, window, node); } -void windows_save(void) +void windows_layout_save(void) { CONFIG_NODE *node; @@ -174,15 +174,23 @@ void windows_save(void) g_slist_foreach(windows, (GFunc) window_save, node); signal_emit("windows saved", 0); - printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_WINDOWS_SAVED); + printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, + TXT_WINDOWS_LAYOUT_SAVED); } -void window_save_init(void) +void windows_layout_reset(void) +{ + iconfig_set_str(NULL, "windows", NULL); + printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, + TXT_WINDOWS_LAYOUT_RESET); +} + +void windows_layout_init(void) { signal_add("window restore item", (SIGNAL_FUNC) sig_window_restore_item); } -void window_save_deinit(void) +void windows_layout_deinit(void) { signal_remove("window restore item", (SIGNAL_FUNC) sig_window_restore_item); } diff --git a/src/fe-common/core/windows-layout.h b/src/fe-common/core/windows-layout.h new file mode 100644 index 00000000..d33fda52 --- /dev/null +++ b/src/fe-common/core/windows-layout.h @@ -0,0 +1,11 @@ +#ifndef __WINDOWS_LAYOUT_H +#define __WINDOWS_LAYOUT_H + +void windows_layout_restore(void); +void windows_layout_save(void); +void windows_layout_reset(void); + +void windows_layout_init(void); +void windows_layout_deinit(void); + +#endif |