[gnome-builder/wip/chergert/layout] editor: use proper types for right sidebar



commit 9993ecc1d6cb0e612fbd5a0883cb37d4d15c25bd
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jul 12 17:40:05 2017 -0700

    editor: use proper types for right sidebar
    
    We don't want the generic fallback for getting the edge. Instead
    we want to be more specific about our design in the API, in that
    the right edge is meant to be transient and cannot be guaranteed
    for persistent content.

 libide/editor/ide-editor-perspective.c             |   20 ++++++++++++++----
 libide/editor/ide-editor-perspective.h             |   21 ++++++++++---------
 .../color-picker/gb-color-picker-workbench-addin.c |    6 ++--
 3 files changed, 29 insertions(+), 18 deletions(-)
---
diff --git a/libide/editor/ide-editor-perspective.c b/libide/editor/ide-editor-perspective.c
index 06afbed..e11b135 100644
--- a/libide/editor/ide-editor-perspective.c
+++ b/libide/editor/ide-editor-perspective.c
@@ -443,15 +443,25 @@ ide_editor_perspective_get_sidebar (IdeEditorPerspective *self)
 }
 
 /**
- * ide_editor_perspective_get_right_edge:
+ * ide_editor_perspective_get_transient_sidebar:
+ * @self: a #IdeEditorPerspective
  *
- * Returns: (transfer none): A #GtkWidget
+ * Gets the transient sidebar for the editor perspective.
+ *
+ * The transient sidebar is a sidebar on the right side of the perspective. It
+ * is displayed only when necessary. It animates in and out of view based on
+ * focus tracking and other heuristics.
+ *
+ * Returns: (transfer none): An #IdeLayoutTransientSidebar
+ *
+ * Since: 3.26
  */
-GtkWidget *
-ide_editor_perspective_get_right_edge (IdeEditorPerspective *self)
+IdeLayoutTransientSidebar *
+ide_editor_perspective_get_transient_sidebar (IdeEditorPerspective *self)
 {
   g_return_val_if_fail (IDE_IS_EDITOR_PERSPECTIVE (self), NULL);
-  return dzl_dock_bin_get_right_edge (DZL_DOCK_BIN (self));
+
+  return IDE_LAYOUT_TRANSIENT_SIDEBAR (dzl_dock_bin_get_right_edge (DZL_DOCK_BIN (self)));
 }
 
 /**
diff --git a/libide/editor/ide-editor-perspective.h b/libide/editor/ide-editor-perspective.h
index bf63920..7783059 100644
--- a/libide/editor/ide-editor-perspective.h
+++ b/libide/editor/ide-editor-perspective.h
@@ -22,6 +22,7 @@
 #include "editor/ide-editor-sidebar.h"
 #include "layout/ide-layout.h"
 #include "layout/ide-layout-grid.h"
+#include "layout/ide-layout-transient-sidebar.h"
 
 G_BEGIN_DECLS
 
@@ -29,18 +30,18 @@ G_BEGIN_DECLS
 
 G_DECLARE_FINAL_TYPE (IdeEditorPerspective, ide_editor_perspective, IDE, EDITOR_PERSPECTIVE, IdeLayout)
 
-void              ide_editor_perspective_focus_buffer                  (IdeEditorPerspective *self,
-                                                                        IdeBuffer            *buffer);
-void              ide_editor_perspective_focus_buffer_in_current_stack (IdeEditorPerspective *self,
-                                                                        IdeBuffer            *buffer);
-void              ide_editor_perspective_focus_location                (IdeEditorPerspective *self,
-                                                                        IdeSourceLocation    *location);
-IdeLayoutView    *ide_editor_perspective_get_active_view               (IdeEditorPerspective *self);
-IdeLayoutGrid    *ide_editor_perspective_get_grid                      (IdeEditorPerspective *self);
-IdeEditorSidebar *ide_editor_perspective_get_sidebar                   (IdeEditorPerspective *self);
+void                       ide_editor_perspective_focus_buffer                  (IdeEditorPerspective *self,
+                                                                                 IdeBuffer            
*buffer);
+void                       ide_editor_perspective_focus_buffer_in_current_stack (IdeEditorPerspective *self,
+                                                                                 IdeBuffer            
*buffer);
+void                       ide_editor_perspective_focus_location                (IdeEditorPerspective *self,
+                                                                                 IdeSourceLocation    
*location);
+IdeLayoutView             *ide_editor_perspective_get_active_view               (IdeEditorPerspective *self);
+IdeLayoutGrid             *ide_editor_perspective_get_grid                      (IdeEditorPerspective *self);
+IdeEditorSidebar          *ide_editor_perspective_get_sidebar                   (IdeEditorPerspective *self);
+IdeLayoutTransientSidebar *ide_editor_perspective_get_transient_sidebar         (IdeEditorPerspective *self);
 
 /* We want this to use "classifications" rather than "edges" */
-GtkWidget        *ide_editor_perspective_get_right_edge                (IdeEditorPerspective *self);
 GtkWidget        *ide_editor_perspective_get_bottom_edge               (IdeEditorPerspective *self);
 
 
diff --git a/plugins/color-picker/gb-color-picker-workbench-addin.c 
b/plugins/color-picker/gb-color-picker-workbench-addin.c
index 6bafdff..abffe9c 100644
--- a/plugins/color-picker/gb-color-picker-workbench-addin.c
+++ b/plugins/color-picker/gb-color-picker-workbench-addin.c
@@ -170,7 +170,7 @@ color_panel_rgba_set_cb (GbColorPickerWorkbenchAddin *self,
 static gboolean
 init_dock (GbColorPickerWorkbenchAddin *self)
 {
-  GtkWidget *panel;
+  IdeLayoutTransientSidebar *sidebar;
 
   g_assert (GB_IS_COLOR_PICKER_WORKBENCH_ADDIN (self));
 
@@ -190,8 +190,8 @@ init_dock (GbColorPickerWorkbenchAddin *self)
 
   init_palettes (self);
 
-  panel = ide_editor_perspective_get_right_edge (IDE_EDITOR_PERSPECTIVE (self->editor));
-  gtk_container_add (GTK_CONTAINER (panel), GTK_WIDGET (self->dock));
+  sidebar = ide_editor_perspective_get_transient_sidebar (IDE_EDITOR_PERSPECTIVE (self->editor));
+  gtk_container_add (GTK_CONTAINER (sidebar), GTK_WIDGET (self->dock));
   gtk_container_add (GTK_CONTAINER (self->dock), self->color_panel);
 
   g_signal_connect_object (self->color_panel,


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