[dconf-editor] Allow disabling keyboard shortcuts.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf-editor] Allow disabling keyboard shortcuts.
- Date: Fri, 11 Jan 2019 13:01:19 +0000 (UTC)
commit 1c2377446ffdfcf2646cb963ec1af09b96c0c3f6
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Thu Jan 10 14:45:25 2019 +0100
Allow disabling keyboard shortcuts.
The BaseHeaderBar class can be used as a library for many
things, do not force having a help overlay for shortcuts.
editor/base-headerbar.vala | 20 +++++++++++---------
editor/dconf-headerbar.vala | 4 +++-
2 files changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/editor/base-headerbar.vala b/editor/base-headerbar.vala
index 4340e5b..4932940 100644
--- a/editor/base-headerbar.vala
+++ b/editor/base-headerbar.vala
@@ -66,7 +66,8 @@ private class BaseHeaderBar : NightTimeAwareHeaderBar, AdaptativeWidget
* * hamburger menu
\*/
- [CCode (notify = false)] public string about_action_label { private get; protected construct; } // TODO
add default = _("About");
+ [CCode (notify = false)] public string about_action_label { private get; protected construct; } //
TODO add default = _("About");
+ [CCode (notify = false)] public bool has_keyboard_shortcuts { private get; protected construct;
default = false; }
protected override void update_hamburger_menu ()
{
@@ -93,21 +94,22 @@ private class BaseHeaderBar : NightTimeAwareHeaderBar, AdaptativeWidget
{
GLib.Menu section = new GLib.Menu ();
append_or_not_night_mode_entry (ref section);
- append_or_not_keyboard_shortcuts_entry (!disable_popovers, ref section);
+ append_or_not_keyboard_shortcuts_entry (has_keyboard_shortcuts, !disable_popovers, ref section);
append_about_entry (about_action_label, ref section);
section.freeze ();
menu.append_section (null, section);
}
- private static inline void append_or_not_keyboard_shortcuts_entry (bool has_keyboard_shortcuts, ref
GLib.Menu section)
+ private static inline void append_or_not_keyboard_shortcuts_entry (bool has_keyboard_shortcuts,
+ bool show_keyboard_shortcuts,
+ ref GLib.Menu section)
{
- // FIXME is used also for hiding keyboard shortcuts in small window
- if (has_keyboard_shortcuts)
- {
+ // TODO something in small windows
+ if (!has_keyboard_shortcuts || !show_keyboard_shortcuts)
+ return;
- /* Translators: usual menu entry of the hamburger menu*/
- section.append (_("Keyboard Shortcuts"), "win.show-help-overlay");
- }
+ /* Translators: usual menu entry of the hamburger menu*/
+ section.append (_("Keyboard Shortcuts"), "win.show-help-overlay");
}
private static inline void append_about_entry (string about_action_label, ref GLib.Menu section)
diff --git a/editor/dconf-headerbar.vala b/editor/dconf-headerbar.vala
index 5dca7e0..8ebe0f3 100644
--- a/editor/dconf-headerbar.vala
+++ b/editor/dconf-headerbar.vala
@@ -47,7 +47,9 @@ private class DConfHeaderBar : BookmarksHeaderBar, AdaptativeWidget
internal static DConfHeaderBar (NightLightMonitor _night_light_monitor)
{
/* Translators: usual menu entry of the hamburger menu */
- Object (night_light_monitor: _night_light_monitor, about_action_label: _("About Dconf Editor"));
+ Object (night_light_monitor: _night_light_monitor,
+ about_action_label: _("About Dconf Editor"),
+ has_keyboard_shortcuts: true);
}
private bool is_folder_view = true;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]