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



commit f5ae64559bdd64b50e7fd98792c15143efdab4f7
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Fri Dec 18 15:27:34 2015 +0100

    app: implement the app.about action

 src/latexila_app.vala |   59 ++++++++++++++++++++++++++++++++++++++++++++++++-
 src/main_window.vala  |   48 +--------------------------------------
 2 files changed, 60 insertions(+), 47 deletions(-)
---
diff --git a/src/latexila_app.vala b/src/latexila_app.vala
index 8990d4f..ee33e01 100644
--- a/src/latexila_app.vala
+++ b/src/latexila_app.vala
@@ -1,7 +1,7 @@
 /*
  * This file is part of LaTeXila.
  *
- * Copyright © 2010-2012 Sébastien Wilmet
+ * Copyright © 2010-2015 Sébastien Wilmet
  *
  * LaTeXila is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -164,6 +164,63 @@ public class LatexilaApp : Gtk.Application
             Finance.show_dialog (this.active_window, false);
             release ();
         });
+
+        /* About */
+        SimpleAction about_action = new SimpleAction ("about", null);
+        add_action (about_action);
+
+        about_action.activate.connect (() =>
+        {
+            hold ();
+
+            string comments =
+                _("LaTeXila is an Integrated LaTeX Environment for the GNOME Desktop");
+            string copyright = "Copyright © 2009-2015 – Sébastien Wilmet";
+
+            string website = "https://wiki.gnome.org/Apps/LaTeXila";;
+
+            string[] authors =
+            {
+                "Sébastien Wilmet <swilmet gnome org>",
+                null
+            };
+
+            string[] artists =
+            {
+                "Eric Forgeot <e forgeot laposte net>",
+                "Sébastien Wilmet <swilmet gnome org>",
+                "Alexander Wilms <f alexander wilms gmail com>",
+                "The Kile Team http://kile.sourceforge.net/";,
+                "Gedit LaTeX Plugin https://wiki.gnome.org/Apps/Gedit/LaTeXPlugin";,
+                null
+            };
+
+            Gdk.Pixbuf logo = null;
+            try
+            {
+                logo = new Gdk.Pixbuf.from_file (Config.DATA_DIR + "/images/app/logo.png");
+            }
+            catch (Error e)
+            {
+                warning ("Logo: %s", e.message);
+            }
+
+            Gtk.show_about_dialog (this.active_window,
+                "program-name", "LaTeXila",
+                "version", Config.PACKAGE_VERSION,
+                "authors", authors,
+                "artists", artists,
+                "comments", comments,
+                "copyright", copyright,
+                "license-type", Gtk.License.GPL_3_0,
+                "title", _("About LaTeXila"),
+                "translator-credits", _("translator-credits"),
+                "website", website,
+                "logo", logo
+            );
+
+            release ();
+        });
     }
 
     public static LatexilaApp get_instance ()
diff --git a/src/main_window.vala b/src/main_window.vala
index 1b57106..1192391 100644
--- a/src/main_window.vala
+++ b/src/main_window.vala
@@ -1,7 +1,7 @@
 /*
  * This file is part of LaTeXila.
  *
- * Copyright © 2010-2012 Sébastien Wilmet
+ * Copyright © 2010-2015 Sébastien Wilmet
  *
  * LaTeXila is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -1156,50 +1156,6 @@ public class MainWindow : ApplicationWindow
 
     public void on_about_dialog ()
     {
-        string comments =
-            _("LaTeXila is an Integrated LaTeX Environment for the GNOME Desktop");
-        string copyright = "Copyright © 2009-2015 – Sébastien Wilmet";
-
-        string website = "https://wiki.gnome.org/Apps/LaTeXila";;
-
-        string[] authors =
-        {
-            "Sébastien Wilmet <swilmet gnome org>",
-            null
-        };
-
-        string[] artists =
-        {
-            "Eric Forgeot <e forgeot laposte net>",
-            "Sébastien Wilmet <swilmet gnome org>",
-            "Alexander Wilms <f alexander wilms gmail com>",
-            "The Kile Team http://kile.sourceforge.net/";,
-            "Gedit LaTeX Plugin https://wiki.gnome.org/Apps/Gedit/LaTeXPlugin";,
-            null
-        };
-
-        Gdk.Pixbuf logo = null;
-        try
-        {
-            logo = new Gdk.Pixbuf.from_file (Config.DATA_DIR + "/images/app/logo.png");
-        }
-        catch (Error e)
-        {
-            warning ("Logo: %s", e.message);
-        }
-
-        show_about_dialog (this,
-            "program-name", "LaTeXila",
-            "version", Config.PACKAGE_VERSION,
-            "authors", authors,
-            "artists", artists,
-            "comments", comments,
-            "copyright", copyright,
-            "license-type", License.GPL_3_0,
-            "title", _("About LaTeXila"),
-            "translator-credits", _("translator-credits"),
-            "website", website,
-            "logo", logo
-        );
+        LatexilaApp.get_instance ().activate_action ("about", null);
     }
 }


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