[recipes] Add a quick help menu item
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [recipes] Add a quick help menu item
- Date: Fri, 17 Mar 2017 23:28:04 +0000 (UTC)
commit c73c3764c6bd958496dcd11c3ca1a52d99d0539c
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Mar 16 14:08:07 2017 -0400
Add a quick help menu item
This uses g_app_info_launch_uris, which turns out
to work ok inside a sandbox that has yelp in it.
We avoid the launch-default API, since that will
always go via the portal, and we need to avoid
the portal here.
src/gr-app.c | 15 +++++++++++++++
src/menus.ui | 12 ++++++++----
2 files changed, 23 insertions(+), 4 deletions(-)
---
diff --git a/src/gr-app.c b/src/gr-app.c
index 320c492..966e6f5 100644
--- a/src/gr-app.c
+++ b/src/gr-app.c
@@ -206,6 +206,20 @@ report_issue_activated (GSimpleAction *action,
}
static void
+help_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer app)
+{
+ GList uris = { "help:org.gnome.Recipes", NULL, NULL };
+ g_autoptr(GAppInfo) info = NULL;
+ g_autoptr(GError) error = NULL;
+
+ info = g_app_info_get_default_for_uri_scheme ("help");
+ if (!g_app_info_launch_uris (info, &uris, NULL, &error))
+ g_warning ("Failed to launch %s: %s", g_app_info_get_name (info), error->message);
+}
+
+static void
verbose_logging_activated (GSimpleAction *action,
GVariant *parameter,
gpointer application)
@@ -228,6 +242,7 @@ static GActionEntry app_entries[] =
{ "search", search_activated, "s", NULL, NULL },
{ "quit", quit_activated, NULL, NULL, NULL },
{ "report-issue", report_issue_activated, NULL, NULL, NULL },
+ { "help", help_activated, NULL, NULL, NULL },
{ "verbose-logging", verbose_logging_activated, "b", NULL, NULL }
};
diff --git a/src/menus.ui b/src/menus.ui
index 702faa1..91ebf3d 100644
--- a/src/menus.ui
+++ b/src/menus.ui
@@ -19,14 +19,18 @@
</section>
<section>
<item>
- <attribute name="label" translatable="yes">_About</attribute>
- <attribute name="action">app.about</attribute>
- </item>
- <item>
<attribute name="label" translatable="yes">_What’s New</attribute>
<attribute name="action">app.news</attribute>
</item>
<item>
+ <attribute name="label" translatable="yes">_Help</attribute>
+ <attribute name="action">app.help</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">_About</attribute>
+ <attribute name="action">app.about</attribute>
+ </item>
+ <item>
<attribute name="label" translatable="yes">_Report Issue</attribute>
<attribute name="action">app.report-issue</attribute>
</item>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]