summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Hergert <chergert@redhat.com>2022-05-13 19:12:17 -0700
committerChristian Hergert <chergert@redhat.com>2022-06-12 10:19:53 -0700
commit70d1ec248e9b37834b5dcc34ddc942741ccd7baf (patch)
tree1b3fcf74469adfef804d208f92fcd6e1f24cedbe
parent044a855cc8d857d2237833fc7ffbb64a221b2d69 (diff)
downloadgtksourceview-70d1ec248e9b37834b5dcc34ddc942741ccd7baf.tar.gz
assistants: measure and present together
And avoid if there is no surface yet or not visible.
-rw-r--r--gtksourceview/gtksourceview-assistants.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gtksourceview/gtksourceview-assistants.c b/gtksourceview/gtksourceview-assistants.c
index 4991765e..5f7c6639 100644
--- a/gtksourceview/gtksourceview-assistants.c
+++ b/gtksourceview/gtksourceview-assistants.c
@@ -103,7 +103,14 @@ _gtk_source_view_assistants_size_allocate (GtkSourceViewAssistants *assistants,
g_assert (GTK_SOURCE_IS_ASSISTANT (assistant));
- gtk_popover_present (GTK_POPOVER (assistant));
+ if (gtk_widget_get_visible (GTK_WIDGET (assistant)) &&
+ gtk_native_get_surface (GTK_NATIVE (assistant)) != NULL)
+ {
+ GtkRequisition req;
+
+ gtk_widget_get_preferred_size (GTK_WIDGET (assistant), NULL, &req);
+ gtk_popover_present (GTK_POPOVER (assistant));
+ }
}
}