mirror of
https://github.com/irssi/irssi.git
synced 2024-09-01 04:14:16 -04:00
/layout save saves !channels using the short name now, so they work properly
again git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2728 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
abdd0f04c5
commit
18143d6bd8
@ -132,36 +132,39 @@ static void sig_layout_restore(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void window_save_items(WINDOW_REC *window, CONFIG_NODE *node)
|
||||
static void sig_layout_save_item(WINDOW_REC *window, WI_ITEM_REC *item,
|
||||
CONFIG_NODE *node)
|
||||
{
|
||||
CONFIG_NODE *subnode;
|
||||
GSList *tmp;
|
||||
const char *type;
|
||||
|
||||
node = config_node_section(node, "items", NODE_TYPE_LIST);
|
||||
for (tmp = window->items; tmp != NULL; tmp = tmp->next) {
|
||||
WI_ITEM_REC *rec = tmp->data;
|
||||
SERVER_REC *server = rec->server;
|
||||
type = module_find_id_str("WINDOW ITEM TYPE", item->type);
|
||||
if (type == NULL)
|
||||
return;
|
||||
|
||||
type = module_find_id_str("WINDOW ITEM TYPE", rec->type);
|
||||
if (type == NULL) continue;
|
||||
subnode = config_node_section(node, NULL, NODE_TYPE_BLOCK);
|
||||
|
||||
subnode = config_node_section(node, NULL, NODE_TYPE_BLOCK);
|
||||
iconfig_node_set_str(subnode, "type", type);
|
||||
type = chat_protocol_find_id(item->chat_type)->name;
|
||||
iconfig_node_set_str(subnode, "chat_type", type);
|
||||
iconfig_node_set_str(subnode, "name", item->name);
|
||||
|
||||
iconfig_node_set_str(subnode, "type", type);
|
||||
type = chat_protocol_find_id(rec->chat_type)->name;
|
||||
iconfig_node_set_str(subnode, "chat_type", type);
|
||||
iconfig_node_set_str(subnode, "name", rec->name);
|
||||
|
||||
if (server != NULL)
|
||||
iconfig_node_set_str(subnode, "tag", server->tag);
|
||||
else if (IS_QUERY(rec)) {
|
||||
iconfig_node_set_str(subnode, "tag",
|
||||
QUERY(rec)->server_tag);
|
||||
}
|
||||
if (item->server != NULL)
|
||||
iconfig_node_set_str(subnode, "tag", item->server->tag);
|
||||
else if (IS_QUERY(item)) {
|
||||
iconfig_node_set_str(subnode, "tag", QUERY(item)->server_tag);
|
||||
}
|
||||
}
|
||||
|
||||
static void window_save_items(WINDOW_REC *window, CONFIG_NODE *node)
|
||||
{
|
||||
GSList *tmp;
|
||||
|
||||
node = config_node_section(node, "items", NODE_TYPE_LIST);
|
||||
for (tmp = window->items; tmp != NULL; tmp = tmp->next)
|
||||
signal_emit("layout save item", 3, window, tmp->data, node);
|
||||
}
|
||||
|
||||
static void window_save(WINDOW_REC *window, CONFIG_NODE *node)
|
||||
{
|
||||
char refnum[MAX_INT_STRLEN];
|
||||
@ -224,10 +227,12 @@ void windows_layout_init(void)
|
||||
{
|
||||
signal_add("layout restore item", (SIGNAL_FUNC) sig_layout_restore_item);
|
||||
signal_add("layout restore", (SIGNAL_FUNC) sig_layout_restore);
|
||||
signal_add("layout save item", (SIGNAL_FUNC) sig_layout_save_item);
|
||||
}
|
||||
|
||||
void windows_layout_deinit(void)
|
||||
{
|
||||
signal_remove("layout restore item", (SIGNAL_FUNC) sig_layout_restore_item);
|
||||
signal_remove("layout restore", (SIGNAL_FUNC) sig_layout_restore);
|
||||
signal_remove("layout save item", (SIGNAL_FUNC) sig_layout_save_item);
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ INCLUDES = \
|
||||
real_sources = \
|
||||
fe-irc-channels.c \
|
||||
fe-irc-commands.c \
|
||||
fe-irc-layout.c \
|
||||
fe-irc-messages.c \
|
||||
fe-irc-queries.c \
|
||||
fe-irc-server.c \
|
||||
|
@ -37,6 +37,9 @@ void fe_irc_channels_deinit(void);
|
||||
void fe_irc_queries_init(void);
|
||||
void fe_irc_queries_deinit(void);
|
||||
|
||||
void fe_irc_layout_init(void);
|
||||
void fe_irc_layout_deinit(void);
|
||||
|
||||
void fe_irc_messages_init(void);
|
||||
void fe_irc_messages_deinit(void);
|
||||
|
||||
@ -75,6 +78,7 @@ void fe_common_irc_init(void)
|
||||
|
||||
fe_irc_channels_init();
|
||||
fe_irc_queries_init();
|
||||
fe_irc_layout_init();
|
||||
fe_irc_messages_init();
|
||||
fe_irc_commands_init();
|
||||
fe_ircnet_init();
|
||||
@ -98,6 +102,7 @@ void fe_common_irc_deinit(void)
|
||||
|
||||
fe_irc_channels_deinit();
|
||||
fe_irc_queries_deinit();
|
||||
fe_irc_layout_deinit();
|
||||
fe_irc_messages_deinit();
|
||||
fe_irc_commands_deinit();
|
||||
fe_ircnet_deinit();
|
||||
|
63
src/fe-common/irc/fe-irc-layout.c
Normal file
63
src/fe-common/irc/fe-irc-layout.c
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
fe-irc-layout.c : irssi
|
||||
|
||||
Copyright (C) 2000-2002 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
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "module.h"
|
||||
#include "signals.h"
|
||||
#include "settings.h"
|
||||
#include "lib-config/iconfig.h"
|
||||
|
||||
#include "irc-servers.h"
|
||||
#include "irc-channels.h"
|
||||
|
||||
#include "fe-windows.h"
|
||||
|
||||
static void sig_layout_save_item(WINDOW_REC *window, WI_ITEM_REC *item,
|
||||
CONFIG_NODE *node)
|
||||
{
|
||||
CONFIG_NODE *subnode;
|
||||
IRC_CHANNEL_REC *channel;
|
||||
char *name;
|
||||
|
||||
channel = IRC_CHANNEL(item);
|
||||
if (channel == NULL || *channel->name != '!')
|
||||
return;
|
||||
|
||||
/* save !ABCDEchannels using just short name */
|
||||
subnode = config_node_section(node, NULL, NODE_TYPE_BLOCK);
|
||||
|
||||
name = g_strconcat("!", channel->name+6, NULL);
|
||||
iconfig_node_set_str(subnode, "type", "CHANNEL");
|
||||
iconfig_node_set_str(subnode, "chat_type", "IRC");
|
||||
iconfig_node_set_str(subnode, "name", name);
|
||||
iconfig_node_set_str(subnode, "tag", channel->server->tag);
|
||||
g_free(name);
|
||||
|
||||
signal_stop();
|
||||
}
|
||||
|
||||
void fe_irc_layout_init(void)
|
||||
{
|
||||
signal_add("layout save item", (SIGNAL_FUNC) sig_layout_save_item);
|
||||
}
|
||||
|
||||
void fe_irc_layout_deinit(void)
|
||||
{
|
||||
signal_remove("layout save item", (SIGNAL_FUNC) sig_layout_save_item);
|
||||
}
|
Loading…
Reference in New Issue
Block a user