1
0
mirror of https://github.com/irssi/irssi.git synced 2024-10-27 05:20:20 -04:00

Added -delete option to /WINDOW THEME. /WINDOW THEME without parameters

prints the active theme.


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1576 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-06-27 21:16:43 +00:00 committed by cras
parent 0db8e96019
commit 69c864f8d5
3 changed files with 43 additions and 10 deletions

View File

@ -193,7 +193,10 @@ FORMAT_REC fecommon_core_formats[] = {
{ "theme_save_failed", "Error saving theme to $0: $1", 2, { 0, 0 } },
{ "theme_not_found", "Theme {hilight $0} not found", 1, { 0 } },
{ "theme_changed", "Using now theme {hilight $0} ($1)", 2, { 0, 0 } },
{ "window_theme_changed", "Using theme {hilight $0} ($1) in this window", 2, { 0, 0 } },
{ "window_theme", "Using theme {hilight $0} in this window", 2, { 0, 0 } },
{ "window_theme_default", "No theme is set for this window", 0 },
{ "window_theme_changed", "Using now theme {hilight $0} ($1) in this window", 2, { 0, 0 } },
{ "window_theme_removed", "Removed theme from this window", 0 },
{ "format_title", "%:[{hilight $0}] - [{hilight $1}]%:", 2, { 0, 0 } },
{ "format_subtitle", "[{hilight $0}]", 1, { 0 } },
{ "format_item", "$0 = $1", 2, { 0, 0 } },

View File

@ -161,7 +161,10 @@ enum {
TXT_THEME_SAVE_FAILED,
TXT_THEME_NOT_FOUND,
TXT_THEME_CHANGED,
TXT_WINDOW_THEME,
TXT_WINDOW_THEME_DEFAULT,
TXT_WINDOW_THEME_CHANGED,
TXT_WINDOW_THEME_REMOVED,
TXT_FORMAT_TITLE,
TXT_FORMAT_SUBTITLE,
TXT_FORMAT_ITEM,

View File

@ -463,23 +463,49 @@ static void cmd_window_list(void)
printformat(NULL, NULL, MSGLEVEL_CLIENTCRAP, TXT_WINDOWLIST_FOOTER);
}
/* SYNTAX: WINDOW THEME <name> */
/* SYNTAX: WINDOW THEME [-delete] [<name>] */
static void cmd_window_theme(const char *data)
{
THEME_REC *theme;
GHashTable *optlist;
char *name;
void *free_arg;
g_free_not_null(active_win->theme_name);
active_win->theme_name = g_strdup(data);
if (!cmd_get_params(data, &free_arg, 1 | PARAM_FLAG_OPTIONS,
"window theme", &optlist, &name))
return;
if (g_hash_table_lookup(optlist, "delete") != NULL) {
g_free_and_null(active_win->theme_name);
active_win->theme = theme = theme_load(data);
if (theme != NULL) {
printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
TXT_WINDOW_THEME_CHANGED,
theme->name, theme->path);
TXT_WINDOW_THEME_REMOVED);
} else if (*name == '\0') {
if (active_win->theme == NULL) {
printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
TXT_WINDOW_THEME_DEFAULT);
} else {
theme = active_win->theme;
printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
TXT_WINDOW_THEME,
theme->name, theme->path);
}
} else {
printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
TXT_THEME_NOT_FOUND, data);
g_free_not_null(active_win->theme_name);
active_win->theme_name = g_strdup(data);
active_win->theme = theme = theme_load(data);
if (theme != NULL) {
printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
TXT_WINDOW_THEME_CHANGED,
theme->name, theme->path);
} else {
printformat_window(active_win, MSGLEVEL_CLIENTNOTICE,
TXT_THEME_NOT_FOUND, data);
}
}
cmd_params_free(free_arg);
}
static void cmd_layout(const char *data, SERVER_REC *server, WI_ITEM_REC *item)
@ -538,6 +564,7 @@ void window_commands_init(void)
command_set_options("window number", "sticky");
command_set_options("window server", "sticky unsticky");
command_set_options("window theme", "delete");
}
void window_commands_deinit(void)