Mercurial > pidgin.yaz
changeset 17991:386047fb178b
Draw a separator line between the buddylist and the conversation windows.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Sat, 02 Jun 2007 06:39:02 +0000 |
parents | 8ca45d6a1281 |
children | 5e34cd288a98 |
files | finch/libgnt/wms/irssi.c |
diffstat | 1 files changed, 40 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/finch/libgnt/wms/irssi.c Sat Jun 02 05:10:05 2007 +0000 +++ b/finch/libgnt/wms/irssi.c Sat Jun 02 06:39:02 2007 +0000 @@ -35,18 +35,16 @@ static void (*org_new_window)(GntWM *wm, GntWidget *win); -static GntWidget * -find_widget(GntWM *wm, const char *wname) +/* This is changed whenever the buddylist is opened/closed or resized. */ +static int buddylistwidth; + +static gboolean +is_budddylist(GntWidget *win) { - const GList *iter = wm->list; - for (; iter; iter = iter->next) { - GntWidget *widget = iter->data; - const char *name = gnt_widget_get_name(widget); - if (name && strcmp(name, wname) == 0) { - return widget; - } - } - return NULL; + const char *name = gnt_widget_get_name(win); + if (name && strcmp(name, "buddylist") == 0) + return TRUE; + return FALSE; } static void @@ -64,8 +62,6 @@ irssi_new_window(GntWM *wm, GntWidget *win) { const char *name; - int bw; - GntWidget *blist; name = gnt_widget_get_name(win); if (!name || strcmp(name, "conversation-window")) { @@ -79,23 +75,41 @@ mvwin(win->window, y, x); } else { remove_border_set_position_size(wm, win, 0, 0, -1, getmaxy(stdscr) - 1); + gnt_widget_get_size(win, &buddylistwidth, NULL); + mvwvline(stdscr, 0, buddylistwidth, ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL), getmaxy(stdscr) - 1); + buddylistwidth++; } } org_new_window(wm, win); return; } - blist = find_widget(wm, "buddylist"); - if (blist) { - gnt_widget_get_size(blist, &bw, NULL); - bw++; - } else { - bw = 0; - } + /* The window we have here is a conversation window. */ + remove_border_set_position_size(wm, win, buddylistwidth, 0, + getmaxx(stdscr) - buddylistwidth, getmaxy(stdscr) - 1); + org_new_window(wm, win); +} + +static void +irssi_window_resized(GntWM *wm, GntNode *node) +{ + if (!is_budddylist(node->me)) + return; - /* The window we have here is a conversation window. */ - remove_border_set_position_size(wm, win, bw, 0, getmaxx(stdscr) - bw, getmaxy(stdscr) - 1); - org_new_window(wm, win); + if (buddylistwidth) + mvwvline(stdscr, 0, buddylistwidth - 1, + ' ' | COLOR_PAIR(GNT_COLOR_NORMAL), getmaxy(stdscr) - 1); + gnt_widget_get_size(node->me, &buddylistwidth, NULL); + mvwvline(stdscr, 0, buddylistwidth, ACS_VLINE | COLOR_PAIR(GNT_COLOR_NORMAL), getmaxy(stdscr) - 1); + buddylistwidth++; +} + +static gboolean +irssi_close_window(GntWM *wm, GntWidget *win) +{ + if (is_budddylist(win)) + buddylistwidth = 0; + return FALSE; } static void @@ -106,6 +120,8 @@ org_new_window = pclass->new_window; pclass->new_window = irssi_new_window; + pclass->window_resized = irssi_window_resized; + pclass->close_window = irssi_close_window; gnt_style_read_actions(G_OBJECT_CLASS_TYPE(klass), GNT_BINDABLE_CLASS(klass)); GNTDEBUG; @@ -113,6 +129,7 @@ void gntwm_init(GntWM **wm) { + buddylistwidth = 0; *wm = g_object_new(TYPE_IRSSI, NULL); }