diff --git a/src/fe-common/core/windows-layout.c b/src/fe-common/core/windows-layout.c index 1a06fdd3..dbd51d41 100644 --- a/src/fe-common/core/windows-layout.c +++ b/src/fe-common/core/windows-layout.c @@ -44,7 +44,7 @@ static void signal_query_created_curwin(QUERY_REC *query) window_item_add(restore_win, (WI_ITEM_REC *) query, FALSE); } -static void sig_window_restore_item(WINDOW_REC *window, const char *type, +static void sig_layout_restore_item(WINDOW_REC *window, const char *type, CONFIG_NODE *node) { char *name, *tag, *chat_type; @@ -86,7 +86,7 @@ static void window_add_items(WINDOW_REC *window, CONFIG_NODE *node) type = config_node_get_str(node, "type", NULL); if (type != NULL) { - signal_emit("window restore item", 3, + signal_emit("layout restore item", 3, window, type, node); } } @@ -94,10 +94,10 @@ static void window_add_items(WINDOW_REC *window, CONFIG_NODE *node) void windows_layout_restore(void) { - signal_emit("windows restored", 0); + signal_emit("layout restore", 0); } -static void sig_windows_restored(void) +static void sig_layout_restore(void) { WINDOW_REC *window; CONFIG_NODE *node; @@ -124,7 +124,7 @@ static void sig_windows_restored(void) window->theme = theme_load(window->theme_name); window_add_items(window, config_node_section(node, "items", -1)); - signal_emit("window restore", 2, window, node); + signal_emit("layout restore window", 2, window, node); } } @@ -183,7 +183,7 @@ static void window_save(WINDOW_REC *window, CONFIG_NODE *node) if (window->items != NULL) window_save_items(window, node); - signal_emit("window save", 2, window, node); + signal_emit("layout save window", 2, window, node); } void windows_layout_save(void) @@ -194,7 +194,7 @@ void windows_layout_save(void) node = iconfig_node_traverse("windows", TRUE); g_slist_foreach(windows, (GFunc) window_save, node); - signal_emit("windows saved", 0); + signal_emit("layout save", 0); printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE, TXT_WINDOWS_LAYOUT_SAVED); @@ -203,18 +203,20 @@ void windows_layout_save(void) void windows_layout_reset(void) { iconfig_set_str(NULL, "windows", NULL); + signal_emit("layout reset", 0); + 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); - signal_add("windows restored", (SIGNAL_FUNC) sig_windows_restored); + signal_add("layout restore item", (SIGNAL_FUNC) sig_layout_restore_item); + signal_add("layout restore", (SIGNAL_FUNC) sig_layout_restore); } void windows_layout_deinit(void) { - signal_remove("window restore item", (SIGNAL_FUNC) sig_window_restore_item); - signal_remove("windows restored", (SIGNAL_FUNC) sig_windows_restored); + signal_remove("layout restore item", (SIGNAL_FUNC) sig_layout_restore_item); + signal_remove("layout restore", (SIGNAL_FUNC) sig_layout_restore); } diff --git a/src/fe-text/mainwindows-layout.c b/src/fe-text/mainwindows-layout.c index 5bcd854d..a97995e0 100644 --- a/src/fe-text/mainwindows-layout.c +++ b/src/fe-text/mainwindows-layout.c @@ -27,7 +27,7 @@ #include "mainwindows.h" #include "gui-windows.h" -static void sig_window_save(WINDOW_REC *window, CONFIG_NODE *node) +static void sig_layout_window_save(WINDOW_REC *window, CONFIG_NODE *node) { WINDOW_REC *active; @@ -39,7 +39,7 @@ static void sig_window_save(WINDOW_REC *window, CONFIG_NODE *node) } } -static void sig_window_restore(WINDOW_REC *window, CONFIG_NODE *node) +static void sig_layout_window_restore(WINDOW_REC *window, CONFIG_NODE *node) { WINDOW_REC *parent; @@ -62,7 +62,7 @@ static void main_window_save(MAIN_WINDOW_REC *window, CONFIG_NODE *node) iconfig_node_set_int(node, "lines", window->height); } -static void sig_windows_saved(void) +static void sig_layout_save(void) { CONFIG_NODE *node; @@ -93,7 +93,7 @@ static GSList *get_sorted_windows_config(CONFIG_NODE *node) return output; } -static void sig_windows_restored(void) +static void sig_layout_restore(void) { MAIN_WINDOW_REC *lower_window; WINDOW_REC *window; @@ -129,18 +129,25 @@ static void sig_windows_restored(void) mainwindow_set_size(lower_window, lower_size); } +static void sig_layout_reset(void) +{ + iconfig_set_str(NULL, "mainwindows", NULL); +} + void mainwindows_layout_init(void) { - signal_add("window save", (SIGNAL_FUNC) sig_window_save); - signal_add("window restore", (SIGNAL_FUNC) sig_window_restore); - signal_add("windows saved", (SIGNAL_FUNC) sig_windows_saved); - signal_add_first("windows restored", (SIGNAL_FUNC) sig_windows_restored); + signal_add("layout window save", (SIGNAL_FUNC) sig_layout_window_save); + signal_add("layout window restore", (SIGNAL_FUNC) sig_layout_window_restore); + signal_add("layout save", (SIGNAL_FUNC) sig_layout_save); + signal_add_first("layout restore", (SIGNAL_FUNC) sig_layout_restore); + signal_add("layout reset", (SIGNAL_FUNC) sig_layout_reset); } void mainwindows_layout_deinit(void) { - signal_remove("window save", (SIGNAL_FUNC) sig_window_save); - signal_remove("window restore", (SIGNAL_FUNC) sig_window_restore); - signal_remove("windows saved", (SIGNAL_FUNC) sig_windows_saved); - signal_remove("windows restored", (SIGNAL_FUNC) sig_windows_restored); + signal_remove("layout window save", (SIGNAL_FUNC) sig_layout_window_save); + signal_remove("layout window restore", (SIGNAL_FUNC) sig_layout_window_restore); + signal_remove("layout save", (SIGNAL_FUNC) sig_layout_save); + signal_remove("layout restore", (SIGNAL_FUNC) sig_layout_restore); + signal_remove("layout reset", (SIGNAL_FUNC) sig_layout_reset); }