1 /*
2  * pluma-help-commands.c
3  * This file is part of pluma
4  *
5  * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
6  * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi
7  * Copyright (C) 2002-2005 Paolo Maggi
8  * Copyright (C) 2011 Perberos
9  * Copyright (C) 2012-2021 MATE Developers
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin St, Fifth Floor,
24  * Boston, MA 02110-1301, USA.
25  */
26 
27 /*
28  * Modified by the gedit Team, 1998-2005. See the AUTHORS file for a
29  * list of people on the pluma Team.
30  * See the ChangeLog files for a list of changes.
31  *
32  * $Id$
33  */
34 
35 #ifdef HAVE_CONFIG_H
36 #include <config.h>
37 #endif
38 
39 #include <glib.h>
40 #include <glib/gi18n.h>
41 #include <gtk/gtk.h>
42 
43 #include "pluma-commands.h"
44 #include "pluma-debug.h"
45 #include "pluma-help.h"
46 #include "pluma-dirs.h"
47 
_pluma_cmd_help_contents(GtkAction * action,PlumaWindow * window)48 void _pluma_cmd_help_contents(GtkAction* action, PlumaWindow* window)
49 {
50 	pluma_debug(DEBUG_COMMANDS);
51 
52 	pluma_help_display(GTK_WINDOW(window), NULL, NULL);
53 }
54 
55 #define ABOUT_GROUP "About"
56 #define EMAILIFY(string) (g_strdelimit ((string), "%", '@'))
57 
_pluma_cmd_help_about(GtkAction * action,PlumaWindow * window)58 void _pluma_cmd_help_about(GtkAction* action, PlumaWindow* window)
59 {
60 	static const gchar* documenters[] = {
61 		N_("MATE Documentation Team"),
62 		N_("GNOME Documentation Team"),
63 		N_("Sun Microsystems"),
64 		NULL
65 	};
66 
67 	static const gchar comments[] = \
68 		N_("Pluma is a small and lightweight text editor for the MATE Desktop Environment.");
69 
70 	static const gchar *license[] ={
71 		N_("Pluma is free software; you can redistribute it and/or modify "
72 		"it under the terms of the GNU General Public License as published by "
73 		"the Free Software Foundation; either version 2 of the License, or "
74 		"(at your option) any later version."),
75 		N_("Pluma is distributed in the hope that it will be useful, "
76 		"but WITHOUT ANY WARRANTY; without even the implied warranty of "
77 		"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the "
78 		"GNU General Public License for more details."),
79 		N_("You should have received a copy of the GNU General Public License "
80 		"along with Pluma; if not, write to the Free Software Foundation, Inc., "
81 		"51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA")
82 	};
83 
84 	gchar *license_trans;
85 	GKeyFile *key_file;
86 	GError *error = NULL;
87 	char **authors;
88 	gsize n_authors = 0, i;
89 	static const gchar **p;
90 
91 	pluma_debug (DEBUG_COMMANDS);
92 
93 	key_file = g_key_file_new ();
94 	if (!g_key_file_load_from_file (key_file, PLUMA_DATADIR G_DIR_SEPARATOR_S "pluma.about", 0, &error)) {
95 		g_warning ("Couldn't load about data: %s\n", error->message);
96 		g_error_free (error);
97 		g_key_file_free (key_file);
98 		return;
99 	}
100 
101 	authors = g_key_file_get_string_list (key_file, ABOUT_GROUP, "Authors", &n_authors, NULL);
102 	g_key_file_free (key_file);
103 
104 	for (i = 0; i < n_authors; ++i)
105 		authors[i] = EMAILIFY (authors[i]);
106 
107 	license_trans = g_strjoin ("\n\n", _(license[0]), _(license[1]), _(license[2]), NULL);
108 
109 	for (p = documenters; *p; ++p)
110 		*p = _(*p);
111 
112 	gtk_show_about_dialog(GTK_WINDOW(window),
113 		"program-name", "Pluma",
114 		"title", _("About Pluma"),
115 		"authors", authors,
116 		"comments", _(comments),
117 		"copyright", _("Copyright \xc2\xa9 1998-2000 Evan Lawrence, Alex Robert\n"
118 		               "Copyright \xc2\xa9 2000-2002 Chema Celorio, Paolo Maggi\n"
119 		               "Copyright \xc2\xa9 2003-2006 Paolo Maggi\n"
120 		               "Copyright \xc2\xa9 2004-2010 Paolo Borelli, Jesse van den Kieboom\nSteve Fr\303\251cinaux, Ignacio Casal Quinteiro\n"
121 		               "Copyright \xc2\xa9 2011 Perberos\n"
122 		               "Copyright \xc2\xa9 2012-2021 MATE developers"),
123 		"license", license_trans,
124 		"wrap-license", TRUE,
125 		"documenters", documenters,
126 		"logo_icon_name", "accessories-text-editor",
127 		"translator-credits", _("translator-credits"),
128 		"version", VERSION,
129 		"website", PACKAGE_URL,
130 		NULL);
131 
132 	g_strfreev (authors);
133 	g_free (license_trans);
134 }
135