[gnome-builder] editor: propagate needs-attention for sidebar



commit 6e839322b23d19e6b75e665080fbb6036cdeafa6
Author: Christian Hergert <chergert redhat com>
Date:   Mon May 6 13:29:15 2019 -0700

    editor: propagate needs-attention for sidebar

 src/libide/editor/ide-editor-sidebar.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)
---
diff --git a/src/libide/editor/ide-editor-sidebar.c b/src/libide/editor/ide-editor-sidebar.c
index 13c746f2a..6c8a68198 100644
--- a/src/libide/editor/ide-editor-sidebar.c
+++ b/src/libide/editor/ide-editor-sidebar.c
@@ -110,7 +110,12 @@ ide_editor_sidebar_stack_notify_visible_child (IdeEditorSidebar *self,
   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));
+    {
+      gtk_container_child_set (GTK_CONTAINER (stack), visible_child,
+                               "needs-attention", FALSE,
+                               NULL);
+      dzl_dock_item_emit_presented (DZL_DOCK_ITEM (visible_child));
+    }
 }
 
 static void
@@ -285,6 +290,18 @@ find_position (IdeEditorSidebar *self,
   return position;
 }
 
+static void
+propagate_needs_attention_cb (DzlDockItem *item,
+                              GtkStack    *stack)
+{
+  g_assert (DZL_IS_DOCK_ITEM (item));
+  g_assert (GTK_IS_STACK (stack));
+
+  gtk_container_child_set (GTK_CONTAINER (stack), GTK_WIDGET (item),
+                           "needs-attention", TRUE,
+                           NULL);
+}
+
 /**
  * ide_editor_sidebar_add_section:
  * @self: a #IdeEditorSidebar
@@ -344,6 +361,13 @@ ide_editor_sidebar_add_section (IdeEditorSidebar *self,
                                      "title", title,
                                      NULL);
 
+  if (DZL_IS_DOCK_ITEM (section))
+    g_signal_connect_object (section,
+                             "needs-attention",
+                             G_CALLBACK (propagate_needs_attention_cb),
+                             self->stack,
+                             0);
+
   gtk_container_foreach (GTK_CONTAINER (self->stack_switcher),
                          fixup_stack_switcher_button,
                          NULL);


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