[gedit] Window: 'Escape' give the focus to the active view
- From: Sebastien Lafargue <slafargue src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] Window: 'Escape' give the focus to the active view
- Date: Wed, 27 Aug 2014 14:05:13 +0000 (UTC)
commit cf8b96af795723437f673e92cc1a7068bdf4e76b
Author: Sebastien Lafargue <slafargue gnome org>
Date: Wed Aug 27 15:19:45 2014 +0200
Window: 'Escape' give the focus to the active view
gedit/gedit-app.c | 1 +
gedit/gedit-commands-view.c | 18 ++++++++++++++++++
gedit/gedit-commands.h | 3 +++
gedit/gedit-window.c | 1 +
4 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/gedit/gedit-app.c b/gedit/gedit-app.c
index a1950c5..7a4231e 100644
--- a/gedit/gedit-app.c
+++ b/gedit/gedit-app.c
@@ -590,6 +590,7 @@ gedit_app_startup (GApplication *application)
add_accelerator (app, "win.replace", "<Primary>H");
add_accelerator (app, "win.clear-highlight", "<Primary><Shift>K");
add_accelerator (app, "win.goto-line", "<Primary>I");
+ add_accelerator (app, "win.focus-active-view", "Escape");
add_accelerator (app, "win.side-panel", "F9");
add_accelerator (app, "win.bottom-panel", "<Primary>F9");
add_accelerator (app, "win.fullscreen", "F11");
diff --git a/gedit/gedit-commands-view.c b/gedit/gedit-commands-view.c
index d43bab1..37e83f0 100644
--- a/gedit/gedit-commands-view.c
+++ b/gedit/gedit-commands-view.c
@@ -33,6 +33,24 @@
#include "gedit-highlight-mode-selector.h"
void
+_gedit_cmd_view_focus_active (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data)
+{
+ GeditView *active_view;
+ GeditWindow *window = GEDIT_WINDOW (user_data);
+
+ gedit_debug (DEBUG_COMMANDS);
+
+ active_view = gedit_window_get_active_view (window);
+
+ if (active_view)
+ {
+ gtk_widget_grab_focus (active_view);
+ }
+}
+
+void
_gedit_cmd_view_toggle_side_panel (GSimpleAction *action,
GVariant *state,
gpointer user_data)
diff --git a/gedit/gedit-commands.h b/gedit/gedit-commands.h
index f9d290a..66d12b2 100644
--- a/gedit/gedit-commands.h
+++ b/gedit/gedit-commands.h
@@ -128,6 +128,9 @@ void _gedit_cmd_edit_overwrite_mode (GSimpleAction *action,
GVariant *parameter,
gpointer user_data);
+void _gedit_cmd_view_focus_active (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data);
void _gedit_cmd_view_toggle_side_panel (GSimpleAction *action,
GVariant *state,
gpointer user_data);
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index 83ee35a..d8de113 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -2678,6 +2678,7 @@ static GActionEntry win_entries[] = {
{ "close", _gedit_cmd_file_close },
{ "close-all", _gedit_cmd_file_close_all },
{ "print", _gedit_cmd_file_print },
+ { "focus-active-view", NULL, NULL, "false", _gedit_cmd_view_focus_active },
{ "side-panel", NULL, NULL, "false", _gedit_cmd_view_toggle_side_panel },
{ "bottom-panel", NULL, NULL, "false", _gedit_cmd_view_toggle_bottom_panel },
{ "fullscreen", NULL, NULL, "false", _gedit_cmd_view_toggle_fullscreen_mode },
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]