mirror of
https://github.com/irssi/irssi.git
synced 2025-02-02 15:08:01 -05:00
/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
This commit is contained in:
parent
a04a1c6f21
commit
930ccf5238
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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 },
|
||||
|
@ -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,
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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
|
@ -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);
|
||||
}
|
11
src/fe-common/core/windows-layout.h
Normal file
11
src/fe-common/core/windows-layout.h
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user