2000-04-26 04:03:38 -04:00
|
|
|
/*
|
2001-03-12 05:33:13 -05:00
|
|
|
statusbar-items.c : irssi
|
2000-04-26 04:03:38 -04:00
|
|
|
|
2001-03-12 05:33:13 -05:00
|
|
|
Copyright (C) 1999-2001 Timo Sirainen
|
2000-04-26 04:03:38 -04:00
|
|
|
|
|
|
|
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"
|
2001-12-19 21:17:35 -05:00
|
|
|
#include "servers.h"
|
2000-04-26 04:03:38 -04:00
|
|
|
|
2001-10-23 17:26:03 -04:00
|
|
|
#include "themes.h"
|
2000-05-04 06:32:42 -04:00
|
|
|
#include "statusbar.h"
|
2001-10-13 12:11:13 -04:00
|
|
|
#include "gui-entry.h"
|
2001-11-18 17:17:31 -05:00
|
|
|
#include "gui-windows.h"
|
2000-04-26 04:03:38 -04:00
|
|
|
|
2000-06-10 20:42:37 -04:00
|
|
|
/* how often to redraw lagging time (seconds) */
|
2000-04-26 04:03:38 -04:00
|
|
|
#define LAG_REFRESH_TIME 10
|
2000-06-10 20:42:37 -04:00
|
|
|
|
2000-04-26 04:03:38 -04:00
|
|
|
static GList *activity_list;
|
2001-11-25 11:35:11 -05:00
|
|
|
static GSList *more_visible; /* list of MAIN_WINDOW_RECs which have --more-- */
|
2001-10-13 12:11:13 -04:00
|
|
|
static GHashTable *input_entries;
|
2001-11-19 17:21:57 -05:00
|
|
|
static int last_lag, last_lag_unknown, lag_timeout_tag;
|
2000-04-26 04:03:38 -04:00
|
|
|
|
2001-10-13 12:11:13 -04:00
|
|
|
static void item_window_active(SBAR_ITEM_REC *item, int get_size_only)
|
2000-04-26 04:03:38 -04:00
|
|
|
{
|
2001-10-13 12:11:13 -04:00
|
|
|
WINDOW_REC *window;
|
2000-04-26 04:03:38 -04:00
|
|
|
|
2001-10-13 12:11:13 -04:00
|
|
|
window = active_win;
|
|
|
|
if (item->bar->parent_window != NULL)
|
|
|
|
window = item->bar->parent_window->active;
|
2001-03-12 05:33:13 -05:00
|
|
|
|
2001-10-13 12:11:13 -04:00
|
|
|
if (window != NULL && window->active != NULL) {
|
|
|
|
statusbar_item_default_handler(item, get_size_only,
|
|
|
|
NULL, "", TRUE);
|
|
|
|
} else if (get_size_only) {
|
|
|
|
item->min_size = item->max_size = 0;
|
2001-03-12 05:33:13 -05:00
|
|
|
}
|
2000-04-26 04:03:38 -04:00
|
|
|
}
|
|
|
|
|
2001-10-13 12:11:13 -04:00
|
|
|
static void item_window_empty(SBAR_ITEM_REC *item, int get_size_only)
|
2000-04-26 04:03:38 -04:00
|
|
|
{
|
2001-10-13 12:11:13 -04:00
|
|
|
WINDOW_REC *window;
|
2000-04-26 04:03:38 -04:00
|
|
|
|
2001-10-13 12:11:13 -04:00
|
|
|
window = active_win;
|
|
|
|
if (item->bar->parent_window != NULL)
|
|
|
|
window = item->bar->parent_window->active;
|
2000-04-26 04:03:38 -04:00
|
|
|
|
2001-10-13 12:11:13 -04:00
|
|
|
if (window != NULL && window->active == NULL) {
|
|
|
|
statusbar_item_default_handler(item, get_size_only,
|
|
|
|
NULL, "", TRUE);
|
|
|
|
} else if (get_size_only) {
|
|
|
|
item->min_size = item->max_size = 0;
|
2000-05-04 06:32:42 -04:00
|
|
|
}
|
2000-04-26 04:03:38 -04:00
|
|
|
}
|
|
|
|
|
2001-10-23 17:26:03 -04:00
|
|
|
static char *get_activity_list(MAIN_WINDOW_REC *window, int normal, int hilight)
|
2000-04-26 04:03:38 -04:00
|
|
|
{
|
2001-10-23 17:26:03 -04:00
|
|
|
THEME_REC *theme;
|
2001-03-12 05:33:13 -05:00
|
|
|
GString *str;
|
|
|
|
GList *tmp;
|
2001-10-23 17:26:03 -04:00
|
|
|
char *ret, *name, *format, *value;
|
2001-03-12 05:33:13 -05:00
|
|
|
int is_det;
|
2000-04-26 04:03:38 -04:00
|
|
|
|
2001-03-12 05:33:13 -05:00
|
|
|
str = g_string_new(NULL);
|
2000-04-26 04:03:38 -04:00
|
|
|
|
2001-10-23 17:26:03 -04:00
|
|
|
theme = window != NULL && window->active != NULL &&
|
|
|
|
window->active->theme != NULL ?
|
|
|
|
window->active->theme : current_theme;
|
|
|
|
|
2001-03-12 05:33:13 -05:00
|
|
|
for (tmp = activity_list; tmp != NULL; tmp = tmp->next) {
|
|
|
|
WINDOW_REC *window = tmp->data;
|
|
|
|
|
|
|
|
is_det = window->data_level >= DATA_LEVEL_HILIGHT;
|
|
|
|
if ((!is_det && !normal) || (is_det && !hilight))
|
|
|
|
continue;
|
|
|
|
|
2001-10-23 17:26:03 -04:00
|
|
|
/* comma separator */
|
|
|
|
if (str->len > 0) {
|
|
|
|
value = theme_format_expand(theme, "{sb_act_sep ,}");
|
|
|
|
g_string_append(str, value);
|
|
|
|
g_free(value);
|
|
|
|
}
|
2001-03-12 05:33:13 -05:00
|
|
|
|
|
|
|
switch (window->data_level) {
|
|
|
|
case DATA_LEVEL_NONE:
|
|
|
|
case DATA_LEVEL_TEXT:
|
2001-10-23 17:26:03 -04:00
|
|
|
name = "{sb_act_text %d}";
|
2001-03-12 05:33:13 -05:00
|
|
|
break;
|
|
|
|
case DATA_LEVEL_MSG:
|
2001-10-23 17:26:03 -04:00
|
|
|
name = "{sb_act_msg %d}";
|
2001-03-12 05:33:13 -05:00
|
|
|
break;
|
|
|
|
default:
|
2001-10-23 17:26:03 -04:00
|
|
|
if (window->hilight_color == NULL)
|
|
|
|
name = "{sb_act_hilight %d}";
|
|
|
|
else
|
|
|
|
name = NULL;
|
2001-03-12 05:33:13 -05:00
|
|
|
break;
|
|
|
|
}
|
2001-03-16 20:52:43 -05:00
|
|
|
|
2001-10-23 17:26:03 -04:00
|
|
|
if (name != NULL)
|
|
|
|
format = g_strdup_printf(name, window->refnum);
|
|
|
|
else
|
|
|
|
format = g_strdup_printf("{sb_act_hilight_color %s %d}",
|
|
|
|
window->hilight_color,
|
|
|
|
window->refnum);
|
|
|
|
|
|
|
|
value = theme_format_expand(theme, format);
|
|
|
|
g_string_append(str, value);
|
|
|
|
g_free(value);
|
|
|
|
|
|
|
|
g_free(format);
|
2000-04-26 04:03:38 -04:00
|
|
|
}
|
2001-01-31 06:23:29 -05:00
|
|
|
|
2001-03-12 05:33:13 -05:00
|
|
|
ret = str->len == 0 ? NULL : str->str;
|
|
|
|
g_string_free(str, ret == NULL);
|
|
|
|
return ret;
|
2000-04-26 04:03:38 -04:00
|
|
|
}
|
|
|
|
|
2001-01-31 06:23:29 -05:00
|
|
|
/* redraw activity, FIXME: if we didn't get enough size, this gets buggy.
|
|
|
|
At least "Det:" isn't printed properly. also we should rearrange the
|
|
|
|
act list so that the highest priority items comes first. */
|
2001-10-13 12:11:13 -04:00
|
|
|
static void item_act(SBAR_ITEM_REC *item, int get_size_only)
|
2000-04-26 04:03:38 -04:00
|
|
|
{
|
2001-10-13 12:11:13 -04:00
|
|
|
char *actlist;
|
2000-04-26 04:03:38 -04:00
|
|
|
|
2001-10-23 17:26:03 -04:00
|
|
|
actlist = get_activity_list(item->bar->parent_window, TRUE, TRUE);
|
2001-10-13 12:11:13 -04:00
|
|
|
if (actlist == NULL) {
|
2001-03-12 05:33:13 -05:00
|
|
|
if (get_size_only)
|
|
|
|
item->min_size = item->max_size = 0;
|
|
|
|
return;
|
|
|
|
}
|
2000-04-26 04:03:38 -04:00
|
|
|
|
2001-10-13 12:11:13 -04:00
|
|
|
statusbar_item_default_handler(item, get_size_only,
|
|
|
|
NULL, actlist, FALSE);
|
2000-04-26 04:03:38 -04:00
|
|
|
|
2001-03-14 21:26:12 -05:00
|
|
|
g_free_not_null(actlist);
|
2000-04-26 04:03:38 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void sig_statusbar_activity_hilight(WINDOW_REC *window, gpointer oldlevel)
|
|
|
|
{
|
2001-03-12 05:33:13 -05:00
|
|
|
GList *tmp;
|
|
|
|
int inspos;
|
2000-04-26 04:03:38 -04:00
|
|
|
|
2001-03-12 05:33:13 -05:00
|
|
|
g_return_if_fail(window != NULL);
|
2000-04-26 04:03:38 -04:00
|
|
|
|
2001-03-12 05:33:13 -05:00
|
|
|
if (settings_get_bool("actlist_moves")) {
|
|
|
|
/* Move the window to the first in the activity list */
|
|
|
|
if (g_list_find(activity_list, window) != NULL)
|
|
|
|
activity_list = g_list_remove(activity_list, window);
|
|
|
|
if (window->data_level != 0)
|
|
|
|
activity_list = g_list_prepend(activity_list, window);
|
2001-10-20 15:52:07 -04:00
|
|
|
statusbar_items_redraw("act");
|
2001-03-12 05:33:13 -05:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (g_list_find(activity_list, window) != NULL) {
|
|
|
|
/* already in activity list */
|
|
|
|
if (window->data_level == 0) {
|
|
|
|
/* remove from activity list */
|
|
|
|
activity_list = g_list_remove(activity_list, window);
|
2001-10-20 15:52:07 -04:00
|
|
|
statusbar_items_redraw("act");
|
2001-03-12 05:33:13 -05:00
|
|
|
} else if (window->data_level != GPOINTER_TO_INT(oldlevel) ||
|
|
|
|
window->hilight_color != 0) {
|
|
|
|
/* different level as last time (or maybe different
|
|
|
|
hilight color?), just redraw it. */
|
2001-10-20 15:52:07 -04:00
|
|
|
statusbar_items_redraw("act");
|
2001-03-12 05:33:13 -05:00
|
|
|
}
|
|
|
|
return;
|
2000-04-26 04:03:38 -04:00
|
|
|
}
|
2001-03-12 05:33:13 -05:00
|
|
|
|
|
|
|
if (window->data_level == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* add window to activity list .. */
|
|
|
|
inspos = 0;
|
|
|
|
for (tmp = activity_list; tmp != NULL; tmp = tmp->next, inspos++) {
|
|
|
|
WINDOW_REC *rec = tmp->data;
|
|
|
|
|
|
|
|
if (window->refnum < rec->refnum) {
|
|
|
|
activity_list =
|
|
|
|
g_list_insert(activity_list, window, inspos);
|
|
|
|
break;
|
|
|
|
}
|
2000-04-26 04:03:38 -04:00
|
|
|
}
|
2001-03-12 05:33:13 -05:00
|
|
|
if (tmp == NULL)
|
|
|
|
activity_list = g_list_append(activity_list, window);
|
2000-04-26 04:03:38 -04:00
|
|
|
|
2001-10-20 15:52:07 -04:00
|
|
|
statusbar_items_redraw("act");
|
2000-04-26 04:03:38 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void sig_statusbar_activity_window_destroyed(WINDOW_REC *window)
|
|
|
|
{
|
2000-09-26 20:08:03 -04:00
|
|
|
g_return_if_fail(window != NULL);
|
2000-04-26 04:03:38 -04:00
|
|
|
|
2000-09-26 20:08:03 -04:00
|
|
|
if (g_list_find(activity_list, window) != NULL)
|
|
|
|
activity_list = g_list_remove(activity_list, window);
|
2001-10-20 15:52:07 -04:00
|
|
|
statusbar_items_redraw("act");
|
2000-04-26 04:03:38 -04:00
|
|
|
}
|
|
|
|
|
2000-09-26 20:11:06 -04:00
|
|
|
static void sig_statusbar_activity_updated(void)
|
|
|
|
{
|
2001-10-20 15:52:07 -04:00
|
|
|
statusbar_items_redraw("act");
|
2000-09-26 20:11:06 -04:00
|
|
|
}
|
|
|
|
|
2001-10-13 12:11:13 -04:00
|
|
|
static void item_more(SBAR_ITEM_REC *item, int get_size_only)
|
2000-04-26 04:03:38 -04:00
|
|
|
{
|
2001-11-25 11:35:11 -05:00
|
|
|
MAIN_WINDOW_REC *mainwin;
|
|
|
|
int visible;
|
|
|
|
|
2001-11-29 18:50:47 -05:00
|
|
|
if (active_win == NULL) {
|
|
|
|
mainwin = NULL;
|
|
|
|
visible = FALSE;
|
|
|
|
} else {
|
|
|
|
mainwin = WINDOW_MAIN(active_win);
|
|
|
|
visible = WINDOW_GUI(active_win)->view->more_text;
|
|
|
|
}
|
|
|
|
|
2001-11-25 11:35:11 -05:00
|
|
|
if (!visible) {
|
2001-11-29 18:50:47 -05:00
|
|
|
if (mainwin != NULL)
|
|
|
|
more_visible = g_slist_remove(more_visible, mainwin);
|
2001-11-18 17:17:31 -05:00
|
|
|
if (get_size_only)
|
|
|
|
item->min_size = item->max_size = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-11-25 11:35:11 -05:00
|
|
|
more_visible = g_slist_prepend(more_visible, mainwin);
|
2001-11-18 17:17:31 -05:00
|
|
|
statusbar_item_default_handler(item, get_size_only, NULL, "", FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void sig_statusbar_more_updated(void)
|
|
|
|
{
|
2001-11-25 11:35:11 -05:00
|
|
|
int visible;
|
|
|
|
|
|
|
|
visible = g_slist_find(more_visible, WINDOW_MAIN(active_win)) != NULL;
|
|
|
|
if (WINDOW_GUI(active_win)->view->more_text != visible)
|
2001-11-18 17:17:31 -05:00
|
|
|
statusbar_items_redraw("more");
|
2000-04-26 04:03:38 -04:00
|
|
|
}
|
|
|
|
|
2001-11-19 17:21:57 -05:00
|
|
|
/* Returns the lag in milliseconds. If we haven't been able to ask the lag
|
|
|
|
for a while, unknown is set to TRUE. */
|
|
|
|
static int get_lag(SERVER_REC *server, int *unknown)
|
|
|
|
{
|
|
|
|
long lag;
|
|
|
|
|
|
|
|
*unknown = FALSE;
|
|
|
|
|
|
|
|
if (server == NULL || server->lag_last_check == 0) {
|
|
|
|
/* lag has not been asked even once yet */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (server->lag_sent.tv_sec == 0) {
|
|
|
|
/* no lag queries going on currently */
|
|
|
|
return server->lag;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* we're not sure about our current lag.. */
|
|
|
|
*unknown = TRUE;
|
|
|
|
|
|
|
|
lag = (long) (time(NULL)-server->lag_sent.tv_sec);
|
|
|
|
if (server->lag/1000 > lag) {
|
|
|
|
/* we've been waiting the lag reply less time than
|
|
|
|
what last known lag was -> use the last known lag */
|
|
|
|
return server->lag;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* return how long we have been waiting for lag reply */
|
|
|
|
return lag*1000;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void item_lag(SBAR_ITEM_REC *item, int get_size_only)
|
|
|
|
{
|
|
|
|
SERVER_REC *server;
|
|
|
|
char str[MAX_INT_STRLEN+10];
|
|
|
|
int lag, lag_unknown;
|
|
|
|
|
|
|
|
server = active_win == NULL ? NULL : active_win->active_server;
|
|
|
|
lag = get_lag(server, &lag_unknown)/10;
|
|
|
|
|
|
|
|
if (lag <= 0 || lag < settings_get_int("lag_min_show")) {
|
|
|
|
/* don't print the lag item */
|
|
|
|
if (get_size_only)
|
|
|
|
item->min_size = item->max_size = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
last_lag = lag;
|
|
|
|
last_lag_unknown = lag_unknown;
|
|
|
|
|
|
|
|
if (lag_unknown) {
|
2001-12-01 10:22:52 -05:00
|
|
|
g_snprintf(str, sizeof(str), "%d (?""?)", lag/100);
|
2001-11-19 17:21:57 -05:00
|
|
|
} else {
|
2001-12-01 10:22:52 -05:00
|
|
|
g_snprintf(str, sizeof(str),
|
|
|
|
lag%100 == 0 ? "%d" : "%d.%02d", lag/100, lag%100);
|
2001-11-19 17:21:57 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
statusbar_item_default_handler(item, get_size_only,
|
|
|
|
NULL, str, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void lag_check_update(void)
|
|
|
|
{
|
|
|
|
SERVER_REC *server;
|
|
|
|
int lag, lag_unknown;
|
|
|
|
|
|
|
|
server = active_win == NULL ? NULL : active_win->active_server;
|
|
|
|
lag = get_lag(server, &lag_unknown)/10;
|
|
|
|
|
|
|
|
if (lag < settings_get_int("lag_min_show"))
|
|
|
|
lag = 0;
|
|
|
|
|
|
|
|
if (lag != last_lag || (lag > 0 && lag_unknown != last_lag_unknown))
|
|
|
|
statusbar_items_redraw("lag");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void sig_server_lag_updated(SERVER_REC *server)
|
|
|
|
{
|
|
|
|
if (active_win != NULL && active_win->active_server == server)
|
|
|
|
lag_check_update();
|
|
|
|
}
|
|
|
|
|
|
|
|
static int sig_lag_timeout(void)
|
|
|
|
{
|
|
|
|
lag_check_update();
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2001-10-13 12:11:13 -04:00
|
|
|
static void item_input(SBAR_ITEM_REC *item, int get_size_only)
|
2000-04-26 04:03:38 -04:00
|
|
|
{
|
2001-10-13 12:11:13 -04:00
|
|
|
GUI_ENTRY_REC *rec;
|
2000-04-26 04:03:38 -04:00
|
|
|
|
2002-02-15 04:31:25 -05:00
|
|
|
rec = g_hash_table_lookup(input_entries, item->bar);
|
2001-10-13 12:11:13 -04:00
|
|
|
if (rec == NULL) {
|
|
|
|
rec = gui_entry_create(item->xpos, item->bar->real_ypos,
|
2002-02-15 08:38:24 -05:00
|
|
|
item->size, term_type == TERM_TYPE_UTF8);
|
2001-10-24 09:47:13 -04:00
|
|
|
gui_entry_set_active(rec);
|
2002-02-15 04:31:25 -05:00
|
|
|
g_hash_table_insert(input_entries, item->bar, rec);
|
2000-04-26 04:03:38 -04:00
|
|
|
}
|
2001-10-28 13:40:12 -05:00
|
|
|
|
|
|
|
if (get_size_only) {
|
|
|
|
item->min_size = 2+term_width/10;
|
|
|
|
item->max_size = term_width;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
gui_entry_move(rec, item->xpos, item->bar->real_ypos,
|
|
|
|
item->size);
|
|
|
|
gui_entry_redraw(rec); /* FIXME: this is only necessary with ^L.. */
|
2000-05-04 06:32:42 -04:00
|
|
|
}
|
|
|
|
|
2002-02-15 04:31:25 -05:00
|
|
|
static void sig_statusbar_destroyed(STATUSBAR_REC *bar)
|
2000-05-04 06:32:42 -04:00
|
|
|
{
|
2001-10-20 15:52:07 -04:00
|
|
|
GUI_ENTRY_REC *rec;
|
|
|
|
|
2002-02-15 04:31:25 -05:00
|
|
|
rec = g_hash_table_lookup(input_entries, bar);
|
2001-10-20 15:52:07 -04:00
|
|
|
if (rec != NULL) {
|
|
|
|
gui_entry_destroy(rec);
|
2002-02-15 04:31:25 -05:00
|
|
|
g_hash_table_remove(input_entries, bar);
|
2000-05-04 06:32:42 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-01-28 22:13:06 -05:00
|
|
|
static void read_settings(void)
|
|
|
|
{
|
2002-02-15 08:38:24 -05:00
|
|
|
if (active_entry != NULL)
|
|
|
|
gui_entry_set_utf8(active_entry, term_type == TERM_TYPE_UTF8);
|
2002-01-28 22:13:06 -05:00
|
|
|
}
|
|
|
|
|
2000-05-04 06:32:42 -04:00
|
|
|
void statusbar_items_init(void)
|
2000-04-26 04:03:38 -04:00
|
|
|
{
|
|
|
|
settings_add_int("misc", "lag_min_show", 100);
|
2000-05-04 06:32:42 -04:00
|
|
|
settings_add_bool("lookandfeel", "actlist_moves", FALSE);
|
2001-10-13 12:11:13 -04:00
|
|
|
|
|
|
|
statusbar_item_register("window", NULL, item_window_active);
|
|
|
|
statusbar_item_register("window_empty", NULL, item_window_empty);
|
|
|
|
statusbar_item_register("prompt", NULL, item_window_active);
|
|
|
|
statusbar_item_register("prompt_empty", NULL, item_window_empty);
|
|
|
|
statusbar_item_register("lag", NULL, item_lag);
|
|
|
|
statusbar_item_register("act", NULL, item_act);
|
|
|
|
statusbar_item_register("more", NULL, item_more);
|
|
|
|
statusbar_item_register("input", NULL, item_input);
|
|
|
|
|
2001-11-19 17:21:57 -05:00
|
|
|
/* activity */
|
2000-04-26 04:03:38 -04:00
|
|
|
activity_list = NULL;
|
|
|
|
signal_add("window activity", (SIGNAL_FUNC) sig_statusbar_activity_hilight);
|
|
|
|
signal_add("window destroyed", (SIGNAL_FUNC) sig_statusbar_activity_window_destroyed);
|
2000-09-26 20:11:06 -04:00
|
|
|
signal_add("window refnum changed", (SIGNAL_FUNC) sig_statusbar_activity_updated);
|
2000-04-26 04:03:38 -04:00
|
|
|
|
2001-11-19 17:21:57 -05:00
|
|
|
/* more */
|
2001-11-25 11:35:11 -05:00
|
|
|
more_visible = NULL;
|
2001-11-18 17:17:31 -05:00
|
|
|
signal_add("gui page scrolled", (SIGNAL_FUNC) sig_statusbar_more_updated);
|
|
|
|
signal_add("window changed", (SIGNAL_FUNC) sig_statusbar_more_updated);
|
|
|
|
signal_add_last("gui print text finished", (SIGNAL_FUNC) sig_statusbar_more_updated);
|
|
|
|
signal_add_last("command clear", (SIGNAL_FUNC) sig_statusbar_more_updated);
|
|
|
|
signal_add_last("command scrollback", (SIGNAL_FUNC) sig_statusbar_more_updated);
|
|
|
|
|
2001-11-19 17:21:57 -05:00
|
|
|
/* lag */
|
|
|
|
last_lag = 0; last_lag_unknown = FALSE;
|
|
|
|
signal_add("server lag", (SIGNAL_FUNC) sig_server_lag_updated);
|
|
|
|
signal_add("window changed", (SIGNAL_FUNC) lag_check_update);
|
|
|
|
signal_add("window server changed", (SIGNAL_FUNC) lag_check_update);
|
|
|
|
lag_timeout_tag = g_timeout_add(5000, (GSourceFunc) sig_lag_timeout, NULL);
|
|
|
|
|
|
|
|
/* input */
|
|
|
|
input_entries = g_hash_table_new((GHashFunc) g_direct_hash,
|
|
|
|
(GCompareFunc) g_direct_equal);
|
2002-02-15 04:31:25 -05:00
|
|
|
signal_add("statusbar destroyed", (SIGNAL_FUNC) sig_statusbar_destroyed);
|
2002-01-28 22:13:06 -05:00
|
|
|
|
|
|
|
read_settings();
|
|
|
|
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
|
2000-04-26 04:03:38 -04:00
|
|
|
}
|
|
|
|
|
2000-05-04 06:32:42 -04:00
|
|
|
void statusbar_items_deinit(void)
|
2000-04-26 04:03:38 -04:00
|
|
|
{
|
2001-11-19 17:21:57 -05:00
|
|
|
/* activity */
|
2000-04-26 04:03:38 -04:00
|
|
|
signal_remove("window activity", (SIGNAL_FUNC) sig_statusbar_activity_hilight);
|
|
|
|
signal_remove("window destroyed", (SIGNAL_FUNC) sig_statusbar_activity_window_destroyed);
|
2000-09-26 20:11:06 -04:00
|
|
|
signal_remove("window refnum changed", (SIGNAL_FUNC) sig_statusbar_activity_updated);
|
2001-11-19 17:21:57 -05:00
|
|
|
g_list_free(activity_list);
|
|
|
|
activity_list = NULL;
|
2000-04-26 04:03:38 -04:00
|
|
|
|
2001-11-19 17:21:57 -05:00
|
|
|
/* more */
|
2001-11-25 11:35:11 -05:00
|
|
|
g_slist_free(more_visible);
|
2001-11-18 17:17:31 -05:00
|
|
|
signal_remove("gui page scrolled", (SIGNAL_FUNC) sig_statusbar_more_updated);
|
|
|
|
signal_remove("window changed", (SIGNAL_FUNC) sig_statusbar_more_updated);
|
|
|
|
signal_remove("gui print text finished", (SIGNAL_FUNC) sig_statusbar_more_updated);
|
|
|
|
signal_remove("command clear", (SIGNAL_FUNC) sig_statusbar_more_updated);
|
|
|
|
signal_remove("command scrollback", (SIGNAL_FUNC) sig_statusbar_more_updated);
|
|
|
|
|
2001-11-19 17:21:57 -05:00
|
|
|
/* lag */
|
|
|
|
signal_remove("server lag", (SIGNAL_FUNC) sig_server_lag_updated);
|
|
|
|
signal_remove("window changed", (SIGNAL_FUNC) lag_check_update);
|
|
|
|
signal_remove("window server changed", (SIGNAL_FUNC) lag_check_update);
|
|
|
|
g_source_remove(lag_timeout_tag);
|
2000-05-04 06:32:42 -04:00
|
|
|
|
2001-11-19 17:21:57 -05:00
|
|
|
/* input */
|
2002-02-15 04:31:25 -05:00
|
|
|
signal_remove("statusbar destroyed", (SIGNAL_FUNC) sig_statusbar_destroyed);
|
2001-11-19 17:21:57 -05:00
|
|
|
g_hash_table_destroy(input_entries);
|
2002-01-28 22:13:06 -05:00
|
|
|
|
|
|
|
signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
|
2000-04-26 04:03:38 -04:00
|
|
|
}
|