[gnome-games/wip/aplazas/app-menu] ui: Add Help to the application menu
- From: Adrien Plazas <aplazas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/aplazas/app-menu] ui: Add Help to the application menu
- Date: Sat, 23 Jun 2018 07:56:19 +0000 (UTC)
commit 7caa818e2872431c1af488a8e3e0afebb45a580b
Author: Adrien Plazas <kekun plazas laposte net>
Date: Sat Jun 23 09:54:37 2018 +0200
ui: Add Help to the application menu
This will open the application's documentation page as we don't have
offline documentation.
data/ui/collection-header-bar.ui | 8 ++++++++
src/ui/application.vala | 15 +++++++++++++++
2 files changed, 23 insertions(+)
---
diff --git a/data/ui/collection-header-bar.ui b/data/ui/collection-header-bar.ui
index 1696897..76cf147 100644
--- a/data/ui/collection-header-bar.ui
+++ b/data/ui/collection-header-bar.ui
@@ -104,6 +104,14 @@
<property name="visible">True</property>
</object>
</child>
+ <child>
+ <object class="GtkModelButton">
+ <property name="can_focus">True</property>
+ <property name="text" translatable="yes">Help</property>
+ <property name="action-name">app.help</property>
+ <property name="visible">True</property>
+ </object>
+ </child>
<child>
<object class="GtkModelButton">
<property name="can_focus">True</property>
diff --git a/src/ui/application.vala b/src/ui/application.vala
index 5f562d4..d21bb7d 100644
--- a/src/ui/application.vala
+++ b/src/ui/application.vala
@@ -3,6 +3,8 @@
private extern const string VERSION;
public class Games.Application : Gtk.Application {
+ const string HELP_URI = "https://wiki.gnome.org/Apps/Games/Documentation";
+
private Database database;
private PreferencesWindow preferences_window;
@@ -40,6 +42,10 @@ public class Games.Application : Gtk.Application {
preferences_action.activate.connect (preferences);
add_action (preferences_action);
+ SimpleAction help_action = new SimpleAction ("help", null);
+ help_action.activate.connect (help);
+ add_action (help_action);
+
SimpleAction about_action = new SimpleAction ("about", null);
about_action.activate.connect (about);
add_action (about_action);
@@ -310,6 +316,15 @@ public class Games.Application : Gtk.Application {
});
}
+ private void help () {
+ try {
+ Gtk.show_uri_on_window (active_window, HELP_URI, Gtk.get_current_event_time ());
+ }
+ catch (Error e) {
+ critical (e.message);
+ }
+ }
+
private void about () {
Gtk.AboutDialog dialog = new Gtk.AboutDialog ();
dialog.set_destroy_with_parent (true);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]