mirror of
https://github.com/irssi/irssi.git
synced 2025-02-02 15:08:01 -05:00
Cleanup and optimize a bit sig_statusbar_activity_hilight.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4531 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
326084e883
commit
b05e103ad9
@ -153,26 +153,27 @@ static void item_act(SBAR_ITEM_REC *item, int get_size_only)
|
|||||||
|
|
||||||
static void sig_statusbar_activity_hilight(WINDOW_REC *window, gpointer oldlevel)
|
static void sig_statusbar_activity_hilight(WINDOW_REC *window, gpointer oldlevel)
|
||||||
{
|
{
|
||||||
GList *tmp;
|
GList *node;
|
||||||
int inspos;
|
|
||||||
|
|
||||||
g_return_if_fail(window != NULL);
|
g_return_if_fail(window != NULL);
|
||||||
|
|
||||||
|
node = g_list_find(activity_list, window);
|
||||||
|
|
||||||
if (settings_get_bool("actlist_moves")) {
|
if (settings_get_bool("actlist_moves")) {
|
||||||
/* Move the window to the first in the activity list */
|
/* Move the window to the first in the activity list */
|
||||||
if (g_list_find(activity_list, window) != NULL)
|
if (node != NULL)
|
||||||
activity_list = g_list_remove(activity_list, window);
|
activity_list = g_list_delete_link(activity_list, node);
|
||||||
if (window->data_level != 0)
|
if (window->data_level != 0)
|
||||||
activity_list = g_list_prepend(activity_list, window);
|
activity_list = g_list_prepend(activity_list, window);
|
||||||
statusbar_items_redraw("act");
|
statusbar_items_redraw("act");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_list_find(activity_list, window) != NULL) {
|
if (node != NULL) {
|
||||||
/* already in activity list */
|
/* already in activity list */
|
||||||
if (window->data_level == 0) {
|
if (window->data_level == 0) {
|
||||||
/* remove from activity list */
|
/* remove from activity list */
|
||||||
activity_list = g_list_remove(activity_list, window);
|
activity_list = g_list_delete_link(activity_list, node);
|
||||||
statusbar_items_redraw("act");
|
statusbar_items_redraw("act");
|
||||||
} else if (window->data_level != GPOINTER_TO_INT(oldlevel) ||
|
} else if (window->data_level != GPOINTER_TO_INT(oldlevel) ||
|
||||||
window->hilight_color != 0) {
|
window->hilight_color != 0) {
|
||||||
@ -187,18 +188,8 @@ static void sig_statusbar_activity_hilight(WINDOW_REC *window, gpointer oldlevel
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* add window to activity list .. */
|
/* add window to activity list .. */
|
||||||
inspos = 0;
|
activity_list = g_list_insert_sorted(activity_list, window, (GCompareFunc)
|
||||||
for (tmp = activity_list; tmp != NULL; tmp = tmp->next, inspos++) {
|
window_refnum_cmp);
|
||||||
WINDOW_REC *rec = tmp->data;
|
|
||||||
|
|
||||||
if (window->refnum < rec->refnum) {
|
|
||||||
activity_list =
|
|
||||||
g_list_insert(activity_list, window, inspos);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (tmp == NULL)
|
|
||||||
activity_list = g_list_append(activity_list, window);
|
|
||||||
|
|
||||||
statusbar_items_redraw("act");
|
statusbar_items_redraw("act");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user