[gnome-logs] Add help item to application menu



commit f180685fdbce554ccec5c6fb13bf8b1e2b21e88f
Author: David King <davidk gnome org>
Date:   Tue Feb 18 08:51:56 2014 +0000

    Add help item to application menu

 data/appmenu.ui      |    4 ++++
 src/gl-application.c |   24 ++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/data/appmenu.ui b/data/appmenu.ui
index 49602b8..29530c0 100644
--- a/data/appmenu.ui
+++ b/data/appmenu.ui
@@ -9,6 +9,10 @@
         </section>
         <section>
             <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>
diff --git a/src/gl-application.c b/src/gl-application.c
index 760be33..3d08e14 100644
--- a/src/gl-application.c
+++ b/src/gl-application.c
@@ -53,6 +53,29 @@ on_new_window (GSimpleAction *action,
 }
 
 static void
+on_help (GSimpleAction *action,
+         GVariant *parameter,
+         gpointer user_data)
+{
+    GtkApplication *application;
+    GtkWindow *parent;
+    GError *error = NULL;
+
+    application = GTK_APPLICATION (user_data);
+    parent = gtk_application_get_active_window (application);
+
+    /* TODO: Add link to application help instead. */
+    gtk_show_uri (gtk_window_get_screen (parent), PACKAGE_URL,
+                  GDK_CURRENT_TIME, &error);
+
+    if (error)
+    {
+        g_debug ("Error while opening help: %s", error->message);
+        g_error_free (error);
+    }
+}
+
+static void
 on_about (GSimpleAction *action,
           GVariant *parameter,
           gpointer user_data)
@@ -135,6 +158,7 @@ on_monospace_font_name_changed (GSettings *settings,
 
 static GActionEntry actions[] = {
     { "new-window", on_new_window },
+    { "help", on_help },
     { "about", on_about },
     { "quit", on_quit }
 };


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