[gnome-builder/wip/afranke/userdoc: 4/5] Hook help into the UI



commit 0ce2d55eaaeaed5463570f4ed564901468240de5
Author: Alexandre Franke <alexandre franke gmail com>
Date:   Wed Jan 27 21:53:30 2016 +0100

    Hook help into the UI

 data/gtk/menus.ui                |    4 ++++
 libide/ide-application-actions.c |   27 +++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 0 deletions(-)
---
diff --git a/data/gtk/menus.ui b/data/gtk/menus.ui
index d380096..5d7d1f7 100644
--- a/data/gtk/menus.ui
+++ b/data/gtk/menus.ui
@@ -27,6 +27,10 @@
         <attribute name="action">app.shortcuts</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>
diff --git a/libide/ide-application-actions.c b/libide/ide-application-actions.c
index 4d8a052..5dc7ff8 100644
--- a/libide/ide-application-actions.c
+++ b/libide/ide-application-actions.c
@@ -134,6 +134,32 @@ ide_application_actions_about (GSimpleAction *action,
 }
 
 static void
+ide_application_actions_help (GSimpleAction *action,
+                              GVariant      *param,
+                              gpointer       user_data)
+{
+  IdeApplication *self = user_data;
+  GtkWindow *focused_window= NULL;
+  GdkScreen *screen = NULL;
+  GError *err = NULL;
+
+  g_assert (IDE_IS_APPLICATION (self));
+
+  focused_window = gtk_application_get_active_window (GTK_APPLICATION (self));
+
+  screen = gtk_window_get_screen (focused_window);
+  gtk_show_uri (screen,
+                "help:gnome-builder",
+                gtk_get_current_event_time (),
+                &err);
+  if (err)
+    {
+      g_message ("Unable to open help: %s\n", err->message);
+      g_error_free (err);
+    }
+}
+
+static void
 ide_application_actions_open_project (GSimpleAction *action,
                                       GVariant      *variant,
                                       gpointer       user_data)
@@ -261,6 +287,7 @@ static const GActionEntry IdeApplicationActions[] = {
   { "preferences",  ide_application_actions_preferences },
   { "quit",         ide_application_actions_quit },
   { "shortcuts",    ide_application_actions_shortcuts },
+  { "help",         ide_application_actions_help },
 };
 
 void


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