[gnome-builder] sidebar: emit DzlDockItem::presented



commit 475a5778a157ebbcbe5f65d4f99518d86d43cd03
Author: Christian Hergert <chergert redhat com>
Date:   Mon Jun 25 19:42:22 2018 -0700

    sidebar: emit DzlDockItem::presented
    
    This allows us to use DzlDockItem within the sidebar so that the plugin
    can be notified when it's content is being displayed. This is particularly
    useful to do delayed loading of content.
    
    This requires libdazzle from master, as I just landed support for the
    signal there.

 src/libide/editor/ide-editor-sidebar.c | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/src/libide/editor/ide-editor-sidebar.c b/src/libide/editor/ide-editor-sidebar.c
index 54815880b..11a881dca 100644
--- a/src/libide/editor/ide-editor-sidebar.c
+++ b/src/libide/editor/ide-editor-sidebar.c
@@ -93,11 +93,20 @@ ide_editor_sidebar_stack_notify_visible_child (IdeEditorSidebar *self,
                                                GParamSpec       *pspec,
                                                GtkStack         *stack)
 {
+  GtkWidget *visible_child;
+
   g_assert (IDE_IS_EDITOR_SIDEBAR (self));
   g_assert (G_IS_PARAM_SPEC_OBJECT (pspec));
   g_assert (GTK_IS_STACK (stack));
 
+  if (gtk_widget_in_destruction (GTK_WIDGET (self)) ||
+      gtk_widget_in_destruction (GTK_WIDGET (stack)))
+    return;
+
   ide_editor_sidebar_update_title (self);
+
+  if ((visible_child = gtk_stack_get_visible_child (stack)) && DZL_IS_DOCK_ITEM (visible_child))
+    dzl_dock_item_emit_presented (DZL_DOCK_ITEM (visible_child));
 }
 
 static void


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