[gnome-builder] workbench: re-focus global search entry when no views
- From: Sébastien Lafargue <slafargue src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] workbench: re-focus global search entry when no views
- Date: Mon, 1 Feb 2016 22:59:54 +0000 (UTC)
commit 4ea5029c92f65ecf400ced0570d61b4b788fdd48
Author: Sebastien Lafargue <slafargue gnome org>
Date: Mon Feb 1 23:56:02 2016 +0100
workbench: re-focus global search entry when no views
This way we don't lost the focus and can use global shorcuts
like panel ones ( F9/shift F9/ctrl F9)
libide/editor/ide-editor-workbench-addin.c | 6 ++++++
libide/ide-layout-grid.c | 8 ++++++--
2 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/libide/editor/ide-editor-workbench-addin.c b/libide/editor/ide-editor-workbench-addin.c
index 04e76fd..262045d 100644
--- a/libide/editor/ide-editor-workbench-addin.c
+++ b/libide/editor/ide-editor-workbench-addin.c
@@ -21,11 +21,13 @@
#include <gtksourceview/gtksource.h>
#include <string.h>
+#include "ide-gtk.h"
#include "ide-buffer.h"
#include "ide-buffer-manager.h"
#include "ide-context.h"
#include "ide-editor-perspective.h"
#include "ide-editor-workbench-addin.h"
+#include "ide-workbench-header-bar.h"
struct _IdeEditorWorkbenchAddin
{
@@ -55,6 +57,7 @@ ide_editor_workbench_addin_load (IdeWorkbenchAddin *addin,
IdeWorkbench *workbench)
{
IdeEditorWorkbenchAddin *self = (IdeEditorWorkbenchAddin *)addin;
+ IdeWorkbenchHeaderBar *titlebar;
g_assert (IDE_IS_EDITOR_WORKBENCH_ADDIN (self));
g_assert (IDE_IS_WORKBENCH (workbench));
@@ -65,6 +68,9 @@ ide_editor_workbench_addin_load (IdeWorkbenchAddin *addin,
"visible", TRUE,
NULL);
ide_workbench_add_perspective (workbench, IDE_PERSPECTIVE (self->perspective));
+
+ titlebar = IDE_WORKBENCH_HEADER_BAR (ide_perspective_get_titlebar (IDE_PERSPECTIVE (self->perspective)));
+ ide_workbench_header_bar_focus_search (titlebar);
}
static void
diff --git a/libide/ide-layout-grid.c b/libide/ide-layout-grid.c
index 44356e2..377dfd1 100644
--- a/libide/ide-layout-grid.c
+++ b/libide/ide-layout-grid.c
@@ -20,6 +20,7 @@
#include <glib/gi18n.h>
+#include "ide-gtk.h"
#include "ide-layout-grid.h"
#include "ide-layout-stack.h"
#include "ide-layout-stack-private.h"
@@ -240,7 +241,7 @@ ide_layout_grid_focus_neighbor_action (GSimpleAction *action,
static void
ide_layout_grid_stack_empty (IdeLayoutGrid *self,
- IdeLayoutStack *stack)
+ IdeLayoutStack *stack)
{
GList *stacks;
@@ -252,7 +253,10 @@ ide_layout_grid_stack_empty (IdeLayoutGrid *self,
g_assert (stacks != NULL);
if (g_list_length (stacks) == 1)
- goto cleanup;
+ {
+ ide_widget_action (GTK_WIDGET (self), "perspective", "global-search", NULL);
+ goto cleanup;
+ }
ide_layout_grid_focus_neighbor (self, GTK_DIR_LEFT, stack);
ide_layout_grid_remove_stack (self, stack);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]