[gnome-builder] glade: handle non-widget toplevels



commit 4ca9e67daf4d9302b76d8031da898878e26eecec
Author: Christian Hergert <chergert redhat com>
Date:   Wed Mar 13 17:50:02 2019 -0700

    glade: handle non-widget toplevels

 src/plugins/glade/gbp-glade-page-actions.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/src/plugins/glade/gbp-glade-page-actions.c b/src/plugins/glade/gbp-glade-page-actions.c
index f82d6d828..c41adef39 100644
--- a/src/plugins/glade/gbp-glade-page-actions.c
+++ b/src/plugins/glade/gbp-glade-page-actions.c
@@ -60,16 +60,22 @@ gbp_glade_page_action_preview (GSimpleAction *action,
   /* Just preview the first toplevel. To preview others, they need to
    * right-click to get the context menu.
    */
-  if (toplevels != NULL)
+  for (const GList *iter = toplevels; iter != NULL; iter = iter->next)
     {
-      GtkWidget *widget = toplevels->data;
-      GladeWidget *glade;
+      if (GTK_IS_WIDGET (iter->data))
+        {
+          GtkWidget *widget = iter->data;
+          GladeWidget *glade;
 
-      g_assert (GTK_IS_WIDGET (widget));
-      glade = glade_widget_get_from_gobject (widget);
-      g_assert (GLADE_IS_WIDGET (glade));
+          g_assert (GTK_IS_WIDGET (widget));
 
-      glade_project_preview (project, glade);
+          glade = glade_widget_get_from_gobject (widget);
+          g_assert (GLADE_IS_WIDGET (glade));
+
+          glade_project_preview (project, glade);
+
+          break;
+        }
     }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]