diff options
author | Timo Sirainen <cras@irssi.org> | 2001-02-10 09:12:53 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-02-10 09:12:53 +0000 |
commit | ddf6810b0ea03e144ecdbafed3fb625d7039d832 (patch) | |
tree | 3b806ef439ed454b404916443f8517de0b5b3cff /src/fe-common/core/window-items.c | |
parent | 7c21fb84ee6b5f29e71d9704b9c7c3f2d411b17d (diff) | |
download | irssi-ddf6810b0ea03e144ecdbafed3fb625d7039d832.zip |
Changed window->waiting_channels ("servertag name" format) to
bound_items containing WINDOW_BIND_REC structures. If you now use
/SAVEWINDOWS, the item will _always_ be restored to saved window even
if there was already some other item.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1204 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-common/core/window-items.c')
-rw-r--r-- | src/fe-common/core/window-items.c | 50 |
1 files changed, 11 insertions, 39 deletions
diff --git a/src/fe-common/core/window-items.c b/src/fe-common/core/window-items.c index 77ed89dd..5c75295e 100644 --- a/src/fe-common/core/window-items.c +++ b/src/fe-common/core/window-items.c @@ -224,36 +224,14 @@ WI_ITEM_REC *window_item_find(void *server, const char *name) return NULL; } -static int waiting_channels_get(WINDOW_REC *window, const char *tag) -{ - GSList *tmp; - - g_return_val_if_fail(window != NULL, FALSE); - g_return_val_if_fail(tag != NULL, FALSE); - - for (tmp = window->waiting_channels; tmp != NULL; tmp = tmp->next) { - if (g_strcasecmp(tmp->data, tag) == 0) { - g_free(tmp->data); - window->waiting_channels = g_slist_remove(window->waiting_channels, tmp->data); - return TRUE; - } - } - - return FALSE; -} - void window_item_create(WI_ITEM_REC *item, int automatic) { WINDOW_REC *window; GSList *tmp, *sorted; - char *str; int clear_waiting, reuse_unused_windows; g_return_if_fail(item != NULL); - str = item->server == NULL ? NULL : - g_strdup_printf("%s %s", ((SERVER_REC *) item->server)->tag, item->name); - reuse_unused_windows = !settings_get_bool("autoclose_windows") || settings_get_bool("reuse_unused_windows"); @@ -267,23 +245,21 @@ void window_item_create(WI_ITEM_REC *item, int automatic) if (reuse_unused_windows && rec->items == NULL && rec->level == 0 && (window == NULL || rec == active_win || - window->waiting_channels != NULL)) { - /* no items in this window, we should probably use it.. */ + window->bound_items != NULL)) { + /* no items in this window, + we should probably use it.. */ window = rec; } - if (rec->waiting_channels != NULL && str != NULL) { - /* right name/server tag combination in - some waiting list? */ - if (waiting_channels_get(rec, str)) { - window = rec; - clear_waiting = FALSE; - break; - } + /* is item bound to this window? */ + if (item->server != NULL && + window_bind_find(rec, item->server->tag, item->name)) { + window = rec; + clear_waiting = FALSE; + break; } } g_slist_free(sorted); - g_free_not_null(str); if (window == NULL && !settings_get_bool("autocreate_windows")) { /* never create new windows automatically */ @@ -298,12 +274,8 @@ void window_item_create(WI_ITEM_REC *item, int automatic) window_item_add(window, item, automatic); } - if (clear_waiting) { - /* clear window's waiting_channels list */ - g_slist_foreach(window->waiting_channels, (GFunc) g_free, NULL), - g_slist_free(window->waiting_channels); - window->waiting_channels = NULL; - } + if (clear_waiting) + window_bind_remove_unsticky(window); } static void signal_window_item_changed(WINDOW_REC *window, WI_ITEM_REC *item) |