[dconf-editor] Add non-used help functionality.



commit b6199ce6a0f40885b505db3354885149879c81cc
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Sun Jan 13 06:00:51 2019 +0100

    Add non-used help functionality.
    
    Some applications might want to have the usual help
    functionality, with an entry in the hamburger menu.
    Add that, even if that is not used by Dconf Editor.

 editor/base-headerbar.vala  | 15 +++++++++++++--
 editor/dconf-headerbar.vala |  1 +
 2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/editor/base-headerbar.vala b/editor/base-headerbar.vala
index ea8ce5b..e533218 100644
--- a/editor/base-headerbar.vala
+++ b/editor/base-headerbar.vala
@@ -69,6 +69,7 @@ private class BaseHeaderBar : NightTimeAwareHeaderBar, AdaptativeWidget
     \*/
 
     [CCode (notify = false)] public string about_action_label     { private get; protected construct; } // 
TODO add default = _("About");
+    [CCode (notify = false)] public bool   has_help               { private get; protected construct; 
default = false; }
     [CCode (notify = false)] public bool   has_keyboard_shortcuts { private get; protected construct; 
default = false; }
 
     protected override void update_hamburger_menu ()
@@ -92,11 +93,12 @@ private class BaseHeaderBar : NightTimeAwareHeaderBar, AdaptativeWidget
 
     protected virtual void populate_menu (ref GLib.Menu menu) {}
 
-    private void append_app_actions_section (ref GLib.Menu menu)
+    private void append_app_actions_section (ref GLib.Menu menu)    // FIXME mnemonics?
     {
         GLib.Menu section = new GLib.Menu ();
         append_or_not_night_mode_entry (ref section);
         append_or_not_keyboard_shortcuts_entry (has_keyboard_shortcuts, !has_a_phone_size, ref section);
+        append_or_not_help_entry (has_help, ref section);
         append_about_entry (about_action_label, ref section);
         section.freeze ();
         menu.append_section (null, section);
@@ -111,7 +113,16 @@ private class BaseHeaderBar : NightTimeAwareHeaderBar, AdaptativeWidget
             return;
 
         /* Translators: usual menu entry of the hamburger menu*/
-        section.append (_("Keyboard Shortcuts"), "win.show-help-overlay");
+        section.append (_("Keyboard Shortcuts"), "win.show-help-overlay");  // TODO mnemonic?
+    }
+
+    private static inline void append_or_not_help_entry (bool has_help, ref GLib.Menu section)
+    {
+        if (!has_help)
+            return;
+
+        /* Translators: usual menu entry of the hamburger menu (with a mnemonic that appears pressing Alt) */
+     // section.append (_("_Help"), "app.help");    // FIXME uncomment, and choose mnemonic or not
     }
 
     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 e0c84e8..93cdace 100644
--- a/editor/dconf-headerbar.vala
+++ b/editor/dconf-headerbar.vala
@@ -49,6 +49,7 @@ private class DConfHeaderBar : BookmarksHeaderBar, AdaptativeWidget
         /* Translators: usual menu entry of the hamburger menu */
         Object (about_action_label:     _("About Dconf Editor"),
                 night_light_monitor:    _night_light_monitor,
+                has_help:               false,
                 has_keyboard_shortcuts: true);
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]