[libdazzle] suggestions: Track popup request state for async model changes
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libdazzle] suggestions: Track popup request state for async model changes
- Date: Wed, 1 Aug 2018 20:00:28 +0000 (UTC)
commit a742e2ee78909562c9808434c52550a37a1ff7ef
Author: Jan-Michael Brummer <jan brummer tabos org>
Date: Wed Aug 1 10:43:00 2018 +0200
suggestions: Track popup request state for async model changes
Fixes: https://gitlab.gnome.org/GNOME/libdazzle/issues/21
src/suggestions/dzl-suggestion-popover.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
---
diff --git a/src/suggestions/dzl-suggestion-popover.c b/src/suggestions/dzl-suggestion-popover.c
index 84e93e8..7dafa21 100644
--- a/src/suggestions/dzl-suggestion-popover.c
+++ b/src/suggestions/dzl-suggestion-popover.c
@@ -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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]