2
* Copyright (C) 2010 Xfce Development Team
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License along
15
* with this program; if not, write to the Free Software Foundation, Inc.,
16
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
28
#include <libxfce4util/libxfce4util.h>
29
#include <libxfce4ui/libxfce4ui.h>
31
#include "contributors.h"
32
#include "translators.h"
33
#include "about-dialog-ui.h"
42
const gchar *display_name;
43
const gchar *description;
49
static gboolean opt_version = FALSE;
50
static GOptionEntry opt_entries[] =
52
{ "version", 'V', G_OPTION_FLAG_IN_MAIN, G_OPTION_ARG_NONE, &opt_version, N_("Version information"), NULL },
59
xfce_about_about (GtkTextBuffer *buffer)
67
static AboutModules xfce_about_info[] =
71
N_("Handles the placement of windows on the screen.")
75
N_("Program launchers, window buttons, applications menu, "
76
"workspace switcher and more.")
79
N_("Desktop Manager"),
80
N_("Sets the background color or image with optional application menu "
81
"or icons for minimized applications or launchers, devices and folders.")
85
N_("A modern file manager for the Unix/Linux desktop, aiming to "
86
"be easy-to-use and fast.")
89
N_("Session Manager"),
90
N_("Restores your session on startup and allows you to shutdown "
91
"the computer from Xfce.")
95
N_("Configuration system to control various aspects of the desktop "
96
"like appearance, display, keyboard and mouse settings.")
99
N_("Application Finder"),
100
N_("Shows the applications installed on your system in categories, "
101
"so you can quickly find and launch them.")
104
N_("Settings Daemon"),
105
N_("D-Bus-based configuration storage system.")
109
g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));
111
gtk_text_buffer_insert_at_cursor (buffer,
112
_("Xfce is a collection of programs that together provide a "
113
"full-featured desktop environment. The following programs "
114
"are part of the Xfce core:"), -1);
115
gtk_text_buffer_get_end_iter (buffer, &end);
117
bold = gtk_text_buffer_create_tag (buffer, "bold",
118
"weight", PANGO_WEIGHT_BOLD, NULL);
120
indent = gtk_text_buffer_create_tag (buffer, "indent",
121
"left-margin", MARGIN, NULL);
123
for (i = 0; i < G_N_ELEMENTS (xfce_about_info); i++)
125
info = xfce_about_info + i;
127
str = g_strdup_printf ("\n\n%s (%s)\n", _(info->display_name), info->name);
128
gtk_text_buffer_insert_with_tags (buffer, &end, str, -1, bold, NULL);
131
gtk_text_buffer_insert_with_tags (buffer, &end, _(info->description), -1, indent, NULL);
134
gtk_text_buffer_insert (buffer, &end, "\n\n", -1);
135
gtk_text_buffer_insert (buffer, &end,
136
_("Xfce is also a development platform providing several libraries, "
137
"that help programmers create applications that fit in well "
138
"with the desktop environment."), -1);
140
gtk_text_buffer_insert (buffer, &end, "\n\n", -1);
141
gtk_text_buffer_insert (buffer, &end,
142
_("Xfce components are licensed under free or open source "
143
"licences; GPL or BSDL for applications and LGPL or BSDL for "
144
"libraries. Look at the documentation, the source code or the "
145
"Xfce website (http://www.xfce.org) for more information."), -1);
147
gtk_text_buffer_insert (buffer, &end, "\n\n", -1);
148
gtk_text_buffer_insert (buffer, &end,
149
_("Thank you for your interest in Xfce."), -1);
151
gtk_text_buffer_insert (buffer, &end, "\n\n\t- ", -1);
152
gtk_text_buffer_insert (buffer, &end,
153
_("The Xfce Development Team"), -1);
155
gtk_text_buffer_insert (buffer, &end, "\n", -1);
161
xfce_about_credits_translators (GtkTextBuffer *buffer,
168
const TranslatorInfo *member;
169
const TranslatorTeam *team;
172
GtkTextTag *coordinator;
174
coordinator = gtk_text_buffer_create_tag (buffer, "italic",
175
"style", PANGO_STYLE_ITALIC, NULL);
177
for (i = 0; i < G_N_ELEMENTS (xfce_translators); i++)
179
team = xfce_translators + i;
181
str = g_strdup_printf ("%s [%s]: ", team->name, team->code);
182
gtk_text_buffer_insert_with_tags (buffer, end, str, -1, indent, NULL);
187
for (member = team->members; member->name != NULL; member++)
190
gtk_text_buffer_insert (buffer, end, ", ", -1);
192
italic = member->is_coordinator ? coordinator : NULL;
194
gtk_text_buffer_insert_with_tags (buffer, end, member->name, -1, italic, NULL);
195
gtk_text_buffer_insert_with_tags (buffer, end, " <", -1, italic, NULL);
196
gtk_text_buffer_insert_with_tags (buffer, end, member->email, -1, email, italic, NULL);
197
gtk_text_buffer_insert_with_tags (buffer, end, ">", -1, italic, NULL);
202
gtk_text_buffer_insert (buffer, end, "\n", -1);
209
xfce_about_credits (GtkTextBuffer *buffer)
216
const ContributorGroup *group;
217
const ContributorInfo *user;
219
g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));
221
email = gtk_text_buffer_create_tag (buffer, "email",
222
"foreground", "blue",
223
"underline", PANGO_UNDERLINE_SINGLE, NULL);
225
title = gtk_text_buffer_create_tag (buffer, "title",
227
"weight", PANGO_WEIGHT_BOLD, NULL);
229
indent = gtk_text_buffer_create_tag (buffer, "indent",
230
"left-margin", MARGIN,
231
"indent", -MARGIN, NULL);
233
gtk_text_buffer_get_end_iter (buffer, &end);
235
for (i = 0; i < G_N_ELEMENTS (xfce_contributors); i++)
237
group = xfce_contributors + i;
239
gtk_text_buffer_insert_with_tags (buffer, &end, _(group->name), -1, title, NULL);
240
gtk_text_buffer_insert (buffer, &end, "\n", -1);
242
if (group->contributors != NULL)
244
for (user = group->contributors; user->name != NULL; user++)
246
gtk_text_buffer_insert_with_tags (buffer, &end, user->name, -1, indent, NULL);
247
gtk_text_buffer_insert (buffer, &end, " <", -1);
248
gtk_text_buffer_insert_with_tags (buffer, &end, user->email, -1, email, NULL);
249
gtk_text_buffer_insert (buffer, &end, ">\n", -1);
254
/* add the translators */
255
xfce_about_credits_translators (buffer, &end, indent, email);
258
gtk_text_buffer_insert (buffer, &end, "\n", -1);
261
gtk_text_buffer_insert (buffer, &end,
262
_("If you know of anyone missing from this list; don't hesitate and "
263
"file a bug on <http://bugzilla.xfce.org> ."), -1);
264
gtk_text_buffer_insert (buffer, &end, "\n\n", -1);
265
gtk_text_buffer_insert_with_tags (buffer, &end,
266
_("Thanks to all who helped making this software available!"), -1, title, NULL);
268
gtk_text_buffer_insert (buffer, &end, "\n", -1);
274
xfce_about_copyright (GtkTextBuffer *buffer)
278
g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));
280
gtk_text_buffer_get_end_iter (buffer, &end);
282
gtk_text_buffer_insert (buffer, &end,
283
_("Xfce 4 is copyright Olivier Fourdan (fourdan@xfce.org). The different "
284
"components are copyrighted by their respective authors."), -1);
286
gtk_text_buffer_insert (buffer, &end, "\n\n", -1);
287
gtk_text_buffer_insert (buffer, &end,
288
_("The libxfce4ui, libxfcegui4, libxfce4util, thunar-vfs and exo packages are "
289
"distributed under the terms of the GNU Library General Public License as "
290
"published by the Free Software Foundation; either version 2 of the License, or "
291
"(at your option) any later version."), -1);
293
gtk_text_buffer_insert (buffer, &end, "\n\n", -1);
294
gtk_text_buffer_insert (buffer, &end,
295
_("The packages thunar, xfce4-appfinder, xfce4-panel, xfce4-session, "
296
"xfce4-settings, xfce-utils, xfconf, xfdesktop and xfwm4 are "
297
"distributed under the terms of the GNU General Public License as "
298
"published by the Free Software Foundation; either version 2 of the "
299
"License, or (at your option) any later version."), -1);
301
gtk_text_buffer_insert (buffer, &end, "\n", -1);
308
xfce_about_vendor (GtkBuilder *builder)
315
g_return_if_fail (GTK_IS_BUILDER (builder));
317
filename = g_build_filename (DATADIR, "vendorinfo", NULL);
318
if (g_file_get_contents (filename, &contents, &length, NULL))
322
if (g_utf8_validate(contents, length, NULL))
324
object = gtk_builder_get_object (builder, "vendor-buffer");
325
gtk_text_buffer_set_text (GTK_TEXT_BUFFER (object), contents, length);
327
object = gtk_builder_get_object (builder, "vendor-label");
328
gtk_label_set_text (GTK_LABEL (object), VENDOR_INFO);
330
object = gtk_builder_get_object (builder, "vendor-tab");
331
gtk_widget_show (GTK_WIDGET (object));
335
g_critical ("\"%s\" is not UTF-8 valid", filename);
343
g_message ("No vendor information found in \"%s\".", filename);
353
xfce_about_license (GtkBuilder *builder,
358
static gboolean initial = TRUE;
360
g_return_if_fail (GTK_IS_BUILDER (builder));
361
g_return_if_fail (GTK_IS_TEXT_BUFFER (buffer));
363
object = gtk_builder_get_object (builder, "license-textview");
364
gtk_text_view_set_buffer (GTK_TEXT_VIEW (object), GTK_TEXT_BUFFER (buffer));
366
dialog = gtk_builder_get_object (builder, "license-dialog");
369
g_signal_connect (G_OBJECT (dialog), "delete-event",
370
G_CALLBACK (gtk_widget_hide_on_delete), NULL);
372
object = gtk_builder_get_object (builder, "license-close-button");
373
g_signal_connect_swapped (G_OBJECT (object), "clicked",
374
G_CALLBACK (gtk_widget_hide), dialog);
376
object = gtk_builder_get_object (builder, "window");
377
gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (object));
382
gtk_widget_show (GTK_WIDGET (dialog));
388
xfce_about_license_gpl (GtkBuilder *builder)
390
xfce_about_license (builder,
391
gtk_builder_get_object (builder, "gpl-buffer"));
397
xfce_about_license_lgpl (GtkBuilder *builder)
399
xfce_about_license (builder,
400
gtk_builder_get_object (builder, "lgpl-buffer"));
406
xfce_about_license_bsd (GtkBuilder *builder)
408
xfce_about_license (builder,
409
gtk_builder_get_object (builder, "bsd-buffer"));
415
xfce_about_help (GtkWidget *button,
418
g_return_if_fail (GTK_IS_BUTTON (button));
419
xfce_dialog_show_help (GTK_WINDOW (dialog),
430
GError *error = NULL;
435
xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
437
if (G_UNLIKELY (!gtk_init_with_args (&argc, &argv, NULL, opt_entries, PACKAGE, &error)))
439
if (G_LIKELY (error != NULL))
441
g_print ("%s: %s.\n", G_LOG_DOMAIN, error->message);
442
g_print (_("Type '%s --help' for usage information."), G_LOG_DOMAIN);
445
g_error_free (error);
448
g_error (_("Unable to initialize GTK+."));
453
if (G_UNLIKELY (opt_version))
455
g_print ("%s %s (Xfce %s)\n\n", G_LOG_DOMAIN, PACKAGE_VERSION, xfce_version_string ());
456
g_print ("%s\n", "Copyright (c) 2008-2011");
457
g_print ("\t%s\n\n", _("The Xfce development team. All rights reserved."));
458
g_print (_("Please report bugs to <%s>."), PACKAGE_BUGREPORT);
460
/* I18N: date/time the translators list was updated */
461
g_print (_("Translators list from %s."), TRANSLATORS_H_STAMP);
467
builder = gtk_builder_new ();
468
if (!gtk_builder_add_from_string (builder, xfce_about_dialog_ui,
469
xfce_about_dialog_ui_length, &error))
471
xfce_dialog_show_error (NULL, error, _("Failed to load interface"));
472
g_error_free (error);
473
g_object_unref (G_OBJECT (builder));
478
dialog = gtk_builder_get_object (builder, "window");
479
g_signal_connect_swapped (G_OBJECT (dialog), "delete-event",
480
G_CALLBACK (gtk_main_quit), NULL);
483
/* I18N: first %s will be replaced by the version, second by
484
* the name of the distribution (--with-vendor-info=NAME) */
485
version = g_strdup_printf (_("Version %s, distributed by %s"),
486
xfce_version_string (), VENDOR_INFO);
488
/* I18N: %s will be replaced by the Xfce version number */
489
version = g_strdup_printf (_("Version %s"), xfce_version_string ());
491
xfce_titled_dialog_set_subtitle (XFCE_TITLED_DIALOG (dialog), version);
494
object = gtk_builder_get_object (builder, "about-buffer");
495
xfce_about_about (GTK_TEXT_BUFFER (object));
497
object = gtk_builder_get_object (builder, "credits-buffer");
498
xfce_about_credits (GTK_TEXT_BUFFER (object));
500
object = gtk_builder_get_object (builder, "copyright-buffer");
501
xfce_about_copyright (GTK_TEXT_BUFFER (object));
504
xfce_about_vendor (builder);
507
object = gtk_builder_get_object (builder, "gpl-button");
508
g_signal_connect_swapped (G_OBJECT (object), "clicked",
509
G_CALLBACK (xfce_about_license_gpl), builder);
511
object = gtk_builder_get_object (builder, "lgpl-button");
512
g_signal_connect_swapped (G_OBJECT (object), "clicked",
513
G_CALLBACK (xfce_about_license_lgpl), builder);
515
object = gtk_builder_get_object (builder, "bsd-button");
516
g_signal_connect_swapped (G_OBJECT (object), "clicked",
517
G_CALLBACK (xfce_about_license_bsd), builder);
519
object = gtk_builder_get_object (builder, "help-button");
520
g_signal_connect (G_OBJECT (object), "clicked",
521
G_CALLBACK (xfce_about_help), dialog);
523
object = gtk_builder_get_object (builder, "close-button");
524
g_signal_connect_swapped (G_OBJECT (object), "clicked",
525
G_CALLBACK (gtk_main_quit), NULL);
527
gtk_widget_show (GTK_WIDGET (dialog));
531
g_object_unref (G_OBJECT (builder));