[latexila/wip/app-menu] app: implement the app.help action



commit 6912702cb47ca0eb643f77f94393f096a6e94fef
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Fri Dec 18 15:17:10 2015 +0100

    app: implement the app.help action

 src/latexila_app.vala |   21 +++++++++++++++++++++
 src/main_window.vala  |    9 +--------
 2 files changed, 22 insertions(+), 8 deletions(-)
---
diff --git a/src/latexila_app.vala b/src/latexila_app.vala
index 00633e8..f7bdb59 100644
--- a/src/latexila_app.vala
+++ b/src/latexila_app.vala
@@ -132,6 +132,27 @@ public class LatexilaApp : Gtk.Application
             new BuildToolsPreferences (this.active_window);
             release ();
         });
+
+        /* Help */
+        SimpleAction help_action = new SimpleAction ("help", null);
+        add_action (help_action);
+
+        help_action.activate.connect (() =>
+        {
+            hold ();
+
+            try
+            {
+                Gtk.show_uri (this.active_window.get_screen (), "help:latexila",
+                    Gdk.CURRENT_TIME);
+            }
+            catch (Error e)
+            {
+                warning ("Impossible to open the documentation: %s", e.message);
+            }
+
+            release ();
+        });
     }
 
     public static LatexilaApp get_instance ()
diff --git a/src/main_window.vala b/src/main_window.vala
index 9d70b0d..da6abf3 100644
--- a/src/main_window.vala
+++ b/src/main_window.vala
@@ -1132,14 +1132,7 @@ public class MainWindow : ApplicationWindow
 
     public void on_help_contents ()
     {
-        try
-        {
-            show_uri (this.get_screen (), "help:latexila", Gdk.CURRENT_TIME);
-        }
-        catch (Error e)
-        {
-            warning ("Impossible to open the documentation: %s", e.message);
-        }
+        LatexilaApp.get_instance ().activate_action ("help", null);
     }
 
     public void on_help_latex_reference ()


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