[gnome-builder] editor: implement basics of IdeEditorSidebar



commit d577683492384c9d0fc06bf66a2a72febc3caf0b
Author: Christian Hergert <chergert redhat com>
Date:   Thu Jun 29 23:12:38 2017 -0700

    editor: implement basics of IdeEditorSidebar

 data/themes/shared/shared-layout.css    |   66 ++++++++++++++++++++++++++++---
 libide/editor/ide-editor-perspective.c  |   12 +++++-
 libide/editor/ide-editor-perspective.ui |    5 ++
 libide/editor/ide-editor-private.h      |    3 +
 4 files changed, 78 insertions(+), 8 deletions(-)
---
diff --git a/data/themes/shared/shared-layout.css b/data/themes/shared/shared-layout.css
index 7eeb6f5..9359f7c 100644
--- a/data/themes/shared/shared-layout.css
+++ b/data/themes/shared/shared-layout.css
@@ -67,14 +67,68 @@ popover.title-popover list {
   background: transparent;
 }
 
-popover.title-popover list row {
-  padding: 6px;
+ideeditorsidebar > stackswitcher {
+  margin: 6px;
 }
 
-popover.title-popover list row button {
-  margin: 0;
-  padding: 0;
+ideeditorsidebar label.title {
+  margin: 8px 6px 3px 6px;
+  font-weight: bold;
+  font-size: 0.8em;
+}
+popover.title-popover list row {
+  padding: 1px 0;
+}
+ideeditorsidebar dzlstacklist list row,
+ideeditorsidebar list.open-pages row {
+  padding: 1px 0;
+  color: @theme_fg_color;
+}
+ideeditorsidebar dzlstacklist list row:selected,
+ideeditorsidebar list.open-pages row:selected {
+  color: @theme_selected_fg_color;
+}
+ideeditorsidebar dzlstacklist list row:backdrop,
+ideeditorsidebar list.open-pages row:backdrop {
+  color: @theme_unfocused_fg_color;
+}
+popover.title-popover list row box > image:first-child,
+ideeditorsidebar dzlstacklist list:not(.stack-header) row box > image:first-child,
+ideeditorsidebar list.open-pages row box > image:first-child {
+  opacity: 0.55;
+}
+popover.title-popover list row box > image:first-child,
+ideeditorsidebar dzlstacklist row box > image:first-child,
+ideeditorsidebar list.open-pages row box > image:first-child {
+  margin: 6px 8px;
+  min-height: 16px;
+  min-width: 16px;
+}
+popover.title-popover list row button:last-child,
+ideeditorsidebar dzlstacklist row box > button:last-child,
+ideeditorsidebar list.open-pages row box > button:last-child {
+  background: none;
   box-shadow: none;
   border: none;
-  background: transparent;
+  outline: none;
+  padding: 0;
+  margin: 0 6px;
+  color: @theme_fg_color;
+  opacity: 0.55;
+}
+popover.title-popover list row button:last-child:hover,
+ideeditorsidebar dzlstacklist row box > button:last-child:hover,
+ideeditorsidebar list.open-pages row box > button:last-child:hover {
+  opacity: 1;
+}
+popover.title-popover list row button image,
+ideeditorsidebar dzlstacklist row box > button:last-child image,
+ideeditorsidebar list.open-pages row box > button:last-child image {
+  min-height: 16px;
+  min-width: 16px;
+}
+popover.title-popover list row button image,
+ideeditorsidebar dzlstacklist row box > button:last-child:backdrop,
+ideeditorsidebar list.open-pages row box > button:last-child:backdrop {
+  color: @theme_unfocused_fg_color;
 }
diff --git a/libide/editor/ide-editor-perspective.c b/libide/editor/ide-editor-perspective.c
index 487b705..b7506ad 100644
--- a/libide/editor/ide-editor-perspective.c
+++ b/libide/editor/ide-editor-perspective.c
@@ -22,15 +22,17 @@
 
 #include "editor/ide-editor-perspective.h"
 #include "editor/ide-editor-private.h"
+#include "editor/ide-editor-sidebar.h"
 #include "editor/ide-editor-view.h"
 #include "workbench/ide-perspective.h"
 
 struct _IdeEditorPerspective
 {
-  IdeLayout      parent_instance;
+  IdeLayout         parent_instance;
 
   /* Template widgets */
-  IdeLayoutGrid *grid;
+  IdeLayoutGrid    *grid;
+  IdeEditorSidebar *sidebar;
 };
 
 static void perspective_iface_init (IdePerspectiveInterface *iface);
@@ -63,6 +65,10 @@ ide_editor_perspective_class_init (IdeEditorPerspectiveClass *klass)
 
   gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/builder/ui/ide-editor-perspective.ui");
   gtk_widget_class_bind_template_child (widget_class, IdeEditorPerspective, grid);
+  gtk_widget_class_bind_template_child (widget_class, IdeEditorPerspective, sidebar);
+
+  g_type_ensure (IDE_TYPE_EDITOR_SIDEBAR);
+  g_type_ensure (IDE_TYPE_LAYOUT_GRID);
 }
 
 static void
@@ -70,6 +76,8 @@ ide_editor_perspective_init (IdeEditorPerspective *self)
 {
   gtk_widget_init_template (GTK_WIDGET (self));
 
+  _ide_editor_sidebar_set_open_pages (self->sidebar, G_LIST_MODEL (self->grid));
+
   _ide_editor_perspective_init_actions (self);
   _ide_editor_perspective_init_shortcuts (self);
 }
diff --git a/libide/editor/ide-editor-perspective.ui b/libide/editor/ide-editor-perspective.ui
index 836833a..bebd149 100644
--- a/libide/editor/ide-editor-perspective.ui
+++ b/libide/editor/ide-editor-perspective.ui
@@ -1,6 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <template class="IdeEditorPerspective" parent="IdeLayout">
+    <child type="left">
+      <object class="IdeEditorSidebar" id="sidebar">
+        <property name="visible">true</property>
+      </object>
+    </child>
     <child>
       <object class="IdeLayoutGrid" id="grid">
         <property name="orientation">horizontal</property>
diff --git a/libide/editor/ide-editor-private.h b/libide/editor/ide-editor-private.h
index b91f9a5..1bece92 100644
--- a/libide/editor/ide-editor-private.h
+++ b/libide/editor/ide-editor-private.h
@@ -20,6 +20,7 @@
 
 #include "editor/ide-editor-perspective.h"
 #include "editor/ide-editor-search-bar.h"
+#include "editor/ide-editor-sidebar.h"
 #include "editor/ide-editor-view-addin.h"
 #include "editor/ide-editor-view.h"
 #include "plugins/ide-extension-set-adapter.h"
@@ -47,6 +48,8 @@ struct _IdeEditorView
 void _ide_editor_view_init_actions          (IdeEditorView        *self);
 void _ide_editor_view_init_settings         (IdeEditorView        *self);
 void _ide_editor_view_init_shortcuts        (IdeEditorView        *self);
+void _ide_editor_sidebar_set_open_pages     (IdeEditorSidebar     *self,
+                                             GListModel           *open_pages);
 void _ide_editor_perspective_init_actions   (IdeEditorPerspective *self);
 void _ide_editor_perspective_init_shortcuts (IdeEditorPerspective *self);
 


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