[gnome-builder] editor: implement utilities panel
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] editor: implement utilities panel
- Date: Tue, 29 Aug 2017 05:16:20 +0000 (UTC)
commit c63c8f1bb4adf2be429bf1a7186e807c6654d1f5
Author: Christian Hergert <chergert redhat com>
Date: Mon Aug 28 20:08:21 2017 -0700
editor: implement utilities panel
This implements the utilities panel instead of just our "fallback" bottom
section that we had before.
It had a bit of styling for our two primary themes, Adwaita and Arc. The
normal variant of Adwaita has some tweaks to look flat, similar to the
mockups, but that has not yet been done for the dark mode (which should
maybe be done as well). It could probably use some :backdrop tweaks as
well.
This switches to using icons+tooltip text for the group sections.
data/themes/Adwaita-shared.css | 6 +
data/themes/Adwaita.css | 24 +++++
data/themes/Arc-shared.css | 10 ++-
libide/buildui/ide-build-workbench-addin.c | 6 +-
libide/editor/ide-editor-perspective.c | 15 +++-
libide/editor/ide-editor-perspective.h | 6 +-
libide/editor/ide-editor-utilities.c | 117 ++++++++++++++++++++++++
libide/editor/ide-editor-utilities.h | 31 ++++++
libide/editor/ide-editor-utilities.ui | 26 +++++
libide/ide.h | 1 +
libide/libide.gresource.xml | 1 +
libide/meson.build | 2 +
plugins/sysmon/gb-sysmon-addin.c | 3 +-
plugins/terminal/gb-terminal-workbench-addin.c | 6 +-
14 files changed, 240 insertions(+), 14 deletions(-)
---
diff --git a/data/themes/Adwaita-shared.css b/data/themes/Adwaita-shared.css
index 82d47f5..eecc02b 100644
--- a/data/themes/Adwaita-shared.css
+++ b/data/themes/Adwaita-shared.css
@@ -20,6 +20,12 @@ treeview.image { color: alpha(currentColor, 0.8); }
treeview.image:selected { color: alpha(@theme_selected_fg_color, 0.9); }
+/* utilities stack switcher */
+ideeditorutilities > dzldockpaned > box > stackswitcher {
+ margin: 6px;
+}
+
+
/* buildui panel */
ideeditorsidebar notebook header {
background: transparent;
diff --git a/data/themes/Adwaita.css b/data/themes/Adwaita.css
index 0d3483a..a251f5e 100644
--- a/data/themes/Adwaita.css
+++ b/data/themes/Adwaita.css
@@ -4,3 +4,27 @@
entry.search-missing {
border-color: #aa0000;
}
+
+
+/* Utilities stack switcher: make flat'ish */
+ideeditorutilities > dzldockpaned > box > stackswitcher > button {
+ background-color: @theme_bg_color;
+ background-image: none;
+}
+ideeditorutilities > dzldockpaned > box > stackswitcher > button:checked {
+ background-image: none;
+ background-color: #d9d9d7;
+}
+ideeditorutilities > dzldockpaned > box > stackswitcher > button:hover {
+ background-image: none;
+ background-color: shade(@theme_bg_color, 1.03);
+}
+ideeditorutilities > dzldockpaned > box > stackswitcher > button:checked:hover {
+ background-image: none;
+ background-color: shade(#d9d9d7, 1.03);
+}
+ideeditorutilities > dzldockpaned > box > stackswitcher > button:active:hover,
+ideeditorutilities > dzldockpaned > box > stackswitcher > button:active {
+ background-image: none;
+ background-color: shade(#d9d9d7, 1.01);
+}
diff --git a/data/themes/Arc-shared.css b/data/themes/Arc-shared.css
index 3c40f96..371ef7c 100644
--- a/data/themes/Arc-shared.css
+++ b/data/themes/Arc-shared.css
@@ -48,11 +48,11 @@ layoutpane stackswitcher button:checked {
}
/* All boxes */
layoutpane > box > box.horizontal > stackswitcher > button:hover {
- border: 1px solid @borders;
+ border: 1px solid @borders;
}
/* Box above file switcher */
layoutpane > box.vertical:first-child > box.horizontal {
- border: 1px solid @borders;
+ border: 1px solid @borders;
}
@@ -75,3 +75,9 @@ popover.messagepopover > * > * {
margin: 0;
padding: 0;
}
+
+
+/* utilities stack switcher */
+ideeditorutilities > dzldockpaned > box > stackswitcher {
+ margin: 6px;
+}
diff --git a/libide/buildui/ide-build-workbench-addin.c b/libide/buildui/ide-build-workbench-addin.c
index c146b5c..46f8b3c 100644
--- a/libide/buildui/ide-build-workbench-addin.c
+++ b/libide/buildui/ide-build-workbench-addin.c
@@ -173,8 +173,10 @@ ide_build_workbench_addin_load (IdeWorkbenchAddin *addin,
GTK_WIDGET (self->panel),
100);
- pane = ide_editor_perspective_get_bottom_edge (IDE_EDITOR_PERSPECTIVE (editor));
- self->build_log_panel = g_object_new (IDE_TYPE_BUILD_LOG_PANEL, NULL);
+ pane = ide_editor_perspective_get_utilities (IDE_EDITOR_PERSPECTIVE (editor));
+ self->build_log_panel = g_object_new (IDE_TYPE_BUILD_LOG_PANEL,
+ "icon-name", "builder-build-symbolic",
+ NULL);
g_signal_connect (self->build_log_panel,
"destroy",
G_CALLBACK (gtk_widget_destroyed),
diff --git a/libide/editor/ide-editor-perspective.c b/libide/editor/ide-editor-perspective.c
index ceb656c..d220128 100644
--- a/libide/editor/ide-editor-perspective.c
+++ b/libide/editor/ide-editor-perspective.c
@@ -28,6 +28,7 @@
#include "editor/ide-editor-private.h"
#include "editor/ide-editor-properties.h"
#include "editor/ide-editor-sidebar.h"
+#include "editor/ide-editor-utilities.h"
#include "editor/ide-editor-view.h"
#include "layout/ide-layout-transient-sidebar.h"
#include "workbench/ide-perspective.h"
@@ -209,6 +210,13 @@ ide_editor_perspective_create_edge (DzlDockBin *dock_bin,
"visible", FALSE,
NULL);
+ if (edge == GTK_POS_BOTTOM)
+ return g_object_new (IDE_TYPE_EDITOR_UTILITIES,
+ "edge", edge,
+ "reveal-child", FALSE,
+ "visible", TRUE,
+ NULL);
+
return DZL_DOCK_BIN_CLASS (ide_editor_perspective_parent_class)->create_edge (dock_bin, edge);
}
@@ -575,14 +583,15 @@ ide_editor_perspective_get_transient_sidebar (IdeEditorPerspective *self)
}
/**
- * ide_editor_perspective_get_bottom_edge:
+ * ide_editor_perspective_get_utilities:
*
- * Returns: (transfer none): A #GtkWidget
+ * Returns: (transfer none): An #IdeEditorUtilities
*/
GtkWidget *
-ide_editor_perspective_get_bottom_edge (IdeEditorPerspective *self)
+ide_editor_perspective_get_utilities (IdeEditorPerspective *self)
{
g_return_val_if_fail (IDE_IS_EDITOR_PERSPECTIVE (self), NULL);
+
return dzl_dock_bin_get_bottom_edge (DZL_DOCK_BIN (self));
}
diff --git a/libide/editor/ide-editor-perspective.h b/libide/editor/ide-editor-perspective.h
index 7783059..7881934 100644
--- a/libide/editor/ide-editor-perspective.h
+++ b/libide/editor/ide-editor-perspective.h
@@ -20,6 +20,7 @@
#include "diagnostics/ide-source-location.h"
#include "editor/ide-editor-sidebar.h"
+#include "editor/ide-editor-utilities.h"
#include "layout/ide-layout.h"
#include "layout/ide-layout-grid.h"
#include "layout/ide-layout-transient-sidebar.h"
@@ -40,9 +41,6 @@ IdeLayoutView *ide_editor_perspective_get_active_view
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_bottom_edge (IdeEditorPerspective *self);
-
+GtkWidget *ide_editor_perspective_get_utilities (IdeEditorPerspective *self);
G_END_DECLS
diff --git a/libide/editor/ide-editor-utilities.c b/libide/editor/ide-editor-utilities.c
new file mode 100644
index 0000000..9737718
--- /dev/null
+++ b/libide/editor/ide-editor-utilities.c
@@ -0,0 +1,117 @@
+/* ide-editor-utilities.c
+ *
+ * Copyright (C) 2017 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#define G_LOG_DOMAIN "ide-editor-utilities"
+
+#include "editor/ide-editor-utilities.h"
+
+/**
+ * SECTION:ide-editor-utilities
+ * @title: IdeEditorUtilities
+ * @short_description: Container for utilities in the editor perspective
+ *
+ * The #IdeEditorUtilities widget is a convenient container for widgets that
+ * are not primarily navigation based but are useful from the editor. Such
+ * an example could be build logs, application output, and other ancillary
+ * information for the user.
+ *
+ * You can get this widget via ide_editor_perspective_get_utilities().
+ *
+ * Since: 3.26
+ */
+
+struct _IdeEditorUtilities
+{
+ IdeLayoutPane parent_instance;
+
+ GtkStackSwitcher *stack_switcher;
+ GtkStack *stack;
+
+ guint loading : 1;
+};
+
+G_DEFINE_TYPE (IdeEditorUtilities, ide_editor_utilities, IDE_TYPE_LAYOUT_PANE)
+
+static void
+tweak_radio_button (GtkWidget *widget,
+ gpointer user_data)
+{
+ gtk_widget_set_vexpand (widget, TRUE);
+}
+
+static void
+ide_editor_utilities_add (GtkContainer *container,
+ GtkWidget *widget)
+{
+ IdeEditorUtilities *self = (IdeEditorUtilities *)container;
+
+ if (self->loading)
+ GTK_CONTAINER_CLASS (ide_editor_utilities_parent_class)->add (container, widget);
+ else
+ gtk_container_add (GTK_CONTAINER (self->stack), widget);
+
+ if (DZL_IS_DOCK_WIDGET (widget))
+ {
+ g_autofree gchar *icon_name = NULL;
+ g_autofree gchar *title = NULL;
+
+ g_object_get (widget,
+ "icon-name", &icon_name,
+ "title", &title,
+ NULL);
+
+ gtk_container_child_set (GTK_CONTAINER (self->stack), widget,
+ "title", title,
+ "icon-name", icon_name,
+ NULL);
+
+ gtk_container_foreach (GTK_CONTAINER (self->stack_switcher),
+ tweak_radio_button,
+ NULL);
+ }
+}
+
+static void
+ide_editor_utilities_destroy (GtkWidget *widget)
+{
+ GTK_WIDGET_CLASS (ide_editor_utilities_parent_class)->destroy (widget);
+}
+
+static void
+ide_editor_utilities_class_init (IdeEditorUtilitiesClass *klass)
+{
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+ GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
+
+ widget_class->destroy = ide_editor_utilities_destroy;
+
+ container_class->add = ide_editor_utilities_add;
+
+ gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/builder/ui/ide-editor-utilities.ui");
+ gtk_widget_class_bind_template_child (widget_class, IdeEditorUtilities, stack_switcher);
+ gtk_widget_class_bind_template_child (widget_class, IdeEditorUtilities, stack);
+ gtk_widget_class_set_css_name (widget_class, "ideeditorutilities");
+}
+
+static void
+ide_editor_utilities_init (IdeEditorUtilities *self)
+{
+ self->loading = TRUE;
+ gtk_widget_init_template (GTK_WIDGET (self));
+ self->loading = FALSE;
+}
diff --git a/libide/editor/ide-editor-utilities.h b/libide/editor/ide-editor-utilities.h
new file mode 100644
index 0000000..19b1827
--- /dev/null
+++ b/libide/editor/ide-editor-utilities.h
@@ -0,0 +1,31 @@
+/* ide-editor-utilities.h
+ *
+ * Copyright (C) 2017 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#pragma once
+
+#include "layout/ide-layout-pane.h"
+
+G_BEGIN_DECLS
+
+#define IDE_TYPE_EDITOR_UTILITIES (ide_editor_utilities_get_type())
+
+G_DECLARE_FINAL_TYPE (IdeEditorUtilities, ide_editor_utilities, IDE, EDITOR_UTILITIES, IdeLayoutPane)
+
+/* Use GtkContainer api to add your DzlDockWidget */
+
+G_END_DECLS
diff --git a/libide/editor/ide-editor-utilities.ui b/libide/editor/ide-editor-utilities.ui
new file mode 100644
index 0000000..c08dd79
--- /dev/null
+++ b/libide/editor/ide-editor-utilities.ui
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <template class="IdeEditorUtilities" parent="IdeLayoutPane">
+ <child>
+ <object class="GtkBox">
+ <property name="orientation">horizontal</property>
+ <property name="visible">true</property>
+ <child>
+ <object class="GtkStackSwitcher" id="stack_switcher">
+ <property name="orientation">vertical</property>
+ <property name="stack">stack</property>
+ <property name="vexpand">true</property>
+ <property name="visible">true</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkStack" id="stack">
+ <property name="transition-type">crossfade</property>
+ <property name="homogeneous">false</property>
+ <property name="visible">true</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </template>
+</interface>
diff --git a/libide/ide.h b/libide/ide.h
index 8d2d512..0ecdd45 100644
--- a/libide/ide.h
+++ b/libide/ide.h
@@ -80,6 +80,7 @@ G_BEGIN_DECLS
#include "editor/ide-editor-addin.h"
#include "editor/ide-editor-perspective.h"
#include "editor/ide-editor-sidebar.h"
+#include "editor/ide-editor-utilities.h"
#include "editor/ide-editor-view-addin.h"
#include "editor/ide-editor-view.h"
#include "files/ide-file-settings.h"
diff --git a/libide/libide.gresource.xml b/libide/libide.gresource.xml
index a5b295c..f3d97a5 100644
--- a/libide/libide.gresource.xml
+++ b/libide/libide.gresource.xml
@@ -58,6 +58,7 @@
<file compressed="true" preprocess="xml-stripblanks"
alias="ide-layout-pane.ui">layout/ide-layout-pane.ui</file>
<file compressed="true" preprocess="xml-stripblanks"
alias="ide-layout-stack-header.ui">layout/ide-layout-stack-header.ui</file>
<file compressed="true" preprocess="xml-stripblanks"
alias="ide-layout-stack.ui">layout/ide-layout-stack.ui</file>
+ <file compressed="true" preprocess="xml-stripblanks"
alias="ide-editor-utilities.ui">editor/ide-editor-utilities.ui</file>
<file compressed="true" preprocess="xml-stripblanks"
alias="ide-editor-perspective.ui">editor/ide-editor-perspective.ui</file>
<file compressed="true" preprocess="xml-stripblanks"
alias="ide-editor-properties.ui">editor/ide-editor-properties.ui</file>
<file compressed="true" preprocess="xml-stripblanks"
alias="ide-editor-layout-stack-controls.ui">editor/ide-editor-layout-stack-controls.ui</file>
diff --git a/libide/meson.build b/libide/meson.build
index 58f1b1f..0c656a5 100644
--- a/libide/meson.build
+++ b/libide/meson.build
@@ -106,6 +106,7 @@ libide_public_headers = [
'editor/ide-editor-addin.h',
'editor/ide-editor-perspective.h',
'editor/ide-editor-sidebar.h',
+ 'editor/ide-editor-utilities.h',
'editor/ide-editor-view-addin.h',
'editor/ide-editor-view.h',
'files/ide-file-settings.h',
@@ -308,6 +309,7 @@ libide_public_sources = [
'editor/ide-editor-addin.c',
'editor/ide-editor-perspective.c',
'editor/ide-editor-sidebar.c',
+ 'editor/ide-editor-utilities.c',
'editor/ide-editor-view-addin.c',
'editor/ide-editor-view.c',
'files/ide-file-settings.c',
diff --git a/plugins/sysmon/gb-sysmon-addin.c b/plugins/sysmon/gb-sysmon-addin.c
index b436d4b..632615d 100644
--- a/plugins/sysmon/gb-sysmon-addin.c
+++ b/plugins/sysmon/gb-sysmon-addin.c
@@ -53,8 +53,9 @@ gb_sysmon_addin_load (IdeWorkbenchAddin *addin,
g_assert (editor != NULL);
g_assert (IDE_IS_EDITOR_PERSPECTIVE (editor));
- pane = ide_editor_perspective_get_bottom_edge (IDE_EDITOR_PERSPECTIVE (editor));
+ pane = ide_editor_perspective_get_utilities (IDE_EDITOR_PERSPECTIVE (editor));
panel = g_object_new (GB_TYPE_SYSMON_PANEL,
+ "icon-name", "utilities-system-monitor-symbolic",
"expand", TRUE,
"visible", TRUE,
NULL);
diff --git a/plugins/terminal/gb-terminal-workbench-addin.c b/plugins/terminal/gb-terminal-workbench-addin.c
index b97b73a..9235a48 100644
--- a/plugins/terminal/gb-terminal-workbench-addin.c
+++ b/plugins/terminal/gb-terminal-workbench-addin.c
@@ -141,6 +141,7 @@ on_run_manager_run (GbTerminalWorkbenchAddin *self,
panel = g_object_new (DZL_TYPE_DOCK_WIDGET,
"child", self->run_terminal,
"expand", TRUE,
+ "icon-name", "system-run-symbolic",
"title", _("Application Output"),
"visible", TRUE,
NULL);
@@ -149,7 +150,7 @@ on_run_manager_run (GbTerminalWorkbenchAddin *self,
perspective = ide_workbench_get_perspective_by_name (self->workbench, "editor");
g_assert (IDE_IS_EDITOR_PERSPECTIVE (perspective));
- bottom_pane = ide_editor_perspective_get_bottom_edge (IDE_EDITOR_PERSPECTIVE (perspective));
+ bottom_pane = ide_editor_perspective_get_utilities (IDE_EDITOR_PERSPECTIVE (perspective));
gtk_container_add (GTK_CONTAINER (bottom_pane), GTK_WIDGET (self->run_panel));
}
else
@@ -245,6 +246,7 @@ gb_terminal_workbench_addin_load (IdeWorkbenchAddin *addin,
{
self->panel_dock_widget = g_object_new (DZL_TYPE_DOCK_WIDGET,
"expand", TRUE,
+ "icon-name", "utilities-terminal-symbolic",
"title", _("Terminal"),
"visible", TRUE,
NULL);
@@ -263,7 +265,7 @@ gb_terminal_workbench_addin_load (IdeWorkbenchAddin *addin,
perspective = ide_workbench_get_perspective_by_name (workbench, "editor");
g_assert (IDE_IS_EDITOR_PERSPECTIVE (perspective));
- bottom_pane = ide_editor_perspective_get_bottom_edge (IDE_EDITOR_PERSPECTIVE (perspective));
+ bottom_pane = ide_editor_perspective_get_utilities (IDE_EDITOR_PERSPECTIVE (perspective));
gtk_container_add (GTK_CONTAINER (bottom_pane), GTK_WIDGET (self->panel_dock_widget));
run_manager = ide_context_get_run_manager (context);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]