[gnome-builder/wip/commands] commands: refocus workspace upon hiding command bar
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/commands] commands: refocus workspace upon hiding command bar
- Date: Tue, 7 Oct 2014 10:48:45 +0000 (UTC)
commit a8b8ae10426be4baa0bead12953eb83edafcb96b
Author: Christian Hergert <christian hergert me>
Date: Tue Oct 7 03:48:38 2014 -0700
commands: refocus workspace upon hiding command bar
src/workbench/gb-workbench.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/workbench/gb-workbench.c b/src/workbench/gb-workbench.c
index 918c2af..c9ce4d3 100644
--- a/src/workbench/gb-workbench.c
+++ b/src/workbench/gb-workbench.c
@@ -284,6 +284,25 @@ gb_workbench_navigation_changed (GbWorkbench *workbench,
}
static void
+on_command_bar_reveal_child_notify (GbWorkbench *workbench,
+ GParamSpec *pspec,
+ GbCommandBar *command_bar)
+{
+ GbWorkspace *workspace;
+ gboolean reveal_child;
+
+ g_return_if_fail (GB_IS_WORKBENCH (workbench));
+
+ workspace = gb_workbench_get_active_workspace (workbench);
+ if (!workspace)
+ return;
+
+ reveal_child = gtk_revealer_get_reveal_child (GTK_REVEALER (command_bar));
+ if (!reveal_child)
+ gtk_widget_grab_focus (GTK_WIDGET (workspace));
+}
+
+static void
gb_workbench_constructed (GObject *object)
{
static const GActionEntry actions[] = {
@@ -313,6 +332,12 @@ gb_workbench_constructed (GObject *object)
gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (priv->gear_menu_button),
G_MENU_MODEL (menu));
+ g_signal_connect_object (priv->command_bar,
+ "notify::reveal-child",
+ G_CALLBACK (on_command_bar_reveal_child_notify),
+ workbench,
+ (G_CONNECT_SWAPPED | G_CONNECT_AFTER));
+
g_signal_connect_object (priv->stack,
"notify::visible-child",
G_CALLBACK (gb_workbench_stack_child_changed),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]