[gnome-builder/wip/chergert/layout] layout: add panel selection helper



commit b2ef340d197d46eae9d4eece85267c724234006a
Author: Christian Hergert <chergert redhat com>
Date:   Fri Jul 14 17:53:01 2017 -0700

    layout: add panel selection helper

 libide/layout/ide-layout-transient-sidebar.c |   17 +++++++++++++++++
 libide/layout/ide-layout-transient-sidebar.h |    6 ++++--
 2 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/libide/layout/ide-layout-transient-sidebar.c b/libide/layout/ide-layout-transient-sidebar.c
index db91b4b..5fad0c5 100644
--- a/libide/layout/ide-layout-transient-sidebar.c
+++ b/libide/layout/ide-layout-transient-sidebar.c
@@ -187,3 +187,20 @@ ide_layout_transient_sidebar_set_view (IdeLayoutTransientSidebar *self,
 
   g_weak_ref_set (&priv->view_ref, view);
 }
+
+void
+ide_layout_transient_sidebar_set_panel (IdeLayoutTransientSidebar *self,
+                                        GtkWidget                 *panel)
+{
+  GtkWidget *stack;
+
+  g_return_if_fail (IDE_IS_LAYOUT_TRANSIENT_SIDEBAR (self));
+  g_return_if_fail (GTK_IS_WIDGET (panel));
+
+  stack = gtk_widget_get_parent (GTK_WIDGET (panel));
+
+  if (GTK_IS_STACK (stack))
+    gtk_stack_set_visible_child (GTK_STACK (stack), panel);
+  else
+    g_warning ("Failed to locate stack containing panel");
+}
diff --git a/libide/layout/ide-layout-transient-sidebar.h b/libide/layout/ide-layout-transient-sidebar.h
index ce01333..bab296f 100644
--- a/libide/layout/ide-layout-transient-sidebar.h
+++ b/libide/layout/ide-layout-transient-sidebar.h
@@ -43,7 +43,9 @@ struct _IdeLayoutTransientSidebarClass
   gpointer _reserved8;
 };
 
-void ide_layout_transient_sidebar_set_view (IdeLayoutTransientSidebar *self,
-                                            IdeLayoutView             *view);
+void ide_layout_transient_sidebar_set_panel (IdeLayoutTransientSidebar *self,
+                                             GtkWidget                 *panel);
+void ide_layout_transient_sidebar_set_view  (IdeLayoutTransientSidebar *self,
+                                             IdeLayoutView             *view);
 
 G_END_DECLS


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