[gnome-builder/wip/chergert/terminal-workspace: 1/2] terminal: add omnibar to terminal workspace
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/terminal-workspace: 1/2] terminal: add omnibar to terminal workspace
- Date: Mon, 29 Apr 2019 18:53:24 +0000 (UTC)
commit bce7286c5155be51b68f6afc8f616dc0d05e54de
Author: Christian Hergert <chergert redhat com>
Date: Mon Apr 29 11:52:31 2019 -0700
terminal: add omnibar to terminal workspace
If we have a terminal workspace with a project, we can add an omnibar
to the workspace window.
src/libide/terminal/ide-terminal-surface.c | 2 +-
src/libide/terminal/ide-terminal-workspace.c | 24 ++++++++++++++++++++++++
2 files changed, 25 insertions(+), 1 deletion(-)
---
diff --git a/src/libide/terminal/ide-terminal-surface.c b/src/libide/terminal/ide-terminal-surface.c
index c85363a8b..b402d2ea4 100644
--- a/src/libide/terminal/ide-terminal-surface.c
+++ b/src/libide/terminal/ide-terminal-surface.c
@@ -75,7 +75,7 @@ ide_terminal_surface_add (GtkContainer *container,
g_assert (IDE_IS_TERMINAL_SURFACE (self));
- if (IDE_IS_TERMINAL_PAGE (child))
+ if (IDE_IS_PAGE (child))
gtk_container_add (GTK_CONTAINER (self->grid), child);
else
GTK_CONTAINER_CLASS (ide_terminal_surface_parent_class)->add (container, child);
diff --git a/src/libide/terminal/ide-terminal-workspace.c b/src/libide/terminal/ide-terminal-workspace.c
index ad1019e9b..99ed55df6 100644
--- a/src/libide/terminal/ide-terminal-workspace.c
+++ b/src/libide/terminal/ide-terminal-workspace.c
@@ -33,6 +33,28 @@ struct _IdeTerminalWorkspace
G_DEFINE_TYPE (IdeTerminalWorkspace, ide_terminal_workspace, IDE_TYPE_WORKSPACE)
+static void
+ide_terminal_workspace_context_set_cb (GtkWidget *widget,
+ IdeContext *context)
+{
+ IdeTerminalWorkspace *self = (IdeTerminalWorkspace *)widget;
+
+ g_assert (IDE_IS_TERMINAL_WORKSPACE (self));
+ g_assert (!context || IDE_IS_CONTEXT (context));
+
+ if (context == NULL)
+ return;
+
+ if (ide_context_has_project (context))
+ {
+ GtkWidget *bar;
+
+ bar = ide_omni_bar_new ();
+ gtk_header_bar_set_custom_title (GTK_HEADER_BAR (self->header_bar), GTK_WIDGET (bar));
+ gtk_widget_show (bar);
+ }
+}
+
static void
ide_terminal_workspace_class_init (IdeTerminalWorkspaceClass *klass)
{
@@ -49,4 +71,6 @@ static void
ide_terminal_workspace_init (IdeTerminalWorkspace *self)
{
gtk_widget_init_template (GTK_WIDGET (self));
+
+ ide_widget_set_context_handler (self, ide_terminal_workspace_context_set_cb);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]