From a56d506ff56f79bbea0bbaf8861dc48d7cf77f79 Mon Sep 17 00:00:00 2001 From: rbuj Date: Mon, 18 Feb 2019 15:08:21 +0100 Subject: Read authors (updated) from pluma.about file --- pluma/Makefile.am | 7 +++++++ pluma/pluma-commands-help.c | 36 +++++++++++++++++++++++------------- pluma/pluma-dirs.c | 2 +- pluma/pluma.about | 2 ++ 4 files changed, 33 insertions(+), 14 deletions(-) create mode 100644 pluma/pluma.about diff --git a/pluma/Makefile.am b/pluma/Makefile.am index 63b91b8e..3baa21a0 100644 --- a/pluma/Makefile.am +++ b/pluma/Makefile.am @@ -13,6 +13,7 @@ AM_CPPFLAGS = \ $(WARN_CFLAGS) \ $(INTROSPECTION_CFLAGS) \ -DDATADIR=\""$(datadir)"\" \ + -DPLUMA_DATADIR=\""$(datadir)/pluma"\" \ -DLIBDIR=\""$(libdir)"\" pluma_SOURCES = \ @@ -172,6 +173,11 @@ pluma-marshal.c: pluma-marshal.list $(GLIB_GENMARSHAL) $(AM_V_GEN) echo "#include \"pluma-marshal.h\"" > $@ && \ $(GLIB_GENMARSHAL) $< --body --prefix=pluma_marshal >> $@ +aboutdir = $(datadir)/pluma/ +about_DATA = \ + pluma.about \ + $(NULL) + uidir = $(datadir)/pluma/ui/ ui_DATA = \ pluma-ui.xml \ @@ -179,6 +185,7 @@ ui_DATA = \ EXTRA_DIST = \ $(ui_DATA) \ + $(about_DATA) \ pluma-enum-types.h.template \ pluma-enum-types.c.template \ pluma-marshal.list \ diff --git a/pluma/pluma-commands-help.c b/pluma/pluma-commands-help.c index a04a5daa..93205704 100644 --- a/pluma/pluma-commands-help.c +++ b/pluma/pluma-commands-help.c @@ -35,6 +35,7 @@ #include #endif +#include #include #include @@ -50,21 +51,11 @@ void _pluma_cmd_help_contents(GtkAction* action, PlumaWindow* window) pluma_help_display(GTK_WINDOW(window), NULL, NULL); } +#define ABOUT_GROUP "About" +#define EMAILIFY(string) (g_strdelimit ((string), "%", '@')) + void _pluma_cmd_help_about(GtkAction* action, PlumaWindow* window) { - static const gchar* const authors[] = { - "Paolo Maggi ", - "Paolo Borelli ", - "Steve Fr\303\251cinaux ", - "Jesse van den Kieboom ", - "Ignacio Casal Quinteiro ", - "James Willcox ", - "Chema Celorio", - "Federico Mena Quintero ", - "Perberos ", - NULL - }; - static const gchar* documenters[] = { N_("MATE Documentation Team"), N_("GNOME Documentation Team"), @@ -90,10 +81,28 @@ void _pluma_cmd_help_about(GtkAction* action, PlumaWindow* window) }; gchar *license_trans; + GKeyFile *key_file; + GError *error = NULL; + char **authors; + gsize n_authors = 0, i; static const gchar **p; pluma_debug (DEBUG_COMMANDS); + key_file = g_key_file_new (); + if (!g_key_file_load_from_file (key_file, PLUMA_DATADIR G_DIR_SEPARATOR_S "pluma.about", 0, &error)) { + g_warning ("Couldn't load about data: %s\n", error->message); + g_error_free (error); + g_key_file_free (key_file); + return; + } + + authors = g_key_file_get_string_list (key_file, ABOUT_GROUP, "Authors", &n_authors, NULL); + g_key_file_free (key_file); + + for (i = 0; i < n_authors; ++i) + authors[i] = EMAILIFY (authors[i]); + license_trans = g_strjoin ("\n\n", _(license[0]), _(license[1]), _(license[2]), NULL); for (p = documenters; *p; ++p) @@ -119,5 +128,6 @@ void _pluma_cmd_help_about(GtkAction* action, PlumaWindow* window) "website", "http://mate-desktop.org", NULL); + g_strfreev (authors); g_free (license_trans); } diff --git a/pluma/pluma-dirs.c b/pluma/pluma-dirs.c index aebf5150..96f46a0b 100644 --- a/pluma/pluma-dirs.c +++ b/pluma/pluma-dirs.c @@ -69,7 +69,7 @@ gchar* pluma_dirs_get_user_accels_file(void) gchar* pluma_dirs_get_pluma_data_dir(void) { - return g_build_filename(DATADIR, "pluma", NULL); + return g_build_filename(PLUMA_DATADIR, NULL); } gchar* pluma_dirs_get_pluma_locale_dir(void) diff --git a/pluma/pluma.about b/pluma/pluma.about new file mode 100644 index 00000000..6e07499a --- /dev/null +++ b/pluma/pluma.about @@ -0,0 +1,2 @@ +[About] +Authors=Adam Erdman ;Alexander van der Meij ;Alexander von Gluck IV ;Andrew Fowlie ;Balló György ;Björn Esser ;Clement Lefebvre ;Daggerbot ;Gabriel Cormier-Affleck ;Ignacio Casal Quinteiro ;John Church ;Marcel Dijkstra ;Martin Wimpress ;OBATA Akio ;Pablo Barciela ;Paolo Borelli ;Patrick Monnerat ;Perberos ;Piotr Drąg ;Robert Buj ;Ryan Q ;Sander Sweers ;Sorokin Alexei ;Stefano Karapetsas ;Steve Zesch ;Sébastien Wilmet ;V.Barkov ;Vadim Barkov ;Vlad Orlov ;Wolfgang Ulbrich ;Wu Xiaotian ;Yaakov Selkowitz ;ZenWalker ; -- cgit v1.2.1