Statusbar: Remove matching messages before popping

gtk_statusbar_remove_all() was popping the top message if its
context_id matched before removing other matching messages from the
stack. This meant that if the context_id of the second top message
matched it was still displayed when the top message was popped and
then removed from the list of messages without updating the display.
Fix this by removing all the matching messages below the top one
before popping it if it matches.

https://bugzilla.gnome.org/show_bug.cgi?id=724281
This commit is contained in:
Phillip Wood 2014-02-12 15:56:11 +00:00 committed by Benjamin Otte
parent 2120ccfd5e
commit e853007cd0

View File

@ -456,21 +456,13 @@ gtk_statusbar_remove_all (GtkStatusbar *statusbar,
if (priv->messages == NULL)
return;
msg = priv->messages->data;
/* care about signal emission if the topmost item is removed */
if (msg->context_id == context_id)
{
gtk_statusbar_pop (statusbar, context_id);
prev = NULL;
list = priv->messages;
}
else
{
prev = priv->messages;
list = prev->next;
}
/* We special-case the topmost message at the bottom of this
* function:
* If we need to pop it, we have to update various state and we want
* an up-to-date list of remaining messages in that case.
*/
prev = priv->messages;
list = prev->next;
while (list != NULL)
{
@ -478,21 +470,12 @@ gtk_statusbar_remove_all (GtkStatusbar *statusbar,
if (msg->context_id == context_id)
{
if (prev == NULL)
priv->messages = list->next;
else
prev->next = list->next;
prev->next = list->next;
gtk_statusbar_msg_free (msg);
g_slist_free_1 (list);
if (prev == NULL)
prev = priv->messages;
if (prev)
list = prev->next;
else
list = NULL;
list = prev->next;
}
else
{
@ -500,6 +483,13 @@ gtk_statusbar_remove_all (GtkStatusbar *statusbar,
list = prev->next;
}
}
/* Treat topmost message here */
msg = priv->messages->data;
if (msg->context_id == context_id)
{
gtk_statusbar_pop (statusbar, context_id);
}
}
/**