summaryrefslogtreecommitdiff
path: root/src/fe-common/core/window-items.c
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2000-05-15 08:25:45 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2000-05-15 08:25:45 +0000
commitcbdaf7d06d021a1072363f1a80ff73c7423c7bd8 (patch)
tree067c27c2823ed2825e7fb432b35318659e63e806 /src/fe-common/core/window-items.c
parent969cfe8abcdff1047696c22e13c79c1f4c239137 (diff)
downloadirssi-cbdaf7d06d021a1072363f1a80ff73c7423c7bd8.zip
Lots of changes again. Biggest ones:
- window's text buffer should work better - themes are almost working, you can change the text formats with /format - automatically try to rejoin the channel after 5 minutes if the join there failed because it was "temporarily unavailable" (netsplits) - generally cleaning code.. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@216 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-common/core/window-items.c')
-rw-r--r--src/fe-common/core/window-items.c69
1 files changed, 61 insertions, 8 deletions
diff --git a/src/fe-common/core/window-items.c b/src/fe-common/core/window-items.c
index ac4c30d5..b8633461 100644
--- a/src/fe-common/core/window-items.c
+++ b/src/fe-common/core/window-items.c
@@ -27,7 +27,6 @@
#include "levels.h"
-#include "printtext.h"
#include "windows.h"
#include "window-items.h"
@@ -86,6 +85,19 @@ WINDOW_REC *window_item_window(WI_ITEM_REC *item)
return MODULE_DATA(item);
}
+void window_item_change_server(WI_ITEM_REC *item, void *server)
+{
+ WINDOW_REC *window;
+
+ g_return_if_fail(item != NULL);
+
+ window = MODULE_DATA(item);
+ item->server = server;
+
+ signal_emit("window item server changed", 2, window, item);
+ if (window->active == item) window_change_server(window, item->server);
+}
+
void window_item_set_active(WINDOW_REC *window, WI_ITEM_REC *item)
{
g_return_if_fail(window != NULL);
@@ -97,17 +109,58 @@ void window_item_set_active(WINDOW_REC *window, WI_ITEM_REC *item)
}
}
-void window_item_change_server(WI_ITEM_REC *item, void *server)
+void window_item_prev(WINDOW_REC *window)
{
- WINDOW_REC *window;
+ WI_ITEM_REC *last;
+ GSList *tmp;
- g_return_if_fail(item != NULL);
+ g_return_if_fail(window != NULL);
- window = MODULE_DATA(item);
- item->server = server;
+ last = NULL;
+ for (tmp = window->items; tmp != NULL; tmp = tmp->next) {
+ WI_ITEM_REC *rec = tmp->data;
- signal_emit("window item server changed", 2, window, item);
- if (window->active == item) window_change_server(window, item->server);
+ if (rec != window->active)
+ last = rec;
+ else {
+ /* current channel. did we find anything?
+ if not, go to the last channel */
+ if (last != NULL) break;
+ }
+ }
+
+ if (last != NULL)
+ window_item_set_active(window, last);
+}
+
+void window_item_next(WINDOW_REC *window)
+{
+ WI_ITEM_REC *next;
+ GSList *tmp;
+ int gone;
+
+ g_return_if_fail(window != NULL);
+
+ next = NULL; gone = FALSE;
+ for (tmp = window->items; tmp != NULL; tmp = tmp->next) {
+ WI_ITEM_REC *rec = tmp->data;
+
+ if (rec == window->active)
+ gone = TRUE;
+ else {
+ if (gone) {
+ /* found the next channel */
+ next = rec;
+ break;
+ }
+
+ if (next == NULL)
+ next = rec; /* fallback to first channel */
+ }
+ }
+
+ if (next != NULL)
+ window_item_set_active(window, next);
}
static WI_ITEM_REC *window_item_find_window(WINDOW_REC *window, void *server, const char *name)