1
0
mirror of https://github.com/irssi/irssi.git synced 2024-10-27 05:20:20 -04:00

Change 'actlist_moves' boolean to 'actlist_sort' string which specifies the

sorting type to use for the activity bar:
- refnum (default)
- recent (same as actlist_moves on)
- level (sort by window level, same ordering used by active_window command)


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@4583 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Emanuele Giaquinta 2007-07-26 13:53:22 +00:00 committed by exg
parent 4e5fa17f50
commit e55d0a862c
2 changed files with 46 additions and 2 deletions

View File

@ -473,6 +473,12 @@ static int backwards_compatibility(const char *module, CONFIG_NODE *node,
g_free(new_value);
config_changed = TRUE;
return new_key != NULL;
} else if (strcasecmp(node->key, "actlist_moves") == 0 &&
node->value != NULL && strcasecmp(node->value, "yes") == 0) {
config_node_set_str(mainconfig, parent, "actlist_sort", "recent");
config_node_set_str(mainconfig, parent, node->key, NULL);
config_changed = TRUE;
return TRUE;
}
}
new_value = NULL, new_key = NULL;

View File

@ -32,6 +32,7 @@
#define LAG_REFRESH_TIME 10
static GList *activity_list;
static guint8 actlist_sort;
static GSList *more_visible; /* list of MAIN_WINDOW_RECs which have --more-- */
static GHashTable *input_entries;
static int last_lag, last_lag_unknown, lag_timeout_tag;
@ -151,6 +152,15 @@ static void item_act(SBAR_ITEM_REC *item, int get_size_only)
g_free_not_null(actlist);
}
static int window_level_cmp(WINDOW_REC *w1, WINDOW_REC *w2)
{
if (w1->data_level > w2->data_level ||
(w1->data_level == w2->data_level && w1->refnum < w2->refnum))
return -1;
else
return 1;
}
static void sig_statusbar_activity_hilight(WINDOW_REC *window, gpointer oldlevel)
{
GList *node;
@ -159,7 +169,7 @@ static void sig_statusbar_activity_hilight(WINDOW_REC *window, gpointer oldlevel
node = g_list_find(activity_list, window);
if (settings_get_bool("actlist_moves")) {
if (actlist_sort == 1) {
/* Move the window to the first in the activity list */
if (node != NULL)
activity_list = g_list_delete_link(activity_list, node);
@ -169,6 +179,22 @@ static void sig_statusbar_activity_hilight(WINDOW_REC *window, gpointer oldlevel
return;
}
if (actlist_sort == 2) {
if (node != NULL) {
if (window->data_level == GPOINTER_TO_INT(oldlevel)) {
if (window->hilight_color != 0)
statusbar_items_redraw("act");
return;
}
activity_list = g_list_delete_link(activity_list, node);
}
if (window->data_level != 0)
activity_list = g_list_insert_sorted(activity_list, window, (GCompareFunc)
window_level_cmp);
statusbar_items_redraw("act");
return;
}
if (node != NULL) {
/* already in activity list */
if (window->data_level == 0) {
@ -360,14 +386,26 @@ static void item_input(SBAR_ITEM_REC *item, int get_size_only)
static void read_settings(void)
{
const char *str;
if (active_entry != NULL)
gui_entry_set_utf8(active_entry, term_type == TERM_TYPE_UTF8);
str = settings_get_str("actlist_sort");
if (strcasecmp(str, "recent") == 0)
actlist_sort = 1;
else if (strcasecmp(str, "level") == 0)
actlist_sort = 2;
else {
settings_set_str("actlist_sort", "refnum");
actlist_sort = 0;
}
}
void statusbar_items_init(void)
{
settings_add_time("misc", "lag_min_show", "1sec");
settings_add_bool("lookandfeel", "actlist_moves", FALSE);
settings_add_str("lookandfeel", "actlist_sort", "refnum");
statusbar_item_register("window", NULL, item_window_active);
statusbar_item_register("window_empty", NULL, item_window_empty);