Commit a742e2ee authored by Jan-Michael Brummer's avatar Jan-Michael Brummer
Browse files

suggestions: Track popup request state for async model changes

Fixes: GNOME/libdazzle#21
parent 9565629d
......@@ -56,6 +56,8 @@ struct _DzlSuggestionPopover
gulong items_changed_handler;
gulong destroy_handler;
gboolean popup_requested;
PangoEllipsizeMode subtitle_ellipsize;
PangoEllipsizeMode title_ellipsize;
};
......@@ -695,8 +697,11 @@ dzl_suggestion_popover_popup (DzlSuggestionPopover *self)
g_assert (DZL_IS_SUGGESTION_POPOVER (self));
if (self->model == NULL || 0 == (n_items = g_list_model_get_n_items (self->model)))
if (self->model == NULL || 0 == (n_items = g_list_model_get_n_items (self->model))) {
self->popup_requested = TRUE;
return;
}
if (self->relative_to != NULL)
{
......@@ -734,6 +739,8 @@ dzl_suggestion_popover_popdown (DzlSuggestionPopover *self)
g_assert (DZL_IS_SUGGESTION_POPOVER (self));
self->popup_requested = FALSE;
if (!gtk_widget_get_realized (GTK_WIDGET (self)))
return;
......@@ -765,6 +772,13 @@ dzl_suggestion_popover_items_changed (DzlSuggestionPopover *self,
return;
}
if (self->popup_requested)
{
dzl_suggestion_popover_popup (self);
self->popup_requested = FALSE;
return;
}
/*
* If we are currently animating in the initial view of the popover,
* then we might need to cancel that animation and rely on the elastic
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment