From ff3943fb6d59f541d06a4fed1910eaffc8ae85ec Mon Sep 17 00:00:00 2001 From: Andreas Fink Date: Sun, 27 Sep 2009 19:52:25 +0000 Subject: [PATCH] *add* option for ascending/descending/unsorted systray --- src/config.c | 4 +++- src/systray/systraybar.c | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/config.c b/src/config.c index 2bfb34a..10cf448 100644 --- a/src/config.c +++ b/src/config.c @@ -575,8 +575,10 @@ void add_entry (char *key, char *value) else if (strcmp(key, "systray_sort") == 0) { if (strcmp(value, "desc") == 0) systray.sort = -1; - else + else if (strcmp(value, "asc") == 0) systray.sort = 1; + else + systray.sort = 0; } /* Tooltip */ diff --git a/src/systray/systraybar.c b/src/systray/systraybar.c index 9f9c05d..130372e 100644 --- a/src/systray/systraybar.c +++ b/src/systray/systraybar.c @@ -319,8 +319,10 @@ gboolean add_icon(Window id) traywin = g_new0(TrayWindow, 1); traywin->id = id; - // systray.list_icons = g_slist_prepend(systray.list_icons, traywin); - systray.list_icons = g_slist_insert_sorted(systray.list_icons, traywin, compare_traywindows); + if (systray.sort == 0) + systray.list_icons = g_slist_prepend(systray.list_icons, traywin); + else + systray.list_icons = g_slist_insert_sorted(systray.list_icons, traywin, compare_traywindows); systray.area.resize = 1; systray.area.redraw = 1; //printf("add_icon id %lx, %d\n", id, g_slist_length(systray.list_icons)); -- 2.44.0