summaryrefslogtreecommitdiffstats
path: root/gedit/gedit-commands-help.c
blob: 6a5d12e2ec065b49a7237b2d068fcf966e23c9e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
/*
 * gedit-help-commands.c
 * This file is part of gedit
 *
 * Copyright (C) 1998, 1999 Alex Roberts, Evan Lawrence
 * Copyright (C) 2000, 2001 Chema Celorio, Paolo Maggi
 * Copyright (C) 2002-2005 Paolo Maggi
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, see <http://www.gnu.org/licenses/>.
 */

#include "config.h"

#include "gedit-commands.h"
#include "gedit-commands-private.h"

#include <glib/gi18n.h>
#include <gtk/gtk.h>

#include "gedit-debug.h"
#include "gedit-app.h"
#include "gedit-dirs.h"

void
_gedit_cmd_help_keyboard_shortcuts (GeditWindow *window)
{
	static GtkWidget *shortcuts_window;

	gedit_debug (DEBUG_COMMANDS);

	if (shortcuts_window == NULL)
	{
		GtkBuilder *builder;

		builder = gtk_builder_new_from_resource ("/org/gnome/gedit/ui/gedit-shortcuts.ui");
		shortcuts_window = GTK_WIDGET (gtk_builder_get_object (builder, "shortcuts-gedit"));

		g_signal_connect (shortcuts_window,
				  "destroy",
				  G_CALLBACK (gtk_widget_destroyed),
				  &shortcuts_window);

		g_object_unref (builder);
	}

	if (GTK_WINDOW (window) != gtk_window_get_transient_for (GTK_WINDOW (shortcuts_window)))
	{
		gtk_window_set_transient_for (GTK_WINDOW (shortcuts_window), GTK_WINDOW (window));
	}

	gtk_widget_show_all (shortcuts_window);
	gtk_window_present (GTK_WINDOW (shortcuts_window));
}

void
_gedit_cmd_help_contents (GeditWindow *window)
{
	gedit_debug (DEBUG_COMMANDS);

	gedit_app_show_help (GEDIT_APP (g_application_get_default ()),
	                     GTK_WINDOW (window),
	                     NULL,
	                     NULL);
}

void
_gedit_cmd_help_about (GeditWindow *window)
{
	const gchar * const authors[] = {
		/* Main authors: the top 5 (to not have a too long list), by
		 * relative contribution (number of commits at the time of
		 * writing).
		 */
		_("Main authors:"),
		"   Paolo Borelli",
		"   Sébastien Wilmet",
		"   Ignacio Casal Quinteiro",
		"   Jesse van den Kieboom",
		"   Paolo Maggi",
		"",
		_("Many thanks also to:"),
		"   Alex Roberts",
		"   Chema Celorio",
		"   Evan Lawrence",
		"   Federico Mena Quintero",
		"   Garrett Regier",
		"   James Willcox",
		"   Sébastien Lafargue",
		"   Steve Frécinaux",
		"",
		_("and many other contributors."),
		"",
		NULL
	};

	static const gchar * const documenters[] = {
		"Daniel Neel",
		"Eric Baudais",
		"Jim Campbell",
		"Sun GNOME Documentation Team",
		NULL
	};

	gedit_debug (DEBUG_COMMANDS);

	gtk_show_about_dialog (GTK_WINDOW (window),
			       "program-name", "gedit",
			       "authors", authors,
			       "comments", _("gedit is an easy-to-use and general-purpose text editor"),
			       "copyright", "Copyright 1998-2023 – the gedit team",
			       "license-type", GTK_LICENSE_GPL_2_0,
			       "logo-icon-name", "org.gnome.gedit",
			       "documenters", documenters,
			       "translator-credits", _("translator-credits"),
			       "version", VERSION,
			       "website", "http://www.gedit.org",
			       "website-label", "www.gedit.org",
			       NULL);
}

/* ex:set ts=8 noet: */