mirror of
https://github.com/weechat/weechat.git
synced 2026-07-01 23:36:37 +02:00
core: send signal "hotlist_changed" only if the order of hotlist has changed after sort (issue #2097)
This commit is contained in:
@@ -546,20 +546,25 @@ void
|
||||
gui_hotlist_resort ()
|
||||
{
|
||||
struct t_gui_hotlist *new_hotlist, *last_new_hotlist;
|
||||
struct t_gui_hotlist *ptr_hotlist, *ptr_next_hotlist;
|
||||
struct t_gui_hotlist *ptr_hotlist, *ptr_next_hotlist, *ptr_prev_hotlist;
|
||||
int hotlist_changed;
|
||||
|
||||
/* sort is not needed if hotlist has less than 2 entries */
|
||||
if (!gui_hotlist || !gui_hotlist->next_hotlist)
|
||||
return;
|
||||
|
||||
/* resort hotlist in new linked list */
|
||||
hotlist_changed = 0;
|
||||
new_hotlist = NULL;
|
||||
last_new_hotlist = NULL;
|
||||
ptr_hotlist = gui_hotlist;
|
||||
while (ptr_hotlist)
|
||||
{
|
||||
ptr_next_hotlist = ptr_hotlist->next_hotlist;
|
||||
ptr_prev_hotlist = ptr_hotlist->prev_hotlist;
|
||||
gui_hotlist_add_hotlist (&new_hotlist, &last_new_hotlist, ptr_hotlist);
|
||||
if (ptr_hotlist->prev_hotlist != ptr_prev_hotlist)
|
||||
hotlist_changed = 1;
|
||||
ptr_hotlist = ptr_next_hotlist;
|
||||
}
|
||||
|
||||
@@ -567,7 +572,8 @@ gui_hotlist_resort ()
|
||||
gui_hotlist = new_hotlist;
|
||||
last_gui_hotlist = last_new_hotlist;
|
||||
|
||||
gui_hotlist_changed_signal (NULL);
|
||||
if (hotlist_changed)
|
||||
gui_hotlist_changed_signal (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user