[gnome-builder] workbench: switch headers when switching perspectives
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] workbench: switch headers when switching perspectives
- Date: Tue, 28 Jun 2016 00:08:34 +0000 (UTC)
commit df7cfb7fa0a6148c36b74aecbb4aa39430105e44
Author: Christian Hergert <chergert redhat com>
Date: Fri Jun 24 20:27:02 2016 -0700
workbench: switch headers when switching perspectives
libide/workbench/ide-workbench.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/libide/workbench/ide-workbench.c b/libide/workbench/ide-workbench.c
index 1b22668..43bedc8 100644
--- a/libide/workbench/ide-workbench.c
+++ b/libide/workbench/ide-workbench.c
@@ -603,6 +603,7 @@ ide_workbench_add_perspective (IdeWorkbench *self,
g_autofree gchar *icon_name = NULL;
g_autofree gchar *id = NULL;
g_autofree gchar *title = NULL;
+ GtkWidget *titlebar;
g_assert (IDE_IS_WORKBENCH (self));
g_assert (IDE_IS_PERSPECTIVE (perspective));
@@ -610,6 +611,7 @@ ide_workbench_add_perspective (IdeWorkbench *self,
id = ide_perspective_get_id (perspective);
title = ide_perspective_get_title (perspective);
icon_name = ide_perspective_get_icon_name (perspective);
+ titlebar = ide_perspective_get_titlebar (perspective);
gtk_container_add_with_properties (GTK_CONTAINER (self->perspectives_stack),
GTK_WIDGET (perspective),
@@ -619,6 +621,11 @@ ide_workbench_add_perspective (IdeWorkbench *self,
"title", title,
NULL);
+ if (titlebar != NULL)
+ gtk_container_add_with_properties (GTK_CONTAINER (self->header_stack), titlebar,
+ "name", id,
+ NULL);
+
if (!IDE_IS_GREETER_PERSPECTIVE (perspective) &&
!IDE_IS_GENESIS_PERSPECTIVE (perspective))
{
@@ -752,6 +759,7 @@ ide_workbench_set_visible_perspective (IdeWorkbench *self,
g_autofree gchar *id = NULL;
GActionGroup *actions = NULL;
const gchar *current_id;
+ GtkWidget *titlebar;
g_return_if_fail (IDE_IS_WORKBENCH (self));
g_return_if_fail (IDE_IS_PERSPECTIVE (perspective));
@@ -762,6 +770,13 @@ ide_workbench_set_visible_perspective (IdeWorkbench *self,
if (!ide_str_equal0 (current_id, id))
gtk_stack_set_visible_child_name (self->perspectives_stack, id);
+ titlebar = gtk_stack_get_child_by_name (self->header_stack, id);
+
+ if (titlebar != NULL)
+ gtk_stack_set_visible_child (self->header_stack, titlebar);
+ else
+ gtk_stack_set_visible_child (self->header_stack, GTK_WIDGET (self->header_bar));
+
actions = ide_perspective_get_actions (perspective);
gtk_widget_insert_action_group (GTK_WIDGET (self), "perspective", actions);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]