[california] Add Help option to application menu: Bug #732302



commit 2d9acce21134f57b4d9235ac4e4601bcb74d7b39
Author: Jim Nelson <jim yorba org>
Date:   Wed Sep 10 17:56:10 2014 -0700

    Add Help option to application menu: Bug #732302
    
    This introduces the "_Help" string to the .pot in preparation for
    actual Yelp help (coming soon).
    
    This also binds F1 to help.

 src/application/california-application.vala |   12 ++++++++++++
 src/rc/app-menu.interface                   |    5 +++++
 2 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/application/california-application.vala b/src/application/california-application.vala
index c9fcbd5..07590bf 100644
--- a/src/application/california-application.vala
+++ b/src/application/california-application.vala
@@ -36,6 +36,9 @@ public class Application : Gtk.Application {
     public const string DETAILED_ACTION_CALENDAR_MANAGER = "app.calendar-manager";
     public const string ACTION_CALENDAR_MANAGER = "calendar-manager";
     
+    public const string DETAILED_ACTION_HELP = "app.help";
+    public const string ACTION_HELP = "help";
+    
     public const string DETAILED_ACTION_ABOUT = "app.about";
     public const string ACTION_ABOUT = "about";
     
@@ -55,6 +58,7 @@ public class Application : Gtk.Application {
     private static const ActionEntry[] action_entries = {
         // public actions
         { ACTION_CALENDAR_MANAGER, on_calendar_manager },
+        { ACTION_HELP, on_help },
         { ACTION_ABOUT, on_about },
         { ACTION_QUIT, on_quit },
         
@@ -271,6 +275,14 @@ public class Application : Gtk.Application {
         }
     }
     
+    private void on_help() {
+        try {
+            Gtk.show_uri(null, WEBSITE_URL, Gdk.CURRENT_TIME);
+        } catch (Error error) {
+            message("Error opening help URL: %s", error.message);
+        }
+    }
+    
     private void on_about() {
         Gtk.show_about_dialog(main_window,
             "program-name", TITLE,
diff --git a/src/rc/app-menu.interface b/src/rc/app-menu.interface
index 564080b..cdb9b0a 100644
--- a/src/rc/app-menu.interface
+++ b/src/rc/app-menu.interface
@@ -10,6 +10,11 @@
         </section>
         <section>
             <item>
+                <attribute name="label" translatable="yes">_Help</attribute>
+                <attribute name="action">app.help</attribute>
+                <attribute name="accel">F1</attribute>
+            </item>
+            <item>
                 <attribute name="label" translatable="yes">_About</attribute>
                 <attribute name="action">app.about</attribute>
             </item>


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