[dconf-editor] Move 'bw.escape' as 'base.escape'.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Move 'bw.escape' as 'base.escape'.
- Date: Sun, 20 Jan 2019 10:35:56 +0000 (UTC)
commit 178075e9f9d8c943a0f9386a8e10d10ceac1f054
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Thu Jan 17 12:28:37 2019 +0100
Move 'bw.escape' as 'base.escape'.
The Escape shortcut is used to close the in-window
about panel, its place is logically in BaseWindow.
editor/base-window.vala | 19 +++++++++++++++++--
editor/bookmarks-window.vala | 31 ++++++++++++++-----------------
editor/browser-window.vala | 22 ++++++++++++++++++++++
editor/dconf-editor.vala | 2 +-
editor/dconf-window.vala | 12 ++++++------
5 files changed, 60 insertions(+), 26 deletions(-)
---
diff --git a/editor/base-window.vala b/editor/base-window.vala
index 1343384..bff6732 100644
--- a/editor/base-window.vala
+++ b/editor/base-window.vala
@@ -98,11 +98,12 @@ private class BaseWindow : AdaptativeWindow, AdaptativeWidget
{ "paste", paste }, // <P>v
{ "paste-alt", paste_alt }, // <P>V
+ { "escape", _escape_pressed }, // Escape
{ "toggle-hamburger", toggle_hamburger }, // F10
{ "menu", menu_pressed }, // Menu
- { "show-default-view", show_default_view },
- { "about", about }
+ { "show-default-view", show_default_view },
+ { "about", about }
};
/*\
@@ -332,6 +333,20 @@ private class BaseWindow : AdaptativeWindow, AdaptativeWidget
show_default_view ();
}
+ private void _escape_pressed (/* SimpleAction action, Variant? path_variant */)
+ {
+ escape_pressed (); // returns true if something is done
+ }
+ protected virtual bool escape_pressed ()
+ {
+ if (in_window_about)
+ {
+ show_default_view ();
+ return true;
+ }
+ return false;
+ }
+
protected virtual void show_default_view (/* SimpleAction action, Variant? path_variant */)
{
if (in_window_about)
diff --git a/editor/bookmarks-window.vala b/editor/bookmarks-window.vala
index c853808..5c08924 100644
--- a/editor/bookmarks-window.vala
+++ b/editor/bookmarks-window.vala
@@ -70,15 +70,26 @@ private abstract class BookmarksWindow : BrowserWindow, AdaptativeWidget
// keyboard
{ "toggle-bookmark", toggle_bookmark }, // <P>b & <P>B
{ "bookmark", bookmark }, // <P>d
- { "unbookmark", unbookmark }, // <P>D
-
- { "escape", escape_pressed } // Escape
+ { "unbookmark", unbookmark } // <P>D
};
/*\
* * showing or hiding panels
\*/
+ protected override bool escape_pressed ()
+ {
+ if (main_view.in_window_bookmarks)
+ {
+ if (main_view.in_window_bookmarks_edit_mode)
+ leave_edit_mode ();
+ else
+ show_default_view ();
+ return true;
+ }
+ return base.escape_pressed ();
+ }
+
protected override void show_default_view ()
{
if (main_view.in_window_bookmarks)
@@ -207,20 +218,6 @@ private abstract class BookmarksWindow : BrowserWindow, AdaptativeWidget
headerbar.unbookmark_current_path ();
}
- private void escape_pressed (/* SimpleAction action, Variant? variant */)
- {
- if (main_view.in_window_bookmarks)
- {
- if (main_view.in_window_bookmarks_edit_mode)
- leave_edit_mode ();
- else
- show_default_view ();
- }
- else
- escape_pressed_called ();
- }
- protected abstract void escape_pressed_called ();
-
/*\
* * keyboard calls helpers
\*/
diff --git a/editor/browser-window.vala b/editor/browser-window.vala
index 5877ff4..8c6bf24 100644
--- a/editor/browser-window.vala
+++ b/editor/browser-window.vala
@@ -437,6 +437,28 @@ private abstract class BrowserWindow : BaseWindow
return false;
}
+ protected override bool escape_pressed ()
+ {
+ if (headerbar.in_window_properties)
+ {
+ show_default_view ();
+ return true;
+ }
+ if (base.escape_pressed ())
+ return true;
+ if (current_type == ViewType.CONFIG)
+ {
+ request_folder (current_path);
+ return true;
+ }
+ if (headerbar.search_mode_enabled)
+ {
+ stop_search ();
+ return true;
+ }
+ return false;
+ }
+
protected override void show_default_view ()
{
if (headerbar.in_window_properties)
diff --git a/editor/dconf-editor.vala b/editor/dconf-editor.vala
index cd9bee2..97cb8e4 100644
--- a/editor/dconf-editor.vala
+++ b/editor/dconf-editor.vala
@@ -348,8 +348,8 @@ private class ConfigurationEditor : Gtk.Application, BaseApplication
set_accels_for_action ("key.open-child", { "<Alt>Down" });
set_accels_for_action ("key.open-last-child", { "<Shift><Alt>Down" });
+ set_accels_for_action ("base.escape", { "Escape" });
set_accels_for_action ("base.toggle-hamburger", { "F10" });
- set_accels_for_action ("bw.escape", { "Escape" });
set_accels_for_action ("base.menu", { "Menu" });
set_accels_for_action ("kbd.set-to-default", { "<Primary>Delete",
diff --git a/editor/dconf-window.vala b/editor/dconf-window.vala
index 300574c..4a8e4da 100644
--- a/editor/dconf-window.vala
+++ b/editor/dconf-window.vala
@@ -587,14 +587,14 @@ private class DConfWindow : BookmarksWindow, AdaptativeWidget
show_default_view ();
}
- protected override void escape_pressed_called () // TODO better?
+ protected override bool escape_pressed ()
{
- if (main_view.in_window_modifications || in_window_about)
+ if (main_view.in_window_modifications)
+ {
show_default_view ();
- else if (headerbar.search_mode_enabled)
- stop_search ();
- else if (current_type == ViewType.CONFIG)
- request_folder (current_path);
+ return true;
+ }
+ return base.escape_pressed ();
}
/*\
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]