Add a Help entry in the menu (to point to the wiki)

This commit is contained in:
Peter Hutterer 2019-07-16 11:28:34 +10:00
parent 6c8d586caa
commit 84273a1c83
2 changed files with 17 additions and 3 deletions

View File

@ -35,7 +35,9 @@ class Application(Gtk.Application):
window.present()
def _build_app_menu(self):
actions = [('about', self._about), ('quit', self._quit)]
actions = [('about', self._about),
('quit', self._quit),
('help', self._help)]
for (name, callback) in actions:
action = Gio.SimpleAction.new(name, None)
action.connect('activate', callback)
@ -52,3 +54,7 @@ class Application(Gtk.Application):
windows = self.get_windows()
for window in windows:
window.destroy()
def _help(self, action, param):
import time
Gtk.show_uri(None, 'https://github.com/tuhiproject/tuhi/wiki', time.time())

View File

@ -29,10 +29,18 @@ MENU_XML = """
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<menu id="primary-menu">
<section>
<item>
<attribute name="label">Help</attribute>
<attribute name="action">app.help</attribute>
</item>
</section>
<section>
<item>
<attribute name="label">About</attribute>
<attribute name="action">app.about</attribute>
</item>
</section>
</menu>
</interface>
"""