[gnome-builder/wip/plugins] workbench: add action to toggle panels
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/plugins] workbench: add action to toggle panels
- Date: Tue, 9 Jun 2015 09:32:49 +0000 (UTC)
commit 2b1c72b83a1f14cb5afe7ebf87d2ce9445e16ae1
Author: Christian Hergert <christian hergert me>
Date: Tue Jun 9 02:32:43 2015 -0700
workbench: add action to toggle panels
src/workbench/gb-workbench-actions.c | 60 ++++++++++++++++++++++++++++++++++
src/workbench/gb-workbench-private.h | 4 ++
2 files changed, 64 insertions(+), 0 deletions(-)
---
diff --git a/src/workbench/gb-workbench-actions.c b/src/workbench/gb-workbench-actions.c
index 0673501..c865d72 100644
--- a/src/workbench/gb-workbench-actions.c
+++ b/src/workbench/gb-workbench-actions.c
@@ -350,6 +350,65 @@ gb_workbench_actions_show_bottom_pane (GSimpleAction *action,
}
static void
+gb_workbench_actions_toggle_panels (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ GbWorkbench *self = user_data;
+ GtkWidget *left;
+ GtkWidget *right;
+ GtkWidget *bottom;
+ gboolean reveal_left;
+ gboolean reveal_right;
+ gboolean reveal_bottom;
+
+ g_assert (GB_IS_WORKBENCH (self));
+
+ left = gb_workspace_get_left_pane (self->workspace);
+ right = gb_workspace_get_right_pane (self->workspace);
+ bottom = gb_workspace_get_bottom_pane (self->workspace);
+
+ gtk_container_child_get (GTK_CONTAINER (self->workspace), left,
+ "reveal", &reveal_left,
+ NULL);
+ gtk_container_child_get (GTK_CONTAINER (self->workspace), right,
+ "reveal", &reveal_right,
+ NULL);
+ gtk_container_child_get (GTK_CONTAINER (self->workspace), bottom,
+ "reveal", &reveal_bottom,
+ NULL);
+
+ if (reveal_left || reveal_right || reveal_bottom)
+ {
+ self->reveal_left_in_show = reveal_left;
+ self->reveal_right_in_show = reveal_right;
+ self->reveal_bottom_in_show = reveal_bottom;
+
+ gtk_container_child_set (GTK_CONTAINER (self->workspace), left,
+ "reveal", FALSE,
+ NULL);
+ gtk_container_child_set (GTK_CONTAINER (self->workspace), right,
+ "reveal", FALSE,
+ NULL);
+ gtk_container_child_set (GTK_CONTAINER (self->workspace), bottom,
+ "reveal", FALSE,
+ NULL);
+ }
+ else
+ {
+ gtk_container_child_set (GTK_CONTAINER (self->workspace), left,
+ "reveal", self->reveal_left_in_show,
+ NULL);
+ gtk_container_child_set (GTK_CONTAINER (self->workspace), right,
+ "reveal", self->reveal_right_in_show,
+ NULL);
+ gtk_container_child_set (GTK_CONTAINER (self->workspace), bottom,
+ "reveal", self->reveal_bottom_in_show,
+ NULL);
+ }
+}
+
+static void
sync_reveal_state (GtkWidget *child,
GParamSpec *pspec,
GSimpleAction *action)
@@ -382,6 +441,7 @@ static const GActionEntry GbWorkbenchActions[] = {
{ "show-left-pane", gb_workbench_actions_show_left_pane, NULL, "true" },
{ "show-right-pane", gb_workbench_actions_show_right_pane, NULL, "false" },
{ "show-bottom-pane", gb_workbench_actions_show_bottom_pane, NULL, "false" },
+ { "toggle-panels", gb_workbench_actions_toggle_panels },
};
void
diff --git a/src/workbench/gb-workbench-private.h b/src/workbench/gb-workbench-private.h
index a3efaa3..0379eb1 100644
--- a/src/workbench/gb-workbench-private.h
+++ b/src/workbench/gb-workbench-private.h
@@ -56,6 +56,10 @@ struct _GbWorkbench
guint building : 1;
guint unloading : 1;
guint has_opened : 1;
+
+ guint reveal_left_in_show : 1;
+ guint reveal_right_in_show : 1;
+ guint reveal_bottom_in_show : 1;
};
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]