summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEmanuele Giaquinta <exg@irssi.org>2007-07-26 13:53:22 +0000
committerexg <exg@dbcabf3a-b0e7-0310-adc4-f8d773084564>2007-07-26 13:53:22 +0000
commite55d0a862c2f55a2df76fa7c5f6272438f239833 (patch)
treee43d3aa2832de218eb004d1b9ed3f2fe3dbd3208 /src
parent4e5fa17f50d1e1942da342418ff20e4a86109aae (diff)
downloadirssi-e55d0a862c2f55a2df76fa7c5f6272438f239833.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/core/settings.c6
-rw-r--r--src/fe-text/statusbar-items.c42
2 files changed, 46 insertions, 2 deletions
diff --git a/src/core/settings.c b/src/core/settings.c
index 68e5de75..edf87953 100644
--- a/src/core/settings.c
+++ b/src/core/settings.c
@@ -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;
diff --git a/src/fe-text/statusbar-items.c b/src/fe-text/statusbar-items.c
index 01b882c5..62a7d940 100644
--- a/src/fe-text/statusbar-items.c
+++ b/src/fe-text/statusbar-items.c
@@ -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);