[gnome-latex] LatexilaApp: implement "about" action
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-latex] LatexilaApp: implement "about" action
- Date: Tue, 28 Apr 2020 15:17:47 +0000 (UTC)
commit 2c665657e76997e245e67a9e97b6076e06fd324c
Author: Sébastien Wilmet <swilmet gnome org>
Date: Tue Apr 28 16:44:24 2020 +0200
LatexilaApp: implement "about" action
src/glatex_app.vala | 40 ------------------------
src/liblatexila/latexila-app.c | 70 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 70 insertions(+), 40 deletions(-)
---
diff --git a/src/glatex_app.vala b/src/glatex_app.vala
index f42d0c8..d75fd5a 100644
--- a/src/glatex_app.vala
+++ b/src/glatex_app.vala
@@ -29,7 +29,6 @@ public class GlatexApp : Latexila.App
{ "preferences", preferences_cb },
{ "manage-build-tools", manage_build_tools_cb },
{ "help", help_cb },
- { "about", about_cb },
{ "quit", quit_cb }
};
@@ -189,45 +188,6 @@ public class GlatexApp : Latexila.App
}
}
- private void about_cb ()
- {
- string comments =
- _("GNOME LaTeX is a LaTeX editor for the GNOME desktop");
- string copyright = "Copyright 2009-2020 – Sébastien Wilmet";
-
- string website = "https://wiki.gnome.org/Apps/GNOME-LaTeX";
-
- 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
- };
-
- Gtk.show_about_dialog (get_active_main_window (),
- "program-name", Config.PACKAGE_NAME,
- "version", Config.PACKAGE_VERSION,
- "authors", authors,
- "artists", artists,
- "comments", comments,
- "copyright", copyright,
- "license-type", Gtk.License.GPL_3_0,
- "title", _("About GNOME LaTeX"),
- "translator-credits", _("translator-credits"),
- "website", website,
- "logo-icon-name", "gnome-latex"
- );
- }
-
private void quit_cb ()
{
hold ();
diff --git a/src/liblatexila/latexila-app.c b/src/liblatexila/latexila-app.c
index d44c30e..3a5fb2b 100644
--- a/src/liblatexila/latexila-app.c
+++ b/src/liblatexila/latexila-app.c
@@ -17,7 +17,10 @@
* along with GNOME LaTeX. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "config.h"
#include "latexila-app.h"
+#include <glib/gi18n.h>
+#include <tepl/tepl.h>
/**
* SECTION:app
@@ -27,9 +30,76 @@
G_DEFINE_TYPE (LatexilaApp, latexila_app, GTK_TYPE_APPLICATION)
+static void
+about_activate_cb (GSimpleAction *about_action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ LatexilaApp *app = LATEXILA_APP (user_data);
+ TeplApplication *tepl_app = tepl_application_get_from_gtk_application (GTK_APPLICATION (app));
+ GtkApplicationWindow *active_main_window;
+
+ const gchar *authors[] = {
+ "Sébastien Wilmet <swilmet gnome org>",
+ NULL
+ };
+
+ const gchar *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
+ };
+
+ active_main_window = tepl_application_get_active_main_window (tepl_app);
+
+ gtk_show_about_dialog (GTK_WINDOW (active_main_window),
+ "version", PACKAGE_VERSION,
+ "authors", authors,
+ "artists", artists,
+ "comments", _("GNOME LaTeX is a LaTeX editor for the GNOME desktop"),
+ "copyright", "Copyright 2009-2020 – Sébastien Wilmet",
+ "license-type", GTK_LICENSE_GPL_3_0,
+ "title", _("About GNOME LaTeX"),
+ "translator-credits", _("translator-credits"),
+ "website", "https://wiki.gnome.org/Apps/GNOME-LaTeX",
+ "logo-icon-name", "gnome-latex",
+ NULL);
+}
+
+static void
+add_action_entries (LatexilaApp *app)
+{
+ const GActionEntry app_entries[] =
+ {
+ { "about", about_activate_cb },
+ };
+
+ amtk_action_map_add_action_entries_check_dups (G_ACTION_MAP (app),
+ app_entries,
+ G_N_ELEMENTS (app_entries),
+ app);
+}
+
+static void
+latexila_app_startup (GApplication *app)
+{
+ if (G_APPLICATION_CLASS (latexila_app_parent_class)->startup != NULL)
+ {
+ G_APPLICATION_CLASS (latexila_app_parent_class)->startup (app);
+ }
+
+ add_action_entries (LATEXILA_APP (app));
+}
+
static void
latexila_app_class_init (LatexilaAppClass *klass)
{
+ GApplicationClass *gapp_class = G_APPLICATION_CLASS (klass);
+
+ gapp_class->startup = latexila_app_startup;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]