summaryrefslogtreecommitdiff
path: root/src/about.c
blob: 338cca30e48275a8e0261dd04373a5df8c7844d6 (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
133
134
135
136
137
138
139
140
141
142
143
144
145
/* vim: colorcolumn=80 ts=4 sw=4
 */
/*
 * about.c
 *
 * Copyright © 2002 Sun Microsystems, Inc.
 * Copyright © 2001 CodeFactory AB
 * Copyright © 2001, 2002 Anders Carlsson
 * Copyright © 2021 Logan Rathbone
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 *
 * Authors: Glynn Foster <glynn.foster@sun.com>
 *          Anders Carlsson <andersca@gnu.org>
 */

#include "util.h"
#include "zenity.h"

#include <string.h>

#include <config.h>

#define GTK_RESPONSE_CREDITS 0

#define ZENITY_CANVAS_X 400.0
#define ZENITY_CANVAS_Y 280.0

static GtkWidget *dialog;

static void zenity_about_dialog_response (GtkWidget *widget,
		int response, gpointer data);

/* Sync with the people in the THANKS file */
static const gchar *const authors[] = {"Glynn Foster <glynn foster sun com>",
	"Lucas Rocha <lucasr gnome org>",
	"Mike Newman <mikegtn gnome org>",
	NULL};

static const char *documenters[] = {"Glynn Foster <glynn.foster@sun.com>",
	"Lucas Rocha <lucasr@gnome.org>",
	"Java Desktop System Documentation Team",
	"GNOME Documentation Project",
	NULL};

static gchar *translators;

static const char *license[] = {
	N_ ("This program is free software; you can redistribute it and/or modify "
		"it under the terms of the GNU Lesser General Public License as "
		"published by "
		"the Free Software Foundation; either version 2 of the License, or "
		"(at your option) any later version.\n"),
	N_ ("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 Lesser General Public License for more details.\n"),
	N_ ("You should have received a copy of the GNU Lesser General Public "
		"License "
		"along with this program; if not, write to the Free Software "
		"Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA "
		"02110-1301, USA.")};

void
zenity_about (ZenityData *data)
{
	char *license_trans;

	translators = _("translator-credits");

	license_trans = g_strconcat (
		_(license[0]), "\n", _(license[1]), "\n", _(license[2]), "\n", NULL);

	dialog = gtk_about_dialog_new ();

	g_object_set (G_OBJECT (dialog),
		"name",
		"Zenity",
		"version",
		VERSION,
		"copyright",
		"Copyright \xc2\xa9 2003 Sun Microsystems\n"
		"Copyright \xc2\xa9 2021 Logan Rathbone\n",
		"comments",
		_("Display dialog boxes from shell scripts"),
		"authors",
		authors,
		"documenters",
		documenters,
		"translator-credits",
		translators,
		"website",
		"https://gitlab.gnome.org/GNOME/zenity",
		"wrap-license",
		TRUE,
		"license",
		license_trans,
		NULL);

	g_free (license_trans);

	zenity_util_set_window_icon (dialog,
			NULL, ZENITY_IMAGE_FULLPATH ("zenity.png"));

	g_signal_connect (G_OBJECT (dialog),
		"response",
		G_CALLBACK (zenity_about_dialog_response),
		data);

	zenity_util_show_dialog (dialog);
	zenity_util_gapp_main (GTK_WINDOW (dialog));
}

static void
zenity_about_dialog_response (GtkWidget *widget, int response, gpointer data)
{
	ZenityData *zen_data = data;

	g_return_if_fail (GTK_IS_WINDOW (GTK_WINDOW(widget)));

	switch (response) {
		case GTK_RESPONSE_CLOSE:
			zen_data->exit_code = zenity_util_return_exit_code (ZENITY_OK);
			break;

		default:
			/* Esc dialog */
			zen_data->exit_code = zenity_util_return_exit_code (ZENITY_ESC);
			break;
	}
	zenity_util_gapp_quit (GTK_WINDOW(widget));
}