2008-07-01 22:57:50 +00:00
|
|
|
|
/* GTK - The GIMP Toolkit
|
2004-07-12 16:38:04 +00:00
|
|
|
|
* Copyright (C) 2001 CodeFactory AB
|
|
|
|
|
* Copyright (C) 2001, 2002 Anders Carlsson
|
|
|
|
|
* Copyright (C) 2003, 2004 Matthias Clasen <mclasen@redhat.com>
|
|
|
|
|
*
|
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2009-11-30 00:48:16 +00:00
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
|
* License as published by the Free Software Foundation; either
|
2004-07-12 16:38:04 +00:00
|
|
|
|
* 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 Library General Public
|
2012-02-27 13:01:10 +00:00
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
2004-07-12 16:38:04 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*
|
2004-07-27 17:28:26 +00:00
|
|
|
|
* Author: Anders Carlsson <andersca@gnome.org>
|
2004-07-12 16:38:04 +00:00
|
|
|
|
*
|
|
|
|
|
* Modified by the GTK+ Team and others 1997-2004. See the AUTHORS
|
|
|
|
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
|
|
|
* files for a list of changes. These files are distributed with
|
2009-11-30 00:48:16 +00:00
|
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
2004-07-12 16:38:04 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
|
#include "config.h"
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2006-06-29 09:18:07 +00:00
|
|
|
|
#include <string.h>
|
|
|
|
|
|
2017-10-22 21:03:19 +00:00
|
|
|
|
#include <cairo-gobject.h>
|
|
|
|
|
|
2004-08-09 16:59:53 +00:00
|
|
|
|
#include "gtkaboutdialog.h"
|
2004-07-12 16:38:04 +00:00
|
|
|
|
#include "gtkbutton.h"
|
2010-12-10 06:27:55 +00:00
|
|
|
|
#include "gtkgrid.h"
|
2011-08-28 05:54:55 +00:00
|
|
|
|
#include "gtkbox.h"
|
2013-09-11 02:45:06 +00:00
|
|
|
|
#include "gtkicontheme.h"
|
2004-07-12 16:38:04 +00:00
|
|
|
|
#include "gtkimage.h"
|
|
|
|
|
#include "gtklabel.h"
|
|
|
|
|
#include "gtkmarshalers.h"
|
2013-09-26 03:50:51 +00:00
|
|
|
|
#include "gtkstack.h"
|
2010-12-10 06:27:55 +00:00
|
|
|
|
#include "gtkorientable.h"
|
2004-07-12 16:38:04 +00:00
|
|
|
|
#include "gtkscrolledwindow.h"
|
|
|
|
|
#include "gtktextview.h"
|
2022-11-29 19:11:26 +00:00
|
|
|
|
#include "gtkfilelauncher.h"
|
2011-10-23 11:57:07 +00:00
|
|
|
|
#include "gtkmain.h"
|
2010-12-10 06:27:55 +00:00
|
|
|
|
#include "gtktogglebutton.h"
|
2011-01-04 19:51:19 +00:00
|
|
|
|
#include "gtktypebuiltins.h"
|
2013-12-08 12:40:50 +00:00
|
|
|
|
#include "gtkstack.h"
|
|
|
|
|
#include "gtkstackswitcher.h"
|
|
|
|
|
#include "gtksettings.h"
|
|
|
|
|
#include "gtkheaderbar.h"
|
2005-03-22 02:14:55 +00:00
|
|
|
|
#include "gtkprivate.h"
|
2022-09-24 13:07:56 +00:00
|
|
|
|
#include <glib/gi18n-lib.h>
|
2017-12-11 23:46:47 +00:00
|
|
|
|
#include "gtkeventcontrollermotion.h"
|
2018-02-08 00:17:11 +00:00
|
|
|
|
#include "gtkeventcontrollerkey.h"
|
2019-05-29 17:10:46 +00:00
|
|
|
|
#include "gtkgestureclick.h"
|
2022-10-09 04:14:20 +00:00
|
|
|
|
#include "gtkcssnodeprivate.h"
|
|
|
|
|
#include "gtkwidgetprivate.h"
|
|
|
|
|
#include "gtkcsscolorvalueprivate.h"
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2009-10-14 01:23:47 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* GtkAboutDialog:
|
2009-10-14 01:23:47 +00:00
|
|
|
|
*
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* The `GtkAboutDialog` offers a simple way to display information about
|
2021-02-27 22:49:13 +00:00
|
|
|
|
* a program.
|
2021-02-19 19:50:49 +00:00
|
|
|
|
*
|
2021-02-27 22:49:13 +00:00
|
|
|
|
* The shown information includes the programs' logo, name, copyright,
|
|
|
|
|
* website and license. It is also possible to give credits to the authors,
|
|
|
|
|
* documenters, translators and artists who have worked on the program.
|
|
|
|
|
*
|
|
|
|
|
* An about dialog is typically opened when the user selects the `About`
|
|
|
|
|
* option from the `Help` menu. All parts of the dialog are optional.
|
2009-10-14 01:23:47 +00:00
|
|
|
|
*
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* ![An example GtkAboutDialog](aboutdialog.png)
|
|
|
|
|
*
|
|
|
|
|
* About dialogs often contain links and email addresses. `GtkAboutDialog`
|
2022-11-29 19:11:26 +00:00
|
|
|
|
* displays these as clickable links. By default, it calls [method@Gtk.FileLauncher.launch]
|
2010-09-24 17:41:29 +00:00
|
|
|
|
* when a user clicks one. The behaviour can be overridden with the
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* [signal@Gtk.AboutDialog::activate-link] signal.
|
2009-10-14 01:23:47 +00:00
|
|
|
|
*
|
2014-08-29 19:11:11 +00:00
|
|
|
|
* To specify a person with an email address, use a string like
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* `Edgar Allan Poe <edgar@poe.com>`. To specify a website with a title,
|
|
|
|
|
* use a string like `GTK team https://www.gtk.org`.
|
2014-08-29 19:11:11 +00:00
|
|
|
|
*
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* To make constructing a `GtkAboutDialog` as convenient as possible, you can
|
|
|
|
|
* use the function [func@Gtk.show_about_dialog] which constructs and shows
|
|
|
|
|
* a dialog and keeps it around so that it can be shown again.
|
2009-10-14 01:23:47 +00:00
|
|
|
|
*
|
2020-06-15 17:45:28 +00:00
|
|
|
|
* Note that GTK sets a default title of `_("About %s")` on the dialog
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* window (where `%s` is replaced by the name of the application, but in
|
2014-02-09 22:24:06 +00:00
|
|
|
|
* order to ensure proper translation of the title, applications should
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* set the title property explicitly when constructing a `GtkAboutDialog`,
|
2014-02-09 22:24:06 +00:00
|
|
|
|
* as shown in the following example:
|
2021-02-18 13:38:55 +00:00
|
|
|
|
*
|
|
|
|
|
* ```c
|
2020-08-01 17:30:31 +00:00
|
|
|
|
* GFile *logo_file = g_file_new_for_path ("./logo.png");
|
|
|
|
|
* GdkTexture *example_logo = gdk_texture_new_from_file (logo_file, NULL);
|
|
|
|
|
* g_object_unref (logo_file);
|
|
|
|
|
*
|
2009-10-14 01:23:47 +00:00
|
|
|
|
* gtk_show_about_dialog (NULL,
|
|
|
|
|
* "program-name", "ExampleCode",
|
2017-11-04 18:10:46 +00:00
|
|
|
|
* "logo", example_logo,
|
2017-10-11 10:55:01 +00:00
|
|
|
|
* "title", _("About ExampleCode"),
|
2009-10-14 01:23:47 +00:00
|
|
|
|
* NULL);
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* ```
|
2021-01-11 21:48:06 +00:00
|
|
|
|
*
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* ## CSS nodes
|
2021-01-11 21:48:06 +00:00
|
|
|
|
*
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* `GtkAboutDialog` has a single CSS node with the name `window` and style
|
|
|
|
|
* class `.aboutdialog`.
|
2021-01-11 21:48:06 +00:00
|
|
|
|
|
2009-10-14 01:23:47 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2013-12-16 16:06:24 +00:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *name;
|
|
|
|
|
const char *url;
|
2013-12-16 16:06:24 +00:00
|
|
|
|
} LicenseInfo;
|
|
|
|
|
|
|
|
|
|
/* LicenseInfo for each GtkLicense type; keep in the same order as the enumeration */
|
|
|
|
|
static const LicenseInfo gtk_license_info [] = {
|
|
|
|
|
{ N_("License"), NULL },
|
|
|
|
|
{ N_("Custom License") , NULL },
|
2017-07-14 01:19:47 +00:00
|
|
|
|
{ N_("GNU General Public License, version 2 or later"), "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html" },
|
|
|
|
|
{ N_("GNU General Public License, version 3 or later"), "https://www.gnu.org/licenses/gpl-3.0.html" },
|
|
|
|
|
{ N_("GNU Lesser General Public License, version 2.1 or later"), "https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html" },
|
|
|
|
|
{ N_("GNU Lesser General Public License, version 3 or later"), "https://www.gnu.org/licenses/lgpl-3.0.html" },
|
|
|
|
|
{ N_("BSD 2-Clause License"), "https://opensource.org/licenses/bsd-license.php" },
|
|
|
|
|
{ N_("The MIT License (MIT)"), "https://opensource.org/licenses/mit-license.php" },
|
|
|
|
|
{ N_("Artistic License 2.0"), "https://opensource.org/licenses/artistic-license-2.0.php" },
|
|
|
|
|
{ N_("GNU General Public License, version 2 only"), "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html" },
|
|
|
|
|
{ N_("GNU General Public License, version 3 only"), "https://www.gnu.org/licenses/gpl-3.0.html" },
|
|
|
|
|
{ N_("GNU Lesser General Public License, version 2.1 only"), "https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html" },
|
|
|
|
|
{ N_("GNU Lesser General Public License, version 3 only"), "https://www.gnu.org/licenses/lgpl-3.0.html" },
|
2018-01-23 13:49:31 +00:00
|
|
|
|
{ N_("GNU Affero General Public License, version 3 or later"), "https://www.gnu.org/licenses/agpl-3.0.html" },
|
2020-04-11 15:49:09 +00:00
|
|
|
|
{ N_("GNU Affero General Public License, version 3 only"), "https://www.gnu.org/licenses/agpl-3.0.html" },
|
|
|
|
|
{ N_("BSD 3-Clause License"), "https://opensource.org/licenses/BSD-3-Clause" },
|
|
|
|
|
{ N_("Apache License, Version 2.0"), "https://opensource.org/licenses/Apache-2.0" },
|
|
|
|
|
{ N_("Mozilla Public License 2.0"), "https://opensource.org/licenses/MPL-2.0" }
|
2010-08-10 04:00:15 +00:00
|
|
|
|
};
|
2020-05-11 17:12:08 +00:00
|
|
|
|
/* Keep this static assertion updated with the last element of the
|
|
|
|
|
* enumeration, and make sure it matches the last element of the array */
|
|
|
|
|
G_STATIC_ASSERT (G_N_ELEMENTS (gtk_license_info) - 1 == GTK_LICENSE_MPL_2_0);
|
2010-08-10 04:00:15 +00:00
|
|
|
|
|
2012-01-25 23:21:47 +00:00
|
|
|
|
typedef struct
|
|
|
|
|
{
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char *heading;
|
|
|
|
|
char **people;
|
2012-01-25 23:21:47 +00:00
|
|
|
|
} CreditSection;
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
typedef struct _GtkAboutDialogClass GtkAboutDialogClass;
|
2019-05-27 00:49:19 +00:00
|
|
|
|
|
|
|
|
|
struct _GtkAboutDialog
|
|
|
|
|
{
|
2020-10-05 15:20:27 +00:00
|
|
|
|
GtkWindow parent_instance;
|
2019-05-27 00:49:19 +00:00
|
|
|
|
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char *name;
|
|
|
|
|
char *version;
|
|
|
|
|
char *copyright;
|
|
|
|
|
char *comments;
|
|
|
|
|
char *website_url;
|
|
|
|
|
char *website_text;
|
|
|
|
|
char *translator_credits;
|
|
|
|
|
char *license;
|
|
|
|
|
char *system_information;
|
2009-11-30 00:48:16 +00:00
|
|
|
|
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char **authors;
|
|
|
|
|
char **documenters;
|
|
|
|
|
char **artists;
|
2009-11-30 00:48:16 +00:00
|
|
|
|
|
2012-01-25 23:21:47 +00:00
|
|
|
|
GSList *credit_sections;
|
|
|
|
|
|
2013-09-26 03:50:51 +00:00
|
|
|
|
gboolean credits_page_initialized;
|
|
|
|
|
gboolean license_page_initialized;
|
2016-12-30 04:12:42 +00:00
|
|
|
|
gboolean system_page_initialized;
|
2010-12-10 06:27:55 +00:00
|
|
|
|
|
2013-09-26 03:50:51 +00:00
|
|
|
|
GtkWidget *stack;
|
2013-12-08 12:40:50 +00:00
|
|
|
|
GtkWidget *stack_switcher;
|
2014-05-28 15:32:21 +00:00
|
|
|
|
|
2004-07-12 16:38:04 +00:00
|
|
|
|
GtkWidget *logo_image;
|
|
|
|
|
GtkWidget *name_label;
|
2010-12-10 06:27:55 +00:00
|
|
|
|
GtkWidget *version_label;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
GtkWidget *comments_label;
|
|
|
|
|
GtkWidget *copyright_label;
|
2010-12-10 06:27:55 +00:00
|
|
|
|
GtkWidget *license_label;
|
2009-01-05 03:38:10 +00:00
|
|
|
|
GtkWidget *website_label;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2013-12-08 12:40:50 +00:00
|
|
|
|
GtkWidget *credits_page;
|
|
|
|
|
GtkWidget *license_page;
|
2016-12-30 04:12:42 +00:00
|
|
|
|
GtkWidget *system_page;
|
2009-11-30 00:48:16 +00:00
|
|
|
|
|
2013-03-22 12:51:40 +00:00
|
|
|
|
GtkWidget *credits_grid;
|
|
|
|
|
GtkWidget *license_view;
|
2016-12-30 04:12:42 +00:00
|
|
|
|
GtkWidget *system_view;
|
2013-03-22 12:51:40 +00:00
|
|
|
|
|
2020-02-18 08:42:29 +00:00
|
|
|
|
GPtrArray *visited_links;
|
2006-01-24 00:20:06 +00:00
|
|
|
|
|
2022-10-09 04:14:20 +00:00
|
|
|
|
GtkCssNode *link_node;
|
|
|
|
|
GtkCssNode *visited_link_node;
|
|
|
|
|
|
2010-08-10 04:00:15 +00:00
|
|
|
|
GtkLicense license_type;
|
|
|
|
|
|
2006-01-24 00:20:06 +00:00
|
|
|
|
guint hovering_over_link : 1;
|
|
|
|
|
guint wrap_license : 1;
|
2013-09-26 03:50:51 +00:00
|
|
|
|
guint in_child_changed : 1;
|
2020-03-28 04:42:44 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct _GtkAboutDialogClass
|
|
|
|
|
{
|
2020-10-05 15:20:27 +00:00
|
|
|
|
GtkWindowClass parent_class;
|
2020-03-28 04:42:44 +00:00
|
|
|
|
|
|
|
|
|
gboolean (*activate_link) (GtkAboutDialog *dialog,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *uri);
|
2020-03-28 04:42:44 +00:00
|
|
|
|
};
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2009-11-30 00:48:16 +00:00
|
|
|
|
enum
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
|
|
|
|
PROP_0,
|
|
|
|
|
PROP_NAME,
|
|
|
|
|
PROP_VERSION,
|
|
|
|
|
PROP_COPYRIGHT,
|
|
|
|
|
PROP_COMMENTS,
|
|
|
|
|
PROP_WEBSITE,
|
|
|
|
|
PROP_WEBSITE_LABEL,
|
|
|
|
|
PROP_LICENSE,
|
2016-12-30 04:12:42 +00:00
|
|
|
|
PROP_SYSTEM_INFORMATION,
|
2004-07-12 16:38:04 +00:00
|
|
|
|
PROP_AUTHORS,
|
|
|
|
|
PROP_DOCUMENTERS,
|
|
|
|
|
PROP_TRANSLATOR_CREDITS,
|
|
|
|
|
PROP_ARTISTS,
|
2004-10-25 18:41:11 +00:00
|
|
|
|
PROP_LOGO,
|
2005-07-05 14:53:37 +00:00
|
|
|
|
PROP_LOGO_ICON_NAME,
|
2010-08-10 04:00:15 +00:00
|
|
|
|
PROP_WRAP_LICENSE,
|
2014-06-07 05:06:51 +00:00
|
|
|
|
PROP_LICENSE_TYPE,
|
|
|
|
|
LAST_PROP
|
2004-07-12 16:38:04 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static void gtk_about_dialog_finalize (GObject *object);
|
|
|
|
|
static void gtk_about_dialog_get_property (GObject *object,
|
2009-11-30 00:48:16 +00:00
|
|
|
|
guint prop_id,
|
|
|
|
|
GValue *value,
|
|
|
|
|
GParamSpec *pspec);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
static void gtk_about_dialog_set_property (GObject *object,
|
2009-11-30 00:48:16 +00:00
|
|
|
|
guint prop_id,
|
|
|
|
|
const GValue *value,
|
|
|
|
|
GParamSpec *pspec);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
static void update_name_version (GtkAboutDialog *about);
|
|
|
|
|
static void follow_if_link (GtkAboutDialog *about,
|
2009-11-30 00:48:16 +00:00
|
|
|
|
GtkTextView *text_view,
|
|
|
|
|
GtkTextIter *iter);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
static void set_cursor_if_appropriate (GtkAboutDialog *about,
|
2010-09-22 01:55:05 +00:00
|
|
|
|
GtkTextView *text_view,
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int x,
|
|
|
|
|
int y);
|
2013-12-08 12:40:50 +00:00
|
|
|
|
static void populate_credits_page (GtkAboutDialog *about);
|
|
|
|
|
static void populate_license_page (GtkAboutDialog *about);
|
2016-12-30 04:12:42 +00:00
|
|
|
|
static void populate_system_page (GtkAboutDialog *about);
|
2010-09-22 01:55:05 +00:00
|
|
|
|
static gboolean gtk_about_dialog_activate_link (GtkAboutDialog *about,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *uri);
|
2013-03-22 12:51:40 +00:00
|
|
|
|
static gboolean emit_activate_link (GtkAboutDialog *about,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *uri);
|
2018-02-08 00:17:11 +00:00
|
|
|
|
static gboolean text_view_key_pressed (GtkEventController *controller,
|
|
|
|
|
guint keyval,
|
|
|
|
|
guint keycode,
|
|
|
|
|
GdkModifierType state,
|
2013-03-22 12:51:40 +00:00
|
|
|
|
GtkAboutDialog *about);
|
2019-05-29 17:10:46 +00:00
|
|
|
|
static void text_view_released (GtkGestureClick *press,
|
2017-12-12 00:00:24 +00:00
|
|
|
|
int n,
|
|
|
|
|
double x,
|
|
|
|
|
double y,
|
|
|
|
|
GtkAboutDialog *about);
|
2017-12-11 23:46:47 +00:00
|
|
|
|
static void text_view_motion (GtkEventControllerMotion *motion,
|
|
|
|
|
double x,
|
|
|
|
|
double y,
|
|
|
|
|
GtkAboutDialog *about);
|
2013-03-22 12:51:40 +00:00
|
|
|
|
|
2010-09-22 01:55:05 +00:00
|
|
|
|
enum {
|
|
|
|
|
ACTIVATE_LINK,
|
|
|
|
|
LAST_SIGNAL
|
|
|
|
|
};
|
2009-04-03 00:10:55 +00:00
|
|
|
|
|
2010-09-22 01:55:05 +00:00
|
|
|
|
static guint signals[LAST_SIGNAL] = { 0 };
|
2014-06-07 05:06:51 +00:00
|
|
|
|
static GParamSpec *props[LAST_PROP] = { NULL, };
|
2009-04-03 00:10:55 +00:00
|
|
|
|
|
2020-10-05 15:20:27 +00:00
|
|
|
|
G_DEFINE_TYPE (GtkAboutDialog, gtk_about_dialog, GTK_TYPE_WINDOW)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2013-12-08 12:40:50 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
stack_visible_child_notify (GtkStack *stack,
|
|
|
|
|
GParamSpec *pspec,
|
|
|
|
|
GtkAboutDialog *about)
|
|
|
|
|
{
|
|
|
|
|
GtkWidget *child;
|
|
|
|
|
|
|
|
|
|
child = gtk_stack_get_visible_child (stack);
|
2020-03-28 04:42:44 +00:00
|
|
|
|
if (child == about->credits_page)
|
2013-12-08 12:40:50 +00:00
|
|
|
|
{
|
2020-03-28 04:42:44 +00:00
|
|
|
|
if (!about->credits_page_initialized)
|
2013-12-08 12:40:50 +00:00
|
|
|
|
{
|
|
|
|
|
populate_credits_page (about);
|
2020-03-28 04:42:44 +00:00
|
|
|
|
about->credits_page_initialized = TRUE;
|
2013-12-08 12:40:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-03-28 04:42:44 +00:00
|
|
|
|
else if (child == about->license_page)
|
2013-12-08 12:40:50 +00:00
|
|
|
|
{
|
2020-03-28 04:42:44 +00:00
|
|
|
|
if (!about->license_page_initialized)
|
2013-12-08 12:40:50 +00:00
|
|
|
|
{
|
|
|
|
|
populate_license_page (about);
|
2020-03-28 04:42:44 +00:00
|
|
|
|
about->license_page_initialized = TRUE;
|
2013-12-08 12:40:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2020-03-28 04:42:44 +00:00
|
|
|
|
else if (child == about->system_page)
|
2016-12-30 04:12:42 +00:00
|
|
|
|
{
|
2020-03-28 04:42:44 +00:00
|
|
|
|
if (!about->system_page_initialized)
|
2016-12-30 04:12:42 +00:00
|
|
|
|
{
|
|
|
|
|
populate_system_page (about);
|
2020-03-28 04:42:44 +00:00
|
|
|
|
about->system_page_initialized = TRUE;
|
2016-12-30 04:12:42 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2013-12-08 12:40:50 +00:00
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2010-09-22 01:55:05 +00:00
|
|
|
|
|
2021-01-17 16:39:36 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_about_dialog_map (GtkWidget *widget)
|
|
|
|
|
{
|
|
|
|
|
GtkAboutDialog *about = GTK_ABOUT_DIALOG (widget);
|
|
|
|
|
|
|
|
|
|
if (gtk_widget_get_visible (about->stack_switcher))
|
|
|
|
|
gtk_widget_grab_focus (gtk_widget_get_first_child (about->stack_switcher));
|
|
|
|
|
|
|
|
|
|
GTK_WIDGET_CLASS (gtk_about_dialog_parent_class)->map (widget);
|
|
|
|
|
}
|
|
|
|
|
|
2004-07-12 16:38:04 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_about_dialog_class_init (GtkAboutDialogClass *klass)
|
|
|
|
|
{
|
|
|
|
|
GObjectClass *object_class;
|
|
|
|
|
GtkWidgetClass *widget_class;
|
2009-11-30 00:48:16 +00:00
|
|
|
|
|
2004-07-12 16:38:04 +00:00
|
|
|
|
object_class = (GObjectClass *)klass;
|
|
|
|
|
widget_class = (GtkWidgetClass *)klass;
|
2009-11-30 00:48:16 +00:00
|
|
|
|
|
2004-07-12 16:38:04 +00:00
|
|
|
|
object_class->set_property = gtk_about_dialog_set_property;
|
|
|
|
|
object_class->get_property = gtk_about_dialog_get_property;
|
|
|
|
|
|
|
|
|
|
object_class->finalize = gtk_about_dialog_finalize;
|
|
|
|
|
|
2021-01-17 16:39:36 +00:00
|
|
|
|
widget_class->map = gtk_about_dialog_map;
|
|
|
|
|
|
2010-09-22 01:55:05 +00:00
|
|
|
|
klass->activate_link = gtk_about_dialog_activate_link;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* GtkAboutDialog::activate-link:
|
|
|
|
|
* @label: The object on which the signal was emitted
|
|
|
|
|
* @uri: the URI that is activated
|
|
|
|
|
*
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* Emitted every time a URL is activated.
|
2021-02-18 13:38:55 +00:00
|
|
|
|
*
|
2010-09-22 01:55:05 +00:00
|
|
|
|
* Applications may connect to it to override the default behaviour,
|
2022-11-29 19:11:26 +00:00
|
|
|
|
* which is to call [method@Gtk.FileLauncher.launch].
|
2010-09-22 01:55:05 +00:00
|
|
|
|
*
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* Returns: `TRUE` if the link has been activated
|
2010-09-22 01:55:05 +00:00
|
|
|
|
*/
|
|
|
|
|
signals[ACTIVATE_LINK] =
|
2015-09-12 13:13:00 +00:00
|
|
|
|
g_signal_new (I_("activate-link"),
|
2010-09-22 01:55:05 +00:00
|
|
|
|
G_TYPE_FROM_CLASS (object_class),
|
|
|
|
|
G_SIGNAL_RUN_LAST,
|
|
|
|
|
G_STRUCT_OFFSET (GtkAboutDialogClass, activate_link),
|
|
|
|
|
_gtk_boolean_handled_accumulator, NULL,
|
|
|
|
|
_gtk_marshal_BOOLEAN__STRING,
|
|
|
|
|
G_TYPE_BOOLEAN, 1, G_TYPE_STRING);
|
|
|
|
|
|
2004-11-04 15:13:00 +00:00
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* GtkAboutDialog:program-name: (attributes org.gtk.Property.get=gtk_about_dialog_get_program_name org.gtk.Property.set=gtk_about_dialog_set_program_name)
|
2004-11-04 15:13:00 +00:00
|
|
|
|
*
|
2009-11-30 00:48:16 +00:00
|
|
|
|
* The name of the program.
|
2021-02-18 13:38:55 +00:00
|
|
|
|
*
|
2021-05-18 21:05:26 +00:00
|
|
|
|
* If this is not set, it defaults to the value returned by
|
|
|
|
|
* `g_get_application_name()`.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2014-06-07 05:06:51 +00:00
|
|
|
|
props[PROP_NAME] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_string ("program-name", NULL, NULL,
|
2014-06-07 05:06:51 +00:00
|
|
|
|
NULL,
|
2014-06-07 05:08:52 +00:00
|
|
|
|
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2004-11-04 15:13:00 +00:00
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* GtkAboutDialog:version: (attributes org.gtk.Property.get=gtk_about_dialog_get_version org.gtk.Property.set=gtk_about_dialog_set_version)
|
2004-11-04 15:13:00 +00:00
|
|
|
|
*
|
2009-11-30 00:48:16 +00:00
|
|
|
|
* The version of the program.
|
|
|
|
|
*/
|
2014-06-07 05:06:51 +00:00
|
|
|
|
props[PROP_VERSION] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_string ("version", NULL, NULL,
|
2014-06-07 05:06:51 +00:00
|
|
|
|
NULL,
|
2014-06-07 05:08:52 +00:00
|
|
|
|
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
2004-11-04 15:13:00 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* GtkAboutDialog:copyright: (attributes org.gtk.Property.get=gtk_about_dialog_get_copyright org.gtk.Property.set=gtk_about_dialog_set_copyright)
|
2004-11-04 15:13:00 +00:00
|
|
|
|
*
|
2009-11-30 00:48:16 +00:00
|
|
|
|
* Copyright information for the program.
|
|
|
|
|
*/
|
2014-06-07 05:06:51 +00:00
|
|
|
|
props[PROP_COPYRIGHT] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_string ("copyright", NULL, NULL,
|
2014-12-23 05:20:11 +00:00
|
|
|
|
NULL,
|
2014-06-07 05:08:52 +00:00
|
|
|
|
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
2004-11-04 15:13:00 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* GtkAboutDialog:comments: (attributes org.gtk.Property.get=gtk_about_dialog_get_comments org.gtk.Property.set=gtk_about_dialog_set_comments)
|
2004-11-04 15:13:00 +00:00
|
|
|
|
*
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* Comments about the program.
|
|
|
|
|
*
|
|
|
|
|
* This string is displayed in a label in the main dialog, thus it
|
|
|
|
|
* should be a short explanation of the main purpose of the program,
|
|
|
|
|
* not a detailed list of features.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2014-06-07 05:06:51 +00:00
|
|
|
|
props[PROP_COMMENTS] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_string ("comments", NULL, NULL,
|
2014-06-07 05:06:51 +00:00
|
|
|
|
NULL,
|
2014-06-07 05:08:52 +00:00
|
|
|
|
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
2004-11-04 15:13:00 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* GtkAboutDialog:license: (attributes org.gtk.Property.get=gtk_about_dialog_get_license org.gtk.Property.set=gtk_about_dialog_set_license)
|
2004-11-04 15:13:00 +00:00
|
|
|
|
*
|
2021-05-18 21:05:26 +00:00
|
|
|
|
* The license of the program, as free-form text.
|
2021-02-18 13:38:55 +00:00
|
|
|
|
*
|
|
|
|
|
* This string is displayed in a text view in a secondary dialog, therefore
|
|
|
|
|
* it is fine to use a long multi-paragraph text. Note that the text is only
|
|
|
|
|
* wrapped in the text view if the "wrap-license" property is set to `TRUE`;
|
2005-07-05 14:53:37 +00:00
|
|
|
|
* otherwise the text itself must contain the intended linebreaks.
|
2004-11-04 15:13:00 +00:00
|
|
|
|
*
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* When setting this property to a non-`NULL` value, the
|
|
|
|
|
* [property@Gtk.AboutDialog:license-type] property is set to
|
|
|
|
|
* `GTK_LICENSE_CUSTOM` as a side effect.
|
|
|
|
|
*
|
|
|
|
|
* The text may contain links in this format `<http://www.some.place/>`
|
|
|
|
|
* and email references in the form `<mail-to@some.body>`, and these will
|
2016-12-30 04:12:42 +00:00
|
|
|
|
* be converted into clickable links.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2014-06-07 05:06:51 +00:00
|
|
|
|
props[PROP_LICENSE] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_string ("license", NULL, NULL,
|
2014-06-07 05:06:51 +00:00
|
|
|
|
NULL,
|
2014-06-07 05:08:52 +00:00
|
|
|
|
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2016-12-30 04:12:42 +00:00
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* GtkAboutDialog:system-information: (attributes org.gtk.Property.get=gtk_about_dialog_get_system_information org.gtk.Property.set=gtk_about_dialog_set_system_information)
|
2016-12-30 04:12:42 +00:00
|
|
|
|
*
|
|
|
|
|
* Information about the system on which the program is running.
|
2021-02-18 13:38:55 +00:00
|
|
|
|
*
|
2021-05-18 21:05:26 +00:00
|
|
|
|
* This information is displayed in a separate page, therefore it is fine
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* to use a long multi-paragraph text. Note that the text should contain
|
2016-12-30 04:12:42 +00:00
|
|
|
|
* the intended linebreaks.
|
|
|
|
|
*
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* The text may contain links in this format `<http://www.some.place/>`
|
|
|
|
|
* and email references in the form `<mail-to@some.body>`, and these will
|
2016-12-30 04:12:42 +00:00
|
|
|
|
* be converted into clickable links.
|
|
|
|
|
*/
|
|
|
|
|
props[PROP_SYSTEM_INFORMATION] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_string ("system-information", NULL, NULL,
|
2016-12-30 04:12:42 +00:00
|
|
|
|
NULL,
|
|
|
|
|
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
|
|
|
|
|
2010-08-10 04:00:15 +00:00
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* GtkAboutDialog:license-type: (attributes org.gtk.Property.get=gtk_about_dialog_get_license_type org.gtk.Property.set=gtk_about_dialog_set_license_type)
|
2010-08-10 04:00:15 +00:00
|
|
|
|
*
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* The license of the program.
|
2010-08-10 04:00:15 +00:00
|
|
|
|
*
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* The `GtkAboutDialog` will automatically fill out a standard disclaimer
|
2010-08-10 04:00:15 +00:00
|
|
|
|
* and link the user to the appropriate online resource for the license
|
|
|
|
|
* text.
|
|
|
|
|
*
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* If `GTK_LICENSE_UNKNOWN` is used, the link used will be the same
|
|
|
|
|
* specified in the [property@Gtk.AboutDialog:website] property.
|
2010-08-10 04:00:15 +00:00
|
|
|
|
*
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* If `GTK_LICENSE_CUSTOM` is used, the current contents of the
|
|
|
|
|
* [property@Gtk.AboutDialog:license] property are used.
|
2010-08-10 04:00:15 +00:00
|
|
|
|
*
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* For any other [enum@Gtk.License] value, the contents of the
|
|
|
|
|
* [property@Gtk.AboutDialog:license] property are also set by this property as
|
2010-08-10 04:00:15 +00:00
|
|
|
|
* a side effect.
|
|
|
|
|
*/
|
2014-06-07 05:06:51 +00:00
|
|
|
|
props[PROP_LICENSE_TYPE] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_enum ("license-type", NULL, NULL,
|
2014-06-07 05:06:51 +00:00
|
|
|
|
GTK_TYPE_LICENSE,
|
|
|
|
|
GTK_LICENSE_UNKNOWN,
|
2014-06-07 05:08:52 +00:00
|
|
|
|
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
2010-08-10 04:00:15 +00:00
|
|
|
|
|
2004-11-04 15:13:00 +00:00
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* GtkAboutDialog:website: (attributes org.gtk.Property.get=gtk_about_dialog_get_website org.gtk.Property.set=gtk_about_dialog_set_website)
|
2004-11-04 15:13:00 +00:00
|
|
|
|
*
|
2009-11-30 00:48:16 +00:00
|
|
|
|
* The URL for the link to the website of the program.
|
2021-02-18 13:38:55 +00:00
|
|
|
|
*
|
|
|
|
|
* This should be a string starting with `http://` or `https://`.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2014-06-07 05:06:51 +00:00
|
|
|
|
props[PROP_WEBSITE] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_string ("website", NULL, NULL,
|
2014-06-07 05:06:51 +00:00
|
|
|
|
NULL,
|
2014-06-07 05:08:52 +00:00
|
|
|
|
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2004-11-04 15:13:00 +00:00
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* GtkAboutDialog:website-label: (attributes org.gtk.Property.get=gtk_about_dialog_get_website_label org.gtk.Property.set=gtk_about_dialog_set_website_label)
|
2004-11-04 15:13:00 +00:00
|
|
|
|
*
|
2010-12-20 16:38:31 +00:00
|
|
|
|
* The label for the link to the website of the program.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2014-06-07 05:06:51 +00:00
|
|
|
|
props[PROP_WEBSITE_LABEL] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_string ("website-label", NULL, NULL,
|
2014-06-07 05:06:51 +00:00
|
|
|
|
NULL,
|
2014-06-07 05:08:52 +00:00
|
|
|
|
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2004-11-04 15:13:00 +00:00
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* GtkAboutDialog:authors: (attributes org.gtk.Property.get=gtk_about_dialog_get_authors org.gtk.Property.set=gtk_about_dialog_set_authors)
|
2004-11-04 15:13:00 +00:00
|
|
|
|
*
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* The authors of the program, as a `NULL`-terminated array of strings.
|
|
|
|
|
*
|
2004-11-04 15:13:00 +00:00
|
|
|
|
* Each string may contain email addresses and URLs, which will be displayed
|
|
|
|
|
* as links, see the introduction for more details.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2014-06-07 05:06:51 +00:00
|
|
|
|
props[PROP_AUTHORS] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_boxed ("authors", NULL, NULL,
|
2014-06-07 05:06:51 +00:00
|
|
|
|
G_TYPE_STRV,
|
2014-06-07 05:08:52 +00:00
|
|
|
|
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
2004-11-04 15:13:00 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* GtkAboutDialog:documenters: (attributes org.gtk.Property.get=gtk_about_dialog_get_documenters org.gtk.Property.set=gtk_about_dialog_set_documenters)
|
2004-11-04 15:13:00 +00:00
|
|
|
|
*
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* The people documenting the program, as a `NULL`-terminated array of strings.
|
|
|
|
|
*
|
2004-11-04 15:13:00 +00:00
|
|
|
|
* Each string may contain email addresses and URLs, which will be displayed
|
|
|
|
|
* as links, see the introduction for more details.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2014-06-07 05:06:51 +00:00
|
|
|
|
props[PROP_DOCUMENTERS] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_boxed ("documenters", NULL, NULL,
|
2014-06-07 05:06:51 +00:00
|
|
|
|
G_TYPE_STRV,
|
2014-06-07 05:08:52 +00:00
|
|
|
|
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2004-11-04 15:13:00 +00:00
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* GtkAboutDialog:artists: (attributes org.gtk.Property.get=gtk_about_dialog_get_artists org.gtk.Property.set=gtk_about_dialog_set_artists)
|
2004-11-04 15:13:00 +00:00
|
|
|
|
*
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* The people who contributed artwork to the program, as a `NULL`-terminated
|
|
|
|
|
* array of strings.
|
|
|
|
|
*
|
|
|
|
|
* Each string may contain email addresses and URLs, which will be displayed
|
|
|
|
|
* as links.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2014-06-07 05:06:51 +00:00
|
|
|
|
props[PROP_ARTISTS] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_boxed ("artists", NULL, NULL,
|
2014-06-07 05:06:51 +00:00
|
|
|
|
G_TYPE_STRV,
|
2014-06-07 05:08:52 +00:00
|
|
|
|
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
2004-11-04 15:13:00 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* GtkAboutDialog:translator-credits: (attributes org.gtk.Property.get=gtk_about_dialog_get_translator_credits org.gtk.Property.set=gtk_about_dialog_set_translator_credits)
|
2004-11-04 15:13:00 +00:00
|
|
|
|
*
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* Credits to the translators.
|
|
|
|
|
*
|
|
|
|
|
* This string should be marked as translatable.
|
2021-02-18 13:38:55 +00:00
|
|
|
|
*
|
2004-11-04 15:13:00 +00:00
|
|
|
|
* The string may contain email addresses and URLs, which will be displayed
|
|
|
|
|
* as links, see the introduction for more details.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2014-06-07 05:06:51 +00:00
|
|
|
|
props[PROP_TRANSLATOR_CREDITS] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_string ("translator-credits", NULL, NULL,
|
2014-06-07 05:06:51 +00:00
|
|
|
|
NULL,
|
2014-06-07 05:08:52 +00:00
|
|
|
|
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
2014-06-07 05:06:51 +00:00
|
|
|
|
|
2004-11-04 15:13:00 +00:00
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* GtkAboutDialog:logo: (attributes org.gtk.Property.get=gtk_about_dialog_get_logo org.gtk.Property.set=gtk_about_dialog_set_logo)
|
2004-11-04 15:13:00 +00:00
|
|
|
|
*
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* A logo for the about box.
|
|
|
|
|
*
|
|
|
|
|
* If it is `NULL`, the default window icon set with
|
|
|
|
|
* [id@gtk_window_set_default_icon_name] will be used.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2014-06-07 05:06:51 +00:00
|
|
|
|
props[PROP_LOGO] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_object ("logo", NULL, NULL,
|
2018-02-18 04:05:40 +00:00
|
|
|
|
GDK_TYPE_PAINTABLE,
|
2017-11-05 05:50:28 +00:00
|
|
|
|
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2004-11-04 15:13:00 +00:00
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* GtkAboutDialog:logo-icon-name: (attributes org.gtk.Property.get=gtk_about_dialog_get_logo_icon_name org.gtk.Property.set=gtk_about_dialog_set_logo_icon_name)
|
2004-11-04 15:13:00 +00:00
|
|
|
|
*
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* A named icon to use as the logo for the about box.
|
|
|
|
|
*
|
|
|
|
|
* This property overrides the [property@Gtk.AboutDialog:logo] property.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2014-06-07 05:06:51 +00:00
|
|
|
|
props[PROP_LOGO_ICON_NAME] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_string ("logo-icon-name", NULL, NULL,
|
2020-02-18 09:36:04 +00:00
|
|
|
|
NULL,
|
2014-06-07 05:08:52 +00:00
|
|
|
|
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
2014-06-07 05:06:51 +00:00
|
|
|
|
|
2005-07-05 14:53:37 +00:00
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* GtkAboutDialog:wrap-license: (attributes org.gtk.Property.get=gtk_about_dialog_get_wrap_license org.gtk.Property.set=gtk_about_dialog_set_wrap_license)
|
2005-07-05 14:53:37 +00:00
|
|
|
|
*
|
|
|
|
|
* Whether to wrap the text in the license dialog.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2014-06-07 05:06:51 +00:00
|
|
|
|
props[PROP_WRAP_LICENSE] =
|
2022-05-11 12:19:39 +00:00
|
|
|
|
g_param_spec_boolean ("wrap-license", NULL, NULL,
|
2014-06-07 05:06:51 +00:00
|
|
|
|
FALSE,
|
2014-06-07 05:08:52 +00:00
|
|
|
|
GTK_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
|
2014-06-07 05:06:51 +00:00
|
|
|
|
|
|
|
|
|
g_object_class_install_properties (object_class, LAST_PROP, props);
|
2004-10-25 18:41:11 +00:00
|
|
|
|
|
2020-10-05 15:20:27 +00:00
|
|
|
|
/*
|
|
|
|
|
* Key bindings
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
gtk_widget_class_add_binding_action (widget_class, GDK_KEY_Escape, 0, "window.close", NULL);
|
|
|
|
|
|
2013-03-22 12:51:40 +00:00
|
|
|
|
/* Bind class to template
|
|
|
|
|
*/
|
|
|
|
|
gtk_widget_class_set_template_from_resource (widget_class,
|
2014-01-23 23:59:20 +00:00
|
|
|
|
"/org/gtk/libgtk/ui/gtkaboutdialog.ui");
|
2013-03-22 12:51:40 +00:00
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkAboutDialog, stack);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkAboutDialog, stack_switcher);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkAboutDialog, logo_image);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkAboutDialog, name_label);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkAboutDialog, version_label);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkAboutDialog, comments_label);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkAboutDialog, copyright_label);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkAboutDialog, license_label);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkAboutDialog, website_label);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkAboutDialog, credits_page);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkAboutDialog, license_page);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkAboutDialog, system_page);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkAboutDialog, credits_grid);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkAboutDialog, license_view);
|
|
|
|
|
gtk_widget_class_bind_template_child (widget_class, GtkAboutDialog, system_view);
|
2013-07-26 17:49:49 +00:00
|
|
|
|
|
|
|
|
|
gtk_widget_class_bind_template_callback (widget_class, emit_activate_link);
|
2018-03-08 23:35:18 +00:00
|
|
|
|
gtk_widget_class_bind_template_callback (widget_class, text_view_released);
|
|
|
|
|
gtk_widget_class_bind_template_callback (widget_class, text_view_motion);
|
|
|
|
|
gtk_widget_class_bind_template_callback (widget_class, text_view_key_pressed);
|
2013-12-08 12:40:50 +00:00
|
|
|
|
gtk_widget_class_bind_template_callback (widget_class, stack_visible_child_notify);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-11-30 00:00:28 +00:00
|
|
|
|
static gboolean
|
2010-09-22 01:55:05 +00:00
|
|
|
|
emit_activate_link (GtkAboutDialog *about,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *uri)
|
2009-11-30 00:00:28 +00:00
|
|
|
|
{
|
2010-09-22 01:55:05 +00:00
|
|
|
|
gboolean handled = FALSE;
|
2009-11-30 00:00:28 +00:00
|
|
|
|
|
2010-09-22 01:55:05 +00:00
|
|
|
|
g_signal_emit (about, signals[ACTIVATE_LINK], 0, uri, &handled);
|
2009-11-30 00:00:28 +00:00
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-08 12:40:50 +00:00
|
|
|
|
static void
|
|
|
|
|
update_stack_switcher_visibility (GtkAboutDialog *about)
|
|
|
|
|
{
|
2019-02-12 05:10:00 +00:00
|
|
|
|
GtkStackPage *page;
|
2020-02-18 08:31:32 +00:00
|
|
|
|
gboolean any_visible = FALSE;
|
2019-02-12 05:10:00 +00:00
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
page = gtk_stack_get_page (GTK_STACK (about->stack), about->credits_page);
|
2020-02-18 08:31:32 +00:00
|
|
|
|
any_visible |= gtk_stack_page_get_visible (page);
|
2020-03-28 04:42:44 +00:00
|
|
|
|
page = gtk_stack_get_page (GTK_STACK (about->stack), about->license_page);
|
2020-02-18 08:31:32 +00:00
|
|
|
|
any_visible |= gtk_stack_page_get_visible (page);
|
2020-03-28 04:42:44 +00:00
|
|
|
|
page = gtk_stack_get_page (GTK_STACK (about->stack), about->system_page);
|
2020-02-18 08:31:32 +00:00
|
|
|
|
any_visible |= gtk_stack_page_get_visible (page);
|
2019-02-12 05:10:00 +00:00
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
gtk_widget_set_visible (about->stack_switcher, any_visible);
|
2013-12-08 12:40:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-10 06:27:55 +00:00
|
|
|
|
static void
|
|
|
|
|
update_license_button_visibility (GtkAboutDialog *about)
|
|
|
|
|
{
|
2019-02-12 05:10:00 +00:00
|
|
|
|
GtkStackPage *page;
|
2010-12-10 06:27:55 +00:00
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
page = gtk_stack_get_page (GTK_STACK (about->stack), about->license_page);
|
2020-02-18 08:31:32 +00:00
|
|
|
|
gtk_stack_page_set_visible (page,
|
2020-03-28 04:42:44 +00:00
|
|
|
|
about->license_type == GTK_LICENSE_CUSTOM &&
|
|
|
|
|
about->license != NULL &&
|
|
|
|
|
about->license[0] != '\0');
|
2013-12-08 12:40:50 +00:00
|
|
|
|
|
|
|
|
|
update_stack_switcher_visibility (about);
|
2010-12-10 06:27:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-12-30 04:12:42 +00:00
|
|
|
|
static void
|
|
|
|
|
update_system_button_visibility (GtkAboutDialog *about)
|
|
|
|
|
{
|
2019-02-12 05:10:00 +00:00
|
|
|
|
GtkStackPage *page;
|
2016-12-30 04:12:42 +00:00
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
page = gtk_stack_get_page (GTK_STACK (about->stack), about->system_page);
|
2020-02-18 08:31:32 +00:00
|
|
|
|
gtk_stack_page_set_visible (page,
|
2020-03-28 04:42:44 +00:00
|
|
|
|
about->system_information != NULL &&
|
|
|
|
|
about->system_information[0] != '\0');
|
2016-12-30 04:12:42 +00:00
|
|
|
|
|
|
|
|
|
update_stack_switcher_visibility (about);
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-10 06:27:55 +00:00
|
|
|
|
static void
|
|
|
|
|
update_credits_button_visibility (GtkAboutDialog *about)
|
|
|
|
|
{
|
|
|
|
|
gboolean show;
|
2019-02-12 05:10:00 +00:00
|
|
|
|
GtkStackPage *page;
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
page = gtk_stack_get_page (GTK_STACK (about->stack), about->credits_page);
|
2010-12-10 06:27:55 +00:00
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
show = (about->authors != NULL ||
|
|
|
|
|
about->documenters != NULL ||
|
|
|
|
|
about->artists != NULL ||
|
|
|
|
|
about->credit_sections != NULL ||
|
|
|
|
|
(about->translator_credits != NULL &&
|
|
|
|
|
strcmp (about->translator_credits, "translator_credits") &&
|
|
|
|
|
strcmp (about->translator_credits, "translator-credits")));
|
2020-02-18 08:31:32 +00:00
|
|
|
|
gtk_stack_page_set_visible (page, show);
|
2013-12-08 12:40:50 +00:00
|
|
|
|
|
|
|
|
|
update_stack_switcher_visibility (about);
|
2010-12-10 06:27:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-07-12 16:38:04 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_about_dialog_init (GtkAboutDialog *about)
|
|
|
|
|
{
|
2022-10-09 04:14:20 +00:00
|
|
|
|
GtkCssNode *node;
|
|
|
|
|
GtkStateFlags state;
|
|
|
|
|
|
2004-07-12 16:38:04 +00:00
|
|
|
|
/* Data */
|
2020-03-28 04:42:44 +00:00
|
|
|
|
about->name = NULL;
|
|
|
|
|
about->version = NULL;
|
|
|
|
|
about->copyright = NULL;
|
|
|
|
|
about->comments = NULL;
|
|
|
|
|
about->website_url = NULL;
|
|
|
|
|
about->website_text = NULL;
|
|
|
|
|
about->translator_credits = NULL;
|
|
|
|
|
about->license = NULL;
|
|
|
|
|
about->authors = NULL;
|
|
|
|
|
about->documenters = NULL;
|
|
|
|
|
about->artists = NULL;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
about->hovering_over_link = FALSE;
|
|
|
|
|
about->wrap_license = FALSE;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
about->license_type = GTK_LICENSE_UNKNOWN;
|
2010-08-10 04:00:15 +00:00
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
about->visited_links = g_ptr_array_new_with_free_func (g_free);
|
2020-02-18 08:42:29 +00:00
|
|
|
|
|
2013-03-22 12:51:40 +00:00
|
|
|
|
gtk_widget_init_template (GTK_WIDGET (about));
|
2010-12-10 06:27:55 +00:00
|
|
|
|
|
2020-10-05 15:20:27 +00:00
|
|
|
|
gtk_stack_set_visible_child_name (GTK_STACK (about->stack), "main");
|
2013-12-08 12:40:50 +00:00
|
|
|
|
update_stack_switcher_visibility (about);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2005-02-24 03:46:25 +00:00
|
|
|
|
/* force defaults */
|
2007-05-14 18:33:53 +00:00
|
|
|
|
gtk_about_dialog_set_program_name (about, NULL);
|
2005-02-24 03:46:25 +00:00
|
|
|
|
gtk_about_dialog_set_logo (about, NULL);
|
2022-10-09 04:14:20 +00:00
|
|
|
|
|
|
|
|
|
node = gtk_widget_get_css_node (GTK_WIDGET (about));
|
|
|
|
|
state = gtk_css_node_get_state (node);
|
|
|
|
|
|
|
|
|
|
about->link_node = gtk_css_node_new ();
|
|
|
|
|
gtk_css_node_set_name (about->link_node, g_quark_from_static_string ("link"));
|
|
|
|
|
gtk_css_node_set_parent (about->link_node, node);
|
|
|
|
|
gtk_css_node_set_state (about->link_node, state | GTK_STATE_FLAG_LINK);
|
|
|
|
|
g_object_unref (about->link_node);
|
|
|
|
|
|
|
|
|
|
about->visited_link_node = gtk_css_node_new ();
|
|
|
|
|
gtk_css_node_set_name (about->visited_link_node, g_quark_from_static_string ("link"));
|
|
|
|
|
gtk_css_node_set_parent (about->visited_link_node, node);
|
|
|
|
|
gtk_css_node_set_state (about->visited_link_node, state | GTK_STATE_FLAG_VISITED);
|
|
|
|
|
g_object_unref (about->visited_link_node);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-01-31 01:46:44 +00:00
|
|
|
|
static void
|
|
|
|
|
destroy_credit_section (gpointer data)
|
2012-01-25 23:21:47 +00:00
|
|
|
|
{
|
|
|
|
|
CreditSection *cs = data;
|
|
|
|
|
g_free (cs->heading);
|
|
|
|
|
g_strfreev (cs->people);
|
|
|
|
|
g_slice_free (CreditSection, data);
|
|
|
|
|
}
|
|
|
|
|
|
2004-07-12 16:38:04 +00:00
|
|
|
|
static void
|
|
|
|
|
gtk_about_dialog_finalize (GObject *object)
|
|
|
|
|
{
|
|
|
|
|
GtkAboutDialog *about = GTK_ABOUT_DIALOG (object);
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
g_free (about->name);
|
|
|
|
|
g_free (about->version);
|
|
|
|
|
g_free (about->copyright);
|
|
|
|
|
g_free (about->comments);
|
|
|
|
|
g_free (about->license);
|
|
|
|
|
g_free (about->website_url);
|
|
|
|
|
g_free (about->website_text);
|
|
|
|
|
g_free (about->translator_credits);
|
|
|
|
|
g_free (about->system_information);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
g_strfreev (about->authors);
|
|
|
|
|
g_strfreev (about->documenters);
|
|
|
|
|
g_strfreev (about->artists);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
g_slist_free_full (about->credit_sections, destroy_credit_section);
|
|
|
|
|
g_ptr_array_unref (about->visited_links);
|
2006-01-24 00:20:06 +00:00
|
|
|
|
|
2004-07-12 16:38:04 +00:00
|
|
|
|
G_OBJECT_CLASS (gtk_about_dialog_parent_class)->finalize (object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2009-11-30 00:48:16 +00:00
|
|
|
|
gtk_about_dialog_set_property (GObject *object,
|
|
|
|
|
guint prop_id,
|
|
|
|
|
const GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
|
|
|
|
GtkAboutDialog *about = GTK_ABOUT_DIALOG (object);
|
|
|
|
|
|
2009-11-30 00:48:16 +00:00
|
|
|
|
switch (prop_id)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
|
|
|
|
case PROP_NAME:
|
2007-05-14 18:33:53 +00:00
|
|
|
|
gtk_about_dialog_set_program_name (about, g_value_get_string (value));
|
2004-07-12 16:38:04 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_VERSION:
|
|
|
|
|
gtk_about_dialog_set_version (about, g_value_get_string (value));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_COMMENTS:
|
|
|
|
|
gtk_about_dialog_set_comments (about, g_value_get_string (value));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_WEBSITE:
|
|
|
|
|
gtk_about_dialog_set_website (about, g_value_get_string (value));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_WEBSITE_LABEL:
|
|
|
|
|
gtk_about_dialog_set_website_label (about, g_value_get_string (value));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_LICENSE:
|
|
|
|
|
gtk_about_dialog_set_license (about, g_value_get_string (value));
|
|
|
|
|
break;
|
2016-12-30 04:12:42 +00:00
|
|
|
|
case PROP_SYSTEM_INFORMATION:
|
|
|
|
|
gtk_about_dialog_set_system_information (about, g_value_get_string (value));
|
|
|
|
|
break;
|
2010-08-10 04:00:15 +00:00
|
|
|
|
case PROP_LICENSE_TYPE:
|
|
|
|
|
gtk_about_dialog_set_license_type (about, g_value_get_enum (value));
|
|
|
|
|
break;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
case PROP_COPYRIGHT:
|
|
|
|
|
gtk_about_dialog_set_copyright (about, g_value_get_string (value));
|
|
|
|
|
break;
|
|
|
|
|
case PROP_LOGO:
|
2017-11-04 18:10:46 +00:00
|
|
|
|
gtk_about_dialog_set_logo (about, g_value_get_object (value));
|
2009-11-30 00:48:16 +00:00
|
|
|
|
break;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
case PROP_AUTHORS:
|
2020-07-24 18:40:36 +00:00
|
|
|
|
gtk_about_dialog_set_authors (about, (const char **)g_value_get_boxed (value));
|
2004-07-12 16:38:04 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_DOCUMENTERS:
|
2020-07-24 18:40:36 +00:00
|
|
|
|
gtk_about_dialog_set_documenters (about, (const char **)g_value_get_boxed (value));
|
2009-11-30 00:48:16 +00:00
|
|
|
|
break;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
case PROP_ARTISTS:
|
2020-07-24 18:40:36 +00:00
|
|
|
|
gtk_about_dialog_set_artists (about, (const char **)g_value_get_boxed (value));
|
2009-11-30 00:48:16 +00:00
|
|
|
|
break;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
case PROP_TRANSLATOR_CREDITS:
|
|
|
|
|
gtk_about_dialog_set_translator_credits (about, g_value_get_string (value));
|
|
|
|
|
break;
|
2004-10-25 18:41:11 +00:00
|
|
|
|
case PROP_LOGO_ICON_NAME:
|
|
|
|
|
gtk_about_dialog_set_logo_icon_name (about, g_value_get_string (value));
|
|
|
|
|
break;
|
2005-07-05 14:53:37 +00:00
|
|
|
|
case PROP_WRAP_LICENSE:
|
2014-06-07 15:45:14 +00:00
|
|
|
|
gtk_about_dialog_set_wrap_license (about, g_value_get_boolean (value));
|
2005-07-05 14:53:37 +00:00
|
|
|
|
break;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2009-11-30 00:48:16 +00:00
|
|
|
|
gtk_about_dialog_get_property (GObject *object,
|
|
|
|
|
guint prop_id,
|
|
|
|
|
GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
|
|
|
|
GtkAboutDialog *about = GTK_ABOUT_DIALOG (object);
|
2014-12-23 05:20:11 +00:00
|
|
|
|
|
|
|
|
|
switch (prop_id)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
|
|
|
|
case PROP_NAME:
|
2020-03-28 04:42:44 +00:00
|
|
|
|
g_value_set_string (value, about->name);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_VERSION:
|
2020-03-28 04:42:44 +00:00
|
|
|
|
g_value_set_string (value, about->version);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_COPYRIGHT:
|
2020-03-28 04:42:44 +00:00
|
|
|
|
g_value_set_string (value, about->copyright);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_COMMENTS:
|
2020-03-28 04:42:44 +00:00
|
|
|
|
g_value_set_string (value, about->comments);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_WEBSITE:
|
2020-03-28 04:42:44 +00:00
|
|
|
|
g_value_set_string (value, about->website_url);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_WEBSITE_LABEL:
|
2020-03-28 04:42:44 +00:00
|
|
|
|
g_value_set_string (value, about->website_text);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_LICENSE:
|
2020-03-28 04:42:44 +00:00
|
|
|
|
g_value_set_string (value, about->license);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
break;
|
2016-12-30 04:12:42 +00:00
|
|
|
|
case PROP_SYSTEM_INFORMATION:
|
2020-03-28 04:42:44 +00:00
|
|
|
|
g_value_set_string (value, about->system_information);
|
2016-12-30 04:12:42 +00:00
|
|
|
|
break;
|
2010-08-10 04:00:15 +00:00
|
|
|
|
case PROP_LICENSE_TYPE:
|
2020-03-28 04:42:44 +00:00
|
|
|
|
g_value_set_enum (value, about->license_type);
|
2010-08-10 04:00:15 +00:00
|
|
|
|
break;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
case PROP_TRANSLATOR_CREDITS:
|
2020-03-28 04:42:44 +00:00
|
|
|
|
g_value_set_string (value, about->translator_credits);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_AUTHORS:
|
2020-03-28 04:42:44 +00:00
|
|
|
|
g_value_set_boxed (value, about->authors);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_DOCUMENTERS:
|
2020-03-28 04:42:44 +00:00
|
|
|
|
g_value_set_boxed (value, about->documenters);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_ARTISTS:
|
2020-03-28 04:42:44 +00:00
|
|
|
|
g_value_set_boxed (value, about->artists);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_LOGO:
|
2020-03-28 04:42:44 +00:00
|
|
|
|
if (gtk_image_get_storage_type (GTK_IMAGE (about->logo_image)) == GTK_IMAGE_PAINTABLE)
|
|
|
|
|
g_value_set_object (value, gtk_image_get_paintable (GTK_IMAGE (about->logo_image)));
|
2004-10-25 18:41:11 +00:00
|
|
|
|
else
|
2017-11-05 05:50:28 +00:00
|
|
|
|
g_value_set_object (value, NULL);
|
2004-10-25 18:41:11 +00:00
|
|
|
|
break;
|
|
|
|
|
case PROP_LOGO_ICON_NAME:
|
2020-03-28 04:42:44 +00:00
|
|
|
|
if (gtk_image_get_storage_type (GTK_IMAGE (about->logo_image)) == GTK_IMAGE_ICON_NAME)
|
|
|
|
|
g_value_set_string (value, gtk_image_get_icon_name (GTK_IMAGE (about->logo_image)));
|
2004-10-25 18:41:11 +00:00
|
|
|
|
else
|
2009-11-30 00:48:16 +00:00
|
|
|
|
g_value_set_string (value, NULL);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
break;
|
2005-07-05 14:53:37 +00:00
|
|
|
|
case PROP_WRAP_LICENSE:
|
2020-03-28 04:42:44 +00:00
|
|
|
|
g_value_set_boolean (value, about->wrap_license);
|
2005-07-05 14:53:37 +00:00
|
|
|
|
break;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-22 01:55:05 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
gtk_about_dialog_activate_link (GtkAboutDialog *about,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *uri)
|
2010-09-22 01:55:05 +00:00
|
|
|
|
{
|
2022-11-29 19:11:26 +00:00
|
|
|
|
GtkFileLauncher *launcher;
|
|
|
|
|
GFile *file;
|
|
|
|
|
|
|
|
|
|
file = g_file_new_for_uri (uri);
|
2022-12-13 12:49:02 +00:00
|
|
|
|
launcher = gtk_file_launcher_new (file);
|
2022-11-29 19:11:26 +00:00
|
|
|
|
|
2022-12-13 12:49:02 +00:00
|
|
|
|
gtk_file_launcher_launch (launcher, GTK_WINDOW (about), NULL, NULL, NULL);
|
2022-11-29 19:11:26 +00:00
|
|
|
|
|
|
|
|
|
g_object_unref (launcher);
|
|
|
|
|
g_object_unref (file);
|
|
|
|
|
|
2010-09-22 01:55:05 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2009-01-05 03:38:10 +00:00
|
|
|
|
static void
|
|
|
|
|
update_website (GtkAboutDialog *about)
|
|
|
|
|
{
|
2022-11-28 18:43:36 +00:00
|
|
|
|
gtk_widget_set_visible (about->website_label, TRUE);
|
2009-01-05 03:38:10 +00:00
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
if (about->website_url)
|
2009-01-05 03:38:10 +00:00
|
|
|
|
{
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char *markup;
|
2009-01-05 03:38:10 +00:00
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
if (about->website_text)
|
2009-11-30 00:00:28 +00:00
|
|
|
|
{
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char *escaped;
|
2009-11-30 00:00:28 +00:00
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
escaped = g_markup_escape_text (about->website_text, -1);
|
2009-11-30 00:00:28 +00:00
|
|
|
|
markup = g_strdup_printf ("<a href=\"%s\">%s</a>",
|
2020-03-28 04:42:44 +00:00
|
|
|
|
about->website_url, escaped);
|
2009-11-30 00:00:28 +00:00
|
|
|
|
g_free (escaped);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
markup = g_strdup_printf ("<a href=\"%s\">%s</a>",
|
2020-03-28 04:42:44 +00:00
|
|
|
|
about->website_url, _("Website"));
|
2009-11-30 00:00:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
gtk_label_set_markup (GTK_LABEL (about->website_label), markup);
|
2009-11-30 00:00:28 +00:00
|
|
|
|
g_free (markup);
|
2009-01-05 03:38:10 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-03-28 04:42:44 +00:00
|
|
|
|
if (about->website_text)
|
|
|
|
|
gtk_label_set_text (GTK_LABEL (about->website_label), about->website_text);
|
2009-01-05 03:38:10 +00:00
|
|
|
|
else
|
2022-11-28 18:43:36 +00:00
|
|
|
|
gtk_widget_set_visible (about->website_label, FALSE);
|
2009-01-05 03:38:10 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2007-05-14 18:33:53 +00:00
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* gtk_about_dialog_get_program_name: (attributes org.gtk.Method.get_property=program-name)
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: a `GtkAboutDialog`
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
2007-05-14 18:33:53 +00:00
|
|
|
|
* Returns the program name displayed in the about dialog.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
2021-05-18 21:05:26 +00:00
|
|
|
|
* Returns: (nullable): The program name
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *
|
2007-05-14 18:33:53 +00:00
|
|
|
|
gtk_about_dialog_get_program_name (GtkAboutDialog *about)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
return about->name;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
update_name_version (GtkAboutDialog *about)
|
|
|
|
|
{
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char *title_string, *name_string;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
title_string = g_strdup_printf (_("About %s"), about->name);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
gtk_window_set_title (GTK_WINDOW (about), title_string);
|
|
|
|
|
g_free (title_string);
|
|
|
|
|
|
2022-11-28 18:43:36 +00:00
|
|
|
|
gtk_widget_set_visible (about->version_label, about->version != NULL);
|
2020-03-28 04:42:44 +00:00
|
|
|
|
if (about->version != NULL)
|
2022-11-28 18:43:36 +00:00
|
|
|
|
gtk_label_set_markup (GTK_LABEL (about->version_label), about->version);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2010-12-10 06:27:55 +00:00
|
|
|
|
name_string = g_markup_printf_escaped ("<span weight=\"bold\">%s</span>",
|
2020-03-28 04:42:44 +00:00
|
|
|
|
about->name);
|
|
|
|
|
gtk_label_set_markup (GTK_LABEL (about->name_label), name_string);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
g_free (name_string);
|
|
|
|
|
}
|
|
|
|
|
|
2007-05-14 18:33:53 +00:00
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* gtk_about_dialog_set_program_name: (attributes org.gtk.Method.set_property=program-name)
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: a `GtkAboutDialog`
|
|
|
|
|
* @name: (nullable): the program name
|
2007-05-14 18:33:53 +00:00
|
|
|
|
*
|
2009-11-30 00:48:16 +00:00
|
|
|
|
* Sets the name to display in the about dialog.
|
2021-02-18 13:38:55 +00:00
|
|
|
|
*
|
2021-05-18 21:05:26 +00:00
|
|
|
|
* If `name` is not set, the string returned
|
|
|
|
|
* by `g_get_application_name()` is used.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2007-05-14 18:33:53 +00:00
|
|
|
|
void
|
2009-11-30 00:48:16 +00:00
|
|
|
|
gtk_about_dialog_set_program_name (GtkAboutDialog *about,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *name)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char *tmp;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
2009-11-30 00:48:16 +00:00
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
tmp = about->name;
|
|
|
|
|
about->name = g_strdup (name ? name : g_get_application_name ());
|
2004-07-12 16:38:04 +00:00
|
|
|
|
g_free (tmp);
|
|
|
|
|
|
|
|
|
|
update_name_version (about);
|
|
|
|
|
|
2014-06-07 05:06:51 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (about), props[PROP_NAME]);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-05-14 18:33:53 +00:00
|
|
|
|
|
2004-07-12 16:38:04 +00:00
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* gtk_about_dialog_get_version: (attributes org.gtk.Method.get_property=version)
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: a `GtkAboutDialog`
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
2004-07-12 16:38:04 +00:00
|
|
|
|
* Returns the version string.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
2021-05-18 21:05:26 +00:00
|
|
|
|
* Returns: (nullable): The version string
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *
|
2004-07-12 16:38:04 +00:00
|
|
|
|
gtk_about_dialog_get_version (GtkAboutDialog *about)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
return about->version;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* gtk_about_dialog_set_version: (attributes org.gtk.Method.set_property=version)
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: a `GtkAboutDialog`
|
|
|
|
|
* @version: (nullable): the version string
|
2004-07-12 16:38:04 +00:00
|
|
|
|
*
|
|
|
|
|
* Sets the version string to display in the about dialog.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2004-07-12 16:38:04 +00:00
|
|
|
|
void
|
2009-11-30 00:48:16 +00:00
|
|
|
|
gtk_about_dialog_set_version (GtkAboutDialog *about,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *version)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char *tmp;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
tmp = about->version;
|
|
|
|
|
about->version = g_strdup (version);
|
2009-11-30 00:48:16 +00:00
|
|
|
|
g_free (tmp);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
|
|
|
|
update_name_version (about);
|
|
|
|
|
|
2014-06-07 05:06:51 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (about), props[PROP_VERSION]);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* gtk_about_dialog_get_copyright: (attributes org.gtk.Method.get_property=copyright)
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: a `GtkAboutDialog`
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
2004-07-12 16:38:04 +00:00
|
|
|
|
* Returns the copyright string.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
2021-05-18 21:05:26 +00:00
|
|
|
|
* Returns: (nullable): The copyright string
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *
|
2004-07-12 16:38:04 +00:00
|
|
|
|
gtk_about_dialog_get_copyright (GtkAboutDialog *about)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
return about->copyright;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* gtk_about_dialog_set_copyright: (attributes org.gtk.Method.set_property=copyright)
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: a `GtkAboutDialog`
|
|
|
|
|
* @copyright: (nullable): the copyright string
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
2004-07-12 16:38:04 +00:00
|
|
|
|
* Sets the copyright string to display in the about dialog.
|
2021-02-18 13:38:55 +00:00
|
|
|
|
*
|
2009-11-30 00:48:16 +00:00
|
|
|
|
* This should be a short string of one or two lines.
|
|
|
|
|
*/
|
2004-07-12 16:38:04 +00:00
|
|
|
|
void
|
2009-11-30 00:48:16 +00:00
|
|
|
|
gtk_about_dialog_set_copyright (GtkAboutDialog *about,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *copyright)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char *copyright_string, *tmp;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
tmp = about->copyright;
|
|
|
|
|
about->copyright = g_strdup (copyright);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
g_free (tmp);
|
2009-11-30 00:48:16 +00:00
|
|
|
|
|
2022-11-28 18:43:36 +00:00
|
|
|
|
gtk_widget_set_visible (about->copyright_label, about->copyright != NULL);
|
2020-03-28 04:42:44 +00:00
|
|
|
|
if (about->copyright != NULL)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
2009-11-30 00:48:16 +00:00
|
|
|
|
copyright_string = g_markup_printf_escaped ("<span size=\"small\">%s</span>",
|
2020-03-28 04:42:44 +00:00
|
|
|
|
about->copyright);
|
|
|
|
|
gtk_label_set_markup (GTK_LABEL (about->copyright_label), copyright_string);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
g_free (copyright_string);
|
|
|
|
|
}
|
2009-11-30 00:48:16 +00:00
|
|
|
|
|
2014-06-07 05:06:51 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (about), props[PROP_COPYRIGHT]);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* gtk_about_dialog_get_comments: (attributes org.gtk.Method.set_property=comments)
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: a `GtkAboutDialog`
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
2004-07-12 16:38:04 +00:00
|
|
|
|
* Returns the comments string.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
2021-05-18 21:05:26 +00:00
|
|
|
|
* Returns: (nullable): The comments
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *
|
2004-07-12 16:38:04 +00:00
|
|
|
|
gtk_about_dialog_get_comments (GtkAboutDialog *about)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
return about->comments;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* gtk_about_dialog_set_comments: (attributes org.gtk.Method.set_property=comments)
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: a `GtkAboutDialog`
|
|
|
|
|
* @comments: (nullable): a comments string
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
|
|
|
|
* Sets the comments string to display in the about dialog.
|
2021-02-18 13:38:55 +00:00
|
|
|
|
*
|
2009-11-30 00:48:16 +00:00
|
|
|
|
* This should be a short string of one or two lines.
|
|
|
|
|
*/
|
2004-07-12 16:38:04 +00:00
|
|
|
|
void
|
2009-11-30 00:48:16 +00:00
|
|
|
|
gtk_about_dialog_set_comments (GtkAboutDialog *about,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *comments)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char *tmp;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
tmp = about->comments;
|
2009-11-30 00:48:16 +00:00
|
|
|
|
if (comments)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
2020-03-28 04:42:44 +00:00
|
|
|
|
about->comments = g_strdup (comments);
|
|
|
|
|
gtk_label_set_text (GTK_LABEL (about->comments_label), about->comments);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-03-28 04:42:44 +00:00
|
|
|
|
about->comments = NULL;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
2022-11-28 18:43:36 +00:00
|
|
|
|
|
|
|
|
|
gtk_widget_set_visible (about->comments_label, about->comments != NULL);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
g_free (tmp);
|
|
|
|
|
|
2014-06-07 05:06:51 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (about), props[PROP_COMMENTS]);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* gtk_about_dialog_get_license: (attributes org.gtk.Method.get_property=license)
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: a `GtkAboutDialog`
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
2004-07-12 16:38:04 +00:00
|
|
|
|
* Returns the license information.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
2021-05-18 21:05:26 +00:00
|
|
|
|
* Returns: (nullable): The license information
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *
|
2004-07-12 16:38:04 +00:00
|
|
|
|
gtk_about_dialog_get_license (GtkAboutDialog *about)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
return about->license;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* gtk_about_dialog_set_license: (attributes org.gtk.Method.set_property=license)
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: a `GtkAboutDialog`
|
|
|
|
|
* @license: (nullable): the license information
|
2004-07-12 16:38:04 +00:00
|
|
|
|
*
|
2021-05-18 21:05:26 +00:00
|
|
|
|
* Sets the license information to be displayed in the
|
|
|
|
|
* about dialog.
|
2021-02-18 13:38:55 +00:00
|
|
|
|
*
|
2021-05-18 21:05:26 +00:00
|
|
|
|
* If `license` is `NULL`, the license page is hidden.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2004-07-12 16:38:04 +00:00
|
|
|
|
void
|
2009-11-30 00:48:16 +00:00
|
|
|
|
gtk_about_dialog_set_license (GtkAboutDialog *about,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *license)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char *tmp;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
tmp = about->license;
|
2009-11-30 00:48:16 +00:00
|
|
|
|
if (license)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
2020-03-28 04:42:44 +00:00
|
|
|
|
about->license = g_strdup (license);
|
|
|
|
|
about->license_type = GTK_LICENSE_CUSTOM;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-03-28 04:42:44 +00:00
|
|
|
|
about->license = NULL;
|
|
|
|
|
about->license_type = GTK_LICENSE_UNKNOWN;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
g_free (tmp);
|
|
|
|
|
|
2022-11-28 18:43:36 +00:00
|
|
|
|
gtk_widget_set_visible (about->license_label, FALSE);
|
2010-12-10 06:27:55 +00:00
|
|
|
|
|
|
|
|
|
update_license_button_visibility (about);
|
|
|
|
|
|
2014-06-07 05:06:51 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (about), props[PROP_LICENSE]);
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (about), props[PROP_LICENSE_TYPE]);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-12-01 23:00:39 +00:00
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* gtk_about_dialog_get_system_information: (attributes org.gtk.Method.get_property=system-information)
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: a `GtkAboutDialog`
|
2017-12-01 23:00:39 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns the system information that is shown in the about dialog.
|
|
|
|
|
*
|
2020-10-19 13:46:32 +00:00
|
|
|
|
* Returns: (nullable): the system information
|
2017-12-01 23:00:39 +00:00
|
|
|
|
*/
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *
|
2016-12-30 04:12:42 +00:00
|
|
|
|
gtk_about_dialog_get_system_information (GtkAboutDialog *about)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
return about->system_information;
|
2016-12-30 04:12:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-12-01 23:00:39 +00:00
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* gtk_about_dialog_set_system_information: (attributes org.gtk.Method.set_property=system-information)
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: a `GtkAboutDialog`
|
|
|
|
|
* @system_information: (nullable): system information
|
2017-12-01 23:00:39 +00:00
|
|
|
|
*
|
|
|
|
|
* Sets the system information to be displayed in the about
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* dialog.
|
|
|
|
|
*
|
|
|
|
|
* If `system_information` is `NULL`, the system information
|
2021-05-18 21:05:26 +00:00
|
|
|
|
* page is hidden.
|
2017-12-01 23:00:39 +00:00
|
|
|
|
*
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* See [property@Gtk.AboutDialog:system-information].
|
2017-12-01 23:00:39 +00:00
|
|
|
|
*/
|
2016-12-30 04:12:42 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_about_dialog_set_system_information (GtkAboutDialog *about,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *system_information)
|
2016-12-30 04:12:42 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
g_free (about->system_information);
|
|
|
|
|
about->system_information = g_strdup (system_information);
|
2016-12-30 04:12:42 +00:00
|
|
|
|
update_system_button_visibility (about);
|
|
|
|
|
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (about), props[PROP_SYSTEM_INFORMATION]);
|
|
|
|
|
}
|
|
|
|
|
|
2005-07-05 14:53:37 +00:00
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* gtk_about_dialog_get_wrap_license: (attributes org.gtk.Method.get_property=wrap-license)
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: a `GtkAboutDialog`
|
2005-07-05 14:53:37 +00:00
|
|
|
|
*
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* Returns whether the license text in the about dialog is
|
2005-07-05 14:53:37 +00:00
|
|
|
|
* automatically wrapped.
|
|
|
|
|
*
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* Returns: `TRUE` if the license text is wrapped
|
2005-07-05 14:53:37 +00:00
|
|
|
|
*/
|
|
|
|
|
gboolean
|
|
|
|
|
gtk_about_dialog_get_wrap_license (GtkAboutDialog *about)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), FALSE);
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
return about->wrap_license;
|
2005-07-05 14:53:37 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* gtk_about_dialog_set_wrap_license: (attributes org.gtk.Method.set_property=wrap-license)
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: a `GtkAboutDialog`
|
2005-07-05 14:53:37 +00:00
|
|
|
|
* @wrap_license: whether to wrap the license
|
|
|
|
|
*
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* Sets whether the license text in the about dialog should be
|
2005-07-05 14:53:37 +00:00
|
|
|
|
* automatically wrapped.
|
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
gtk_about_dialog_set_wrap_license (GtkAboutDialog *about,
|
|
|
|
|
gboolean wrap_license)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
|
|
|
|
|
|
|
|
|
wrap_license = wrap_license != FALSE;
|
2009-11-30 00:48:16 +00:00
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
if (about->wrap_license != wrap_license)
|
2005-07-05 14:53:37 +00:00
|
|
|
|
{
|
2020-03-28 04:42:44 +00:00
|
|
|
|
about->wrap_license = wrap_license;
|
2005-07-05 14:53:37 +00:00
|
|
|
|
|
2014-06-07 05:06:51 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (about), props[PROP_WRAP_LICENSE]);
|
2005-07-05 14:53:37 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2004-07-12 16:38:04 +00:00
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* gtk_about_dialog_get_website: (attributes org.gtk.Method.get_property=website)
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: a `GtkAboutDialog`
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
2004-07-12 16:38:04 +00:00
|
|
|
|
* Returns the website URL.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* Returns: (nullable) (transfer none): The website URL
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *
|
2004-07-12 16:38:04 +00:00
|
|
|
|
gtk_about_dialog_get_website (GtkAboutDialog *about)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
return about->website_url;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* gtk_about_dialog_set_website: (attributes org.gtk.Method.set_property=website)
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: a `GtkAboutDialog`
|
|
|
|
|
* @website: (nullable): a URL string starting with `http://`
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
2004-07-12 16:38:04 +00:00
|
|
|
|
* Sets the URL to use for the website link.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2004-07-12 16:38:04 +00:00
|
|
|
|
void
|
2009-11-30 00:48:16 +00:00
|
|
|
|
gtk_about_dialog_set_website (GtkAboutDialog *about,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *website)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char *tmp;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
tmp = about->website_url;
|
|
|
|
|
about->website_url = g_strdup (website);
|
2009-11-30 00:48:16 +00:00
|
|
|
|
g_free (tmp);
|
2009-01-05 03:38:10 +00:00
|
|
|
|
|
|
|
|
|
update_website (about);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2014-06-07 05:06:51 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (about), props[PROP_WEBSITE]);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* gtk_about_dialog_get_website_label: (attributes org.gtk.Method.get_property=website-label)
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: a `GtkAboutDialog`
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns the label used for the website link.
|
|
|
|
|
*
|
2021-05-18 21:05:26 +00:00
|
|
|
|
* Returns: (nullable) (transfer none): The label used for the website link
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *
|
2004-07-12 16:38:04 +00:00
|
|
|
|
gtk_about_dialog_get_website_label (GtkAboutDialog *about)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
return about->website_text;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* gtk_about_dialog_set_website_label: (attributes org.gtk.Method.set_property=website-label)
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: a `GtkAboutDialog`
|
2004-07-12 16:38:04 +00:00
|
|
|
|
* @website_label: the label used for the website link
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
2004-07-12 16:38:04 +00:00
|
|
|
|
* Sets the label to be used for the website link.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2004-07-12 16:38:04 +00:00
|
|
|
|
void
|
2009-11-30 00:48:16 +00:00
|
|
|
|
gtk_about_dialog_set_website_label (GtkAboutDialog *about,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *website_label)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char *tmp;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
tmp = about->website_text;
|
|
|
|
|
about->website_text = g_strdup (website_label);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
g_free (tmp);
|
|
|
|
|
|
2009-01-05 03:38:10 +00:00
|
|
|
|
update_website (about);
|
|
|
|
|
|
2014-06-07 05:06:51 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (about), props[PROP_WEBSITE_LABEL]);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* gtk_about_dialog_get_authors: (attributes org.gtk.Method.get_property=authors)
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: a `GtkAboutDialog`
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
2021-05-18 21:05:26 +00:00
|
|
|
|
* Returns the names of the authors which are displayed
|
|
|
|
|
* in the credits page.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: (array zero-terminated=1) (transfer none): A
|
2021-05-18 21:05:26 +00:00
|
|
|
|
* `NULL`-terminated string array containing the authors
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char * const *
|
2004-07-12 16:38:04 +00:00
|
|
|
|
gtk_about_dialog_get_authors (GtkAboutDialog *about)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
|
|
|
|
|
|
2020-07-24 18:40:36 +00:00
|
|
|
|
return (const char * const *) about->authors;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* gtk_about_dialog_set_authors: (attributes org.gtk.Method.set_property=authors)
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: a `GtkAboutDialog`
|
|
|
|
|
* @authors: (array zero-terminated=1): the authors of the application
|
2004-07-12 16:38:04 +00:00
|
|
|
|
*
|
2021-05-18 21:05:26 +00:00
|
|
|
|
* Sets the names of the authors which are displayed
|
|
|
|
|
* in the "Credits" page of the about dialog.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2004-07-12 16:38:04 +00:00
|
|
|
|
void
|
2009-11-30 00:48:16 +00:00
|
|
|
|
gtk_about_dialog_set_authors (GtkAboutDialog *about,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char **authors)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char **tmp;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
tmp = about->authors;
|
2020-07-24 18:40:36 +00:00
|
|
|
|
about->authors = g_strdupv ((char **)authors);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
g_strfreev (tmp);
|
|
|
|
|
|
2007-01-31 18:40:32 +00:00
|
|
|
|
update_credits_button_visibility (about);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2014-06-07 05:06:51 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (about), props[PROP_AUTHORS]);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* gtk_about_dialog_get_documenters: (attributes org.gtk.Method.get_property=documenters)
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: a `GtkAboutDialog`
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
2021-05-18 21:05:26 +00:00
|
|
|
|
* Returns the name of the documenters which are displayed
|
|
|
|
|
* in the credits page.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: (array zero-terminated=1) (transfer none): A
|
2021-05-18 21:05:26 +00:00
|
|
|
|
* `NULL`-terminated string array containing the documenters
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char * const *
|
2004-07-12 16:38:04 +00:00
|
|
|
|
gtk_about_dialog_get_documenters (GtkAboutDialog *about)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
|
|
|
|
|
|
2020-07-24 18:40:36 +00:00
|
|
|
|
return (const char * const *)about->documenters;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* gtk_about_dialog_set_documenters: (attributes org.gtk.Method.set_property=documenters)
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: a `GtkAboutDialog`
|
|
|
|
|
* @documenters: (array zero-terminated=1): the authors of the documentation
|
|
|
|
|
* of the application
|
2004-07-12 16:38:04 +00:00
|
|
|
|
*
|
2021-05-18 21:05:26 +00:00
|
|
|
|
* Sets the names of the documenters which are displayed
|
|
|
|
|
* in the "Credits" page.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2004-07-12 16:38:04 +00:00
|
|
|
|
void
|
2009-11-30 00:48:16 +00:00
|
|
|
|
gtk_about_dialog_set_documenters (GtkAboutDialog *about,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char **documenters)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char **tmp;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
tmp = about->documenters;
|
2020-07-24 18:40:36 +00:00
|
|
|
|
about->documenters = g_strdupv ((char **)documenters);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
g_strfreev (tmp);
|
|
|
|
|
|
2007-01-31 18:40:32 +00:00
|
|
|
|
update_credits_button_visibility (about);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2014-06-07 05:06:51 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (about), props[PROP_DOCUMENTERS]);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* gtk_about_dialog_get_artists: (attributes org.gtk.Method.get_property=artists)
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: a `GtkAboutDialog`
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
2021-05-18 21:05:26 +00:00
|
|
|
|
* Returns the names of the artists which are displayed
|
|
|
|
|
* in the credits page.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: (array zero-terminated=1) (transfer none): A
|
2021-05-18 21:05:26 +00:00
|
|
|
|
* `NULL`-terminated string array containing the artists
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char * const *
|
2004-07-12 16:38:04 +00:00
|
|
|
|
gtk_about_dialog_get_artists (GtkAboutDialog *about)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
|
|
|
|
|
|
2020-07-24 18:40:36 +00:00
|
|
|
|
return (const char * const *)about->artists;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* gtk_about_dialog_set_artists: (attributes org.gtk.Method.set_property=artists)
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: a `GtkAboutDialog`
|
|
|
|
|
* @artists: (array zero-terminated=1): the authors of the artwork
|
|
|
|
|
* of the application
|
2004-07-12 16:38:04 +00:00
|
|
|
|
*
|
2021-05-18 21:05:26 +00:00
|
|
|
|
* Sets the names of the artists to be displayed
|
|
|
|
|
* in the "Credits" page.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2004-07-12 16:38:04 +00:00
|
|
|
|
void
|
2009-11-30 00:48:16 +00:00
|
|
|
|
gtk_about_dialog_set_artists (GtkAboutDialog *about,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char **artists)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char **tmp;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
tmp = about->artists;
|
2020-07-24 18:40:36 +00:00
|
|
|
|
about->artists = g_strdupv ((char **)artists);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
g_strfreev (tmp);
|
|
|
|
|
|
2007-01-31 18:40:32 +00:00
|
|
|
|
update_credits_button_visibility (about);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2014-06-07 05:06:51 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (about), props[PROP_ARTISTS]);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* gtk_about_dialog_get_translator_credits: (attributes org.gtk.Method.get_property=translator-credits)
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: a `GtkAboutDialog`
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
2004-07-12 16:38:04 +00:00
|
|
|
|
* Returns the translator credits string which is displayed
|
2021-05-18 21:05:26 +00:00
|
|
|
|
* in the credits page.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
2021-05-18 21:05:26 +00:00
|
|
|
|
* Returns: (nullable): The translator credits string
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *
|
2004-07-12 16:38:04 +00:00
|
|
|
|
gtk_about_dialog_get_translator_credits (GtkAboutDialog *about)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
return about->translator_credits;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* gtk_about_dialog_set_translator_credits: (attributes org.gtk.Method.set_property=translator-credits)
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: a `GtkAboutDialog`
|
|
|
|
|
* @translator_credits: (nullable): the translator credits
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
2004-07-12 16:38:04 +00:00
|
|
|
|
* Sets the translator credits string which is displayed in
|
2021-05-18 21:05:26 +00:00
|
|
|
|
* the credits page.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
2004-07-12 16:38:04 +00:00
|
|
|
|
* The intended use for this string is to display the translator
|
|
|
|
|
* of the language which is currently used in the user interface.
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* Using `gettext()`, a simple way to achieve that is to mark the
|
2004-07-12 16:38:04 +00:00
|
|
|
|
* string for translation:
|
2021-02-18 13:38:55 +00:00
|
|
|
|
*
|
|
|
|
|
* ```c
|
2017-10-11 10:55:01 +00:00
|
|
|
|
* GtkWidget *about = gtk_about_dialog_new ();
|
|
|
|
|
* gtk_about_dialog_set_translator_credits (GTK_ABOUT_DIALOG (about),
|
2014-02-12 21:09:09 +00:00
|
|
|
|
* _("translator-credits"));
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* ```
|
|
|
|
|
*
|
2021-05-18 21:05:26 +00:00
|
|
|
|
* It is a good idea to use the customary `msgid` “translator-credits”
|
|
|
|
|
* for this purpose, since translators will already know the purpose of
|
|
|
|
|
* that `msgid`, and since `GtkAboutDialog` will detect if “translator-credits”
|
|
|
|
|
* is untranslated and omit translator credits.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2004-07-12 16:38:04 +00:00
|
|
|
|
void
|
2009-11-30 00:48:16 +00:00
|
|
|
|
gtk_about_dialog_set_translator_credits (GtkAboutDialog *about,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *translator_credits)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char *tmp;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
tmp = about->translator_credits;
|
|
|
|
|
about->translator_credits = g_strdup (translator_credits);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
g_free (tmp);
|
|
|
|
|
|
2007-01-31 18:40:32 +00:00
|
|
|
|
update_credits_button_visibility (about);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2014-06-07 05:06:51 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (about), props[PROP_TRANSLATOR_CREDITS]);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* gtk_about_dialog_get_logo: (attributes org.gtk.Method.get_property=logo)
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: a `GtkAboutDialog`
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
2018-02-18 04:05:40 +00:00
|
|
|
|
* Returns the paintable displayed as logo in the about dialog.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
2020-02-18 09:36:04 +00:00
|
|
|
|
* Returns: (transfer none) (nullable): the paintable displayed as
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* logo or `NULL` if the logo is unset or has been set via
|
2021-05-18 21:05:26 +00:00
|
|
|
|
* [method@Gtk.AboutDialog.set_logo_icon_name]
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2018-02-18 04:05:40 +00:00
|
|
|
|
GdkPaintable *
|
2004-07-12 16:38:04 +00:00
|
|
|
|
gtk_about_dialog_get_logo (GtkAboutDialog *about)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
if (gtk_image_get_storage_type (GTK_IMAGE (about->logo_image)) == GTK_IMAGE_PAINTABLE)
|
|
|
|
|
return gtk_image_get_paintable (GTK_IMAGE (about->logo_image));
|
2004-10-25 18:41:11 +00:00
|
|
|
|
else
|
|
|
|
|
return NULL;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* gtk_about_dialog_set_logo: (attributes org.gtk.Method.set_property=logo)
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: a `GtkAboutDialog`
|
|
|
|
|
* @logo: (nullable): a `GdkPaintable`
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
2020-02-18 09:36:04 +00:00
|
|
|
|
* Sets the logo in the about dialog.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2004-07-12 16:38:04 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_about_dialog_set_logo (GtkAboutDialog *about,
|
2018-02-18 04:05:40 +00:00
|
|
|
|
GdkPaintable *logo)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
2020-02-18 09:36:04 +00:00
|
|
|
|
g_return_if_fail (logo == NULL || GDK_IS_PAINTABLE (logo));
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2004-10-25 18:41:11 +00:00
|
|
|
|
g_object_freeze_notify (G_OBJECT (about));
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
if (gtk_image_get_storage_type (GTK_IMAGE (about->logo_image)) == GTK_IMAGE_ICON_NAME)
|
2014-06-07 05:06:51 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (about), props[PROP_LOGO_ICON_NAME]);
|
2004-10-25 18:41:11 +00:00
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
gtk_image_set_from_paintable (GTK_IMAGE (about->logo_image), logo);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2014-06-07 05:06:51 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (about), props[PROP_LOGO]);
|
2004-10-25 18:41:11 +00:00
|
|
|
|
|
|
|
|
|
g_object_thaw_notify (G_OBJECT (about));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* gtk_about_dialog_get_logo_icon_name: (attributes org.gtk.Method.get_property=logo-icon-name)
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: a `GtkAboutDialog`
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
2004-10-25 18:41:11 +00:00
|
|
|
|
* Returns the icon name displayed as logo in the about dialog.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* Returns: (transfer none) (nullable): the icon name displayed as logo,
|
2021-05-18 21:05:26 +00:00
|
|
|
|
* or `NULL` if the logo has been set via [method@Gtk.AboutDialog.set_logo]
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *
|
2004-10-25 18:41:11 +00:00
|
|
|
|
gtk_about_dialog_get_logo_icon_name (GtkAboutDialog *about)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), NULL);
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
if (gtk_image_get_storage_type (GTK_IMAGE (about->logo_image)) != GTK_IMAGE_ICON_NAME)
|
2017-01-22 21:58:45 +00:00
|
|
|
|
return NULL;
|
2004-10-25 18:41:11 +00:00
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
return gtk_image_get_icon_name (GTK_IMAGE (about->logo_image));
|
2004-10-25 18:41:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* gtk_about_dialog_set_logo_icon_name: (attributes org.gtk.Method.set_property=logo-icon-name)
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: a `GtkAboutDialog`
|
|
|
|
|
* @icon_name: (nullable): an icon name
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*
|
2020-02-18 09:36:04 +00:00
|
|
|
|
* Sets the icon name to be displayed as logo in the about dialog.
|
2009-11-30 00:48:16 +00:00
|
|
|
|
*/
|
2004-10-25 18:41:11 +00:00
|
|
|
|
void
|
|
|
|
|
gtk_about_dialog_set_logo_icon_name (GtkAboutDialog *about,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *icon_name)
|
2004-10-25 18:41:11 +00:00
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
|
|
|
|
|
|
|
|
|
g_object_freeze_notify (G_OBJECT (about));
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
if (gtk_image_get_storage_type (GTK_IMAGE (about->logo_image)) == GTK_IMAGE_PAINTABLE)
|
2014-06-07 05:06:51 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (about), props[PROP_LOGO]);
|
2004-10-25 18:41:11 +00:00
|
|
|
|
|
2021-01-11 19:38:18 +00:00
|
|
|
|
gtk_image_set_from_icon_name (GTK_IMAGE (about->logo_image), icon_name);
|
2013-11-28 20:01:18 +00:00
|
|
|
|
|
2014-06-07 05:06:51 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (about), props[PROP_LOGO_ICON_NAME]);
|
2004-10-25 18:41:11 +00:00
|
|
|
|
|
|
|
|
|
g_object_thaw_notify (G_OBJECT (about));
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
follow_if_link (GtkAboutDialog *about,
|
2009-11-30 00:48:16 +00:00
|
|
|
|
GtkTextView *text_view,
|
|
|
|
|
GtkTextIter *iter)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
|
|
|
|
GSList *tags = NULL, *tagp = NULL;
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char *uri = NULL;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
|
|
|
|
tags = gtk_text_iter_get_tags (iter);
|
2010-09-22 01:55:05 +00:00
|
|
|
|
for (tagp = tags; tagp != NULL && !uri; tagp = tagp->next)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
|
|
|
|
GtkTextTag *tag = tagp->data;
|
|
|
|
|
|
2010-09-22 01:55:05 +00:00
|
|
|
|
uri = g_object_get_data (G_OBJECT (tag), "uri");
|
|
|
|
|
if (uri)
|
|
|
|
|
emit_activate_link (about, uri);
|
2006-01-24 00:20:06 +00:00
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
if (uri && !g_ptr_array_find_with_equal_func (about->visited_links, uri, (GCompareFunc)strcmp, NULL))
|
2009-11-30 00:48:16 +00:00
|
|
|
|
{
|
2013-10-08 11:03:37 +00:00
|
|
|
|
GdkRGBA visited_link_color;
|
2022-10-09 04:14:20 +00:00
|
|
|
|
GtkCssStyle *style;
|
2009-11-30 00:48:16 +00:00
|
|
|
|
|
2022-10-09 04:14:20 +00:00
|
|
|
|
style = gtk_css_node_get_style (about->visited_link_node);
|
|
|
|
|
visited_link_color = *gtk_css_color_value_get_rgba (style->core->color);
|
2015-01-27 12:37:15 +00:00
|
|
|
|
g_object_set (G_OBJECT (tag), "foreground-rgba", &visited_link_color, NULL);
|
2009-11-30 00:48:16 +00:00
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
g_ptr_array_add (about->visited_links, g_strdup (uri));
|
2009-11-30 00:48:16 +00:00
|
|
|
|
}
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-07-31 21:57:04 +00:00
|
|
|
|
g_slist_free (tags);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
2018-02-08 00:17:11 +00:00
|
|
|
|
text_view_key_pressed (GtkEventController *controller,
|
|
|
|
|
guint keyval,
|
|
|
|
|
guint keycode,
|
|
|
|
|
GdkModifierType state,
|
|
|
|
|
GtkAboutDialog *about)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
2018-02-08 00:17:11 +00:00
|
|
|
|
GtkWidget *text_view;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
GtkTextIter iter;
|
|
|
|
|
GtkTextBuffer *buffer;
|
|
|
|
|
|
2018-02-08 00:17:11 +00:00
|
|
|
|
text_view = gtk_event_controller_get_widget (controller);
|
2017-08-25 14:42:09 +00:00
|
|
|
|
|
|
|
|
|
switch (keyval)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
2010-09-08 17:35:51 +00:00
|
|
|
|
case GDK_KEY_Return:
|
|
|
|
|
case GDK_KEY_ISO_Enter:
|
|
|
|
|
case GDK_KEY_KP_Enter:
|
2004-07-12 16:38:04 +00:00
|
|
|
|
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
|
2009-11-30 00:48:16 +00:00
|
|
|
|
gtk_text_buffer_get_iter_at_mark (buffer, &iter,
|
2004-07-12 16:38:04 +00:00
|
|
|
|
gtk_text_buffer_get_insert (buffer));
|
2006-01-24 00:20:06 +00:00
|
|
|
|
follow_if_link (about, GTK_TEXT_VIEW (text_view), &iter);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2017-12-12 00:00:24 +00:00
|
|
|
|
static void
|
2019-05-29 17:10:46 +00:00
|
|
|
|
text_view_released (GtkGestureClick *gesture,
|
2017-12-12 00:00:24 +00:00
|
|
|
|
int n_press,
|
|
|
|
|
double x,
|
|
|
|
|
double y,
|
|
|
|
|
GtkAboutDialog *about)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
2017-12-12 00:00:24 +00:00
|
|
|
|
GtkWidget *text_view;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
GtkTextIter start, end, iter;
|
|
|
|
|
GtkTextBuffer *buffer;
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int tx, ty;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2017-12-12 00:00:24 +00:00
|
|
|
|
if (gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture)) != GDK_BUTTON_PRIMARY)
|
|
|
|
|
return;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2017-12-12 00:00:24 +00:00
|
|
|
|
text_view = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
|
2004-07-12 16:38:04 +00:00
|
|
|
|
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
|
|
|
|
|
|
|
|
|
|
/* we shouldn't follow a link if the user has selected something */
|
|
|
|
|
gtk_text_buffer_get_selection_bounds (buffer, &start, &end);
|
|
|
|
|
if (gtk_text_iter_get_offset (&start) != gtk_text_iter_get_offset (&end))
|
2017-12-12 00:00:24 +00:00
|
|
|
|
return;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2009-11-30 00:48:16 +00:00
|
|
|
|
gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (text_view),
|
2004-07-12 16:38:04 +00:00
|
|
|
|
GTK_TEXT_WINDOW_WIDGET,
|
2017-12-12 00:00:24 +00:00
|
|
|
|
x, y, &tx, &ty);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2017-12-12 00:00:24 +00:00
|
|
|
|
gtk_text_view_get_iter_at_location (GTK_TEXT_VIEW (text_view), &iter, tx, ty);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2006-01-24 00:20:06 +00:00
|
|
|
|
follow_if_link (about, GTK_TEXT_VIEW (text_view), &iter);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
set_cursor_if_appropriate (GtkAboutDialog *about,
|
2010-09-22 01:55:05 +00:00
|
|
|
|
GtkTextView *text_view,
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int x,
|
|
|
|
|
int y)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
|
|
|
|
GSList *tags = NULL, *tagp = NULL;
|
|
|
|
|
GtkTextIter iter;
|
|
|
|
|
gboolean hovering_over_link = FALSE;
|
|
|
|
|
|
|
|
|
|
gtk_text_view_get_iter_at_location (text_view, &iter, x, y);
|
2009-11-30 00:48:16 +00:00
|
|
|
|
|
2004-07-12 16:38:04 +00:00
|
|
|
|
tags = gtk_text_iter_get_tags (&iter);
|
|
|
|
|
for (tagp = tags; tagp != NULL; tagp = tagp->next)
|
|
|
|
|
{
|
|
|
|
|
GtkTextTag *tag = tagp->data;
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char *uri = g_object_get_data (G_OBJECT (tag), "uri");
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2010-09-22 01:55:05 +00:00
|
|
|
|
if (uri != NULL)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
|
|
|
|
hovering_over_link = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
if (hovering_over_link != about->hovering_over_link)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
2020-03-28 04:42:44 +00:00
|
|
|
|
about->hovering_over_link = hovering_over_link;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
|
|
|
|
if (hovering_over_link)
|
2017-11-04 00:37:03 +00:00
|
|
|
|
gtk_widget_set_cursor_from_name (GTK_WIDGET (text_view), "pointer");
|
2004-07-12 16:38:04 +00:00
|
|
|
|
else
|
2017-11-04 00:37:03 +00:00
|
|
|
|
gtk_widget_set_cursor_from_name (GTK_WIDGET (text_view), "text");
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-07-31 21:57:04 +00:00
|
|
|
|
g_slist_free (tags);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2017-12-11 23:46:47 +00:00
|
|
|
|
static void
|
|
|
|
|
text_view_motion (GtkEventControllerMotion *motion,
|
|
|
|
|
double x,
|
|
|
|
|
double y,
|
|
|
|
|
GtkAboutDialog *about)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int tx, ty;
|
2017-12-11 23:46:47 +00:00
|
|
|
|
GtkWidget *widget;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2017-12-11 23:46:47 +00:00
|
|
|
|
widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (motion));
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2017-12-11 23:46:47 +00:00
|
|
|
|
gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (widget),
|
|
|
|
|
GTK_TEXT_WINDOW_WIDGET,
|
|
|
|
|
x, y, &tx, &ty);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2017-12-11 23:46:47 +00:00
|
|
|
|
set_cursor_if_appropriate (about, GTK_TEXT_VIEW (widget), tx, ty);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-03-22 12:51:40 +00:00
|
|
|
|
static GtkTextBuffer *
|
|
|
|
|
text_buffer_new (GtkAboutDialog *about,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char **strings)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char **p;
|
|
|
|
|
char *q0, *q1, *q2, *r1, *r2;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
GtkTextBuffer *buffer;
|
2013-10-08 11:03:37 +00:00
|
|
|
|
GdkRGBA color;
|
|
|
|
|
GdkRGBA link_color;
|
|
|
|
|
GdkRGBA visited_link_color;
|
2012-12-06 01:18:58 +00:00
|
|
|
|
GtkTextIter start_iter, end_iter;
|
|
|
|
|
GtkTextTag *tag;
|
2022-10-09 04:14:20 +00:00
|
|
|
|
GtkCssStyle *style;
|
|
|
|
|
|
|
|
|
|
style = gtk_css_node_get_style (about->link_node);
|
|
|
|
|
link_color = *gtk_css_color_value_get_rgba (style->core->color);
|
|
|
|
|
style = gtk_css_node_get_style (about->visited_link_node);
|
|
|
|
|
visited_link_color = *gtk_css_color_value_get_rgba (style->core->color);
|
|
|
|
|
|
2013-03-22 12:51:40 +00:00
|
|
|
|
buffer = gtk_text_buffer_new (NULL);
|
2005-01-27 14:10:55 +00:00
|
|
|
|
|
2009-04-08 04:52:38 +00:00
|
|
|
|
for (p = strings; *p; p++)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
|
|
|
|
q0 = *p;
|
2009-04-08 04:52:38 +00:00
|
|
|
|
while (*q0)
|
2009-11-30 00:48:16 +00:00
|
|
|
|
{
|
2010-09-22 01:55:05 +00:00
|
|
|
|
q1 = strchr (q0, '<');
|
2009-11-30 00:48:16 +00:00
|
|
|
|
q2 = q1 ? strchr (q1, '>') : NULL;
|
2010-09-22 01:55:05 +00:00
|
|
|
|
r1 = strstr (q0, "http://");
|
2014-08-29 04:51:39 +00:00
|
|
|
|
r2 = strstr (q0, "https://");
|
|
|
|
|
if (!r1 || (r1 && r2 && r2 < r1))
|
|
|
|
|
r1 = r2;
|
2004-07-14 17:19:04 +00:00
|
|
|
|
if (r1)
|
|
|
|
|
{
|
2013-11-15 19:42:34 +00:00
|
|
|
|
r2 = strpbrk (r1, " \n\t>");
|
2009-11-30 00:48:16 +00:00
|
|
|
|
if (!r2)
|
|
|
|
|
r2 = strchr (r1, '\0');
|
|
|
|
|
}
|
|
|
|
|
else
|
2004-07-14 17:19:04 +00:00
|
|
|
|
r2 = NULL;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2013-11-15 19:42:34 +00:00
|
|
|
|
if (r1 && r2 && (!q1 || !q2 || (r1 <= q1 + 1)))
|
2009-11-30 00:48:16 +00:00
|
|
|
|
{
|
|
|
|
|
q1 = r1;
|
|
|
|
|
q2 = r2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (q1 && q2)
|
|
|
|
|
{
|
|
|
|
|
GtkTextIter end;
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char *link;
|
|
|
|
|
char *uri;
|
|
|
|
|
const char *link_type;
|
2009-11-30 00:48:16 +00:00
|
|
|
|
|
|
|
|
|
if (*q1 == '<')
|
|
|
|
|
{
|
2010-12-10 06:27:55 +00:00
|
|
|
|
gtk_text_buffer_insert_at_cursor (buffer, q0, q1 - q0 + 1);
|
2009-11-30 00:48:16 +00:00
|
|
|
|
gtk_text_buffer_get_end_iter (buffer, &end);
|
|
|
|
|
q1++;
|
2010-09-22 01:55:05 +00:00
|
|
|
|
link_type = "email";
|
2009-11-30 00:48:16 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
gtk_text_buffer_insert_at_cursor (buffer, q0, q1 - q0);
|
|
|
|
|
gtk_text_buffer_get_end_iter (buffer, &end);
|
2010-09-22 01:55:05 +00:00
|
|
|
|
link_type = "uri";
|
2009-11-30 00:48:16 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
q0 = q2;
|
|
|
|
|
|
|
|
|
|
link = g_strndup (q1, q2 - q1);
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
if (g_ptr_array_find_with_equal_func (about->visited_links, link, (GCompareFunc)strcmp, NULL))
|
2009-11-30 00:48:16 +00:00
|
|
|
|
color = visited_link_color;
|
|
|
|
|
else
|
|
|
|
|
color = link_color;
|
|
|
|
|
|
|
|
|
|
tag = gtk_text_buffer_create_tag (buffer, NULL,
|
2013-10-08 11:03:37 +00:00
|
|
|
|
"foreground-rgba", &color,
|
2009-11-30 00:48:16 +00:00
|
|
|
|
"underline", PANGO_UNDERLINE_SINGLE,
|
|
|
|
|
NULL);
|
2010-09-22 01:55:05 +00:00
|
|
|
|
if (strcmp (link_type, "email") == 0)
|
2010-09-24 16:02:37 +00:00
|
|
|
|
{
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char *escaped;
|
2010-09-24 16:02:37 +00:00
|
|
|
|
|
|
|
|
|
escaped = g_uri_escape_string (link, NULL, FALSE);
|
|
|
|
|
uri = g_strconcat ("mailto:", escaped, NULL);
|
|
|
|
|
g_free (escaped);
|
|
|
|
|
}
|
2010-09-22 01:55:05 +00:00
|
|
|
|
else
|
2010-09-24 16:02:37 +00:00
|
|
|
|
{
|
|
|
|
|
uri = g_strdup (link);
|
|
|
|
|
}
|
2010-09-22 01:55:05 +00:00
|
|
|
|
g_object_set_data_full (G_OBJECT (tag), I_("uri"), uri, g_free);
|
2009-11-30 00:48:16 +00:00
|
|
|
|
gtk_text_buffer_insert_with_tags (buffer, &end, link, -1, tag, NULL);
|
|
|
|
|
|
|
|
|
|
g_free (link);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
gtk_text_buffer_insert_at_cursor (buffer, q0, -1);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2004-07-12 16:38:04 +00:00
|
|
|
|
if (p[1])
|
2009-11-30 00:48:16 +00:00
|
|
|
|
gtk_text_buffer_insert_at_cursor (buffer, "\n", 1);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
2009-04-08 04:52:38 +00:00
|
|
|
|
|
2013-07-09 01:46:43 +00:00
|
|
|
|
tag = gtk_text_buffer_create_tag (buffer, NULL,
|
|
|
|
|
"scale", PANGO_SCALE_SMALL,
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
gtk_text_buffer_get_start_iter (buffer, &start_iter);
|
|
|
|
|
gtk_text_buffer_get_end_iter (buffer, &end_iter);
|
|
|
|
|
gtk_text_buffer_apply_tag (buffer, tag, &start_iter, &end_iter);
|
|
|
|
|
|
2020-09-06 21:00:43 +00:00
|
|
|
|
gtk_text_buffer_set_enable_undo (buffer, FALSE);
|
|
|
|
|
|
2013-03-22 12:51:40 +00:00
|
|
|
|
return buffer;
|
2009-04-08 04:52:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2014-12-23 05:20:11 +00:00
|
|
|
|
add_credits_section (GtkAboutDialog *about,
|
|
|
|
|
GtkGrid *grid,
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int *row,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char *title,
|
|
|
|
|
char **people)
|
2009-04-08 04:52:38 +00:00
|
|
|
|
{
|
2010-12-10 06:27:55 +00:00
|
|
|
|
GtkWidget *label;
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char *markup;
|
|
|
|
|
char **p;
|
|
|
|
|
char *q0, *q1, *q2, *r1, *r2;
|
2009-04-08 04:52:38 +00:00
|
|
|
|
|
2010-12-10 06:27:55 +00:00
|
|
|
|
if (people == NULL)
|
|
|
|
|
return;
|
2009-04-08 04:52:38 +00:00
|
|
|
|
|
2010-12-10 06:27:55 +00:00
|
|
|
|
markup = g_strdup_printf ("<span size=\"small\">%s</span>", title);
|
|
|
|
|
label = gtk_label_new (markup);
|
|
|
|
|
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
|
|
|
|
g_free (markup);
|
2011-06-10 23:40:58 +00:00
|
|
|
|
gtk_widget_set_halign (label, GTK_ALIGN_END);
|
|
|
|
|
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
2010-12-10 06:27:55 +00:00
|
|
|
|
gtk_grid_attach (grid, label, 0, *row, 1, 1);
|
2009-11-30 00:48:16 +00:00
|
|
|
|
|
2010-12-10 06:27:55 +00:00
|
|
|
|
for (p = people; *p; p++)
|
|
|
|
|
{
|
|
|
|
|
GString *str;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2010-12-10 06:27:55 +00:00
|
|
|
|
str = g_string_new ("<span size=\"small\">");
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2010-12-10 06:27:55 +00:00
|
|
|
|
q0 = *p;
|
|
|
|
|
while (*q0)
|
|
|
|
|
{
|
|
|
|
|
q1 = strchr (q0, '<');
|
|
|
|
|
q2 = q1 ? strchr (q1, '>') : NULL;
|
|
|
|
|
r1 = strstr (q0, "http://");
|
2014-08-29 04:51:39 +00:00
|
|
|
|
r2 = strstr (q0, "https://");
|
|
|
|
|
if (!r1 || (r1 && r2 && r2 < r1))
|
|
|
|
|
r1 = r2;
|
2010-12-10 06:27:55 +00:00
|
|
|
|
if (r1)
|
|
|
|
|
{
|
|
|
|
|
r2 = strpbrk (r1, " \n\t");
|
|
|
|
|
if (!r2)
|
|
|
|
|
r2 = strchr (r1, '\0');
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
r2 = NULL;
|
2009-11-30 00:48:16 +00:00
|
|
|
|
|
2010-12-10 06:27:55 +00:00
|
|
|
|
if (r1 && r2 && (!q1 || !q2 || (r1 < q1)))
|
|
|
|
|
{
|
|
|
|
|
q1 = r1;
|
|
|
|
|
q2 = r2;
|
|
|
|
|
}
|
|
|
|
|
else if (q1 && (q1[1] == 'a' || q1[1] == 'A') && q1[2] == ' ')
|
|
|
|
|
{
|
|
|
|
|
/* if it is a <a> link leave it for the label to parse */
|
|
|
|
|
q1 = NULL;
|
|
|
|
|
}
|
2009-10-22 19:45:10 +00:00
|
|
|
|
|
2010-12-10 06:27:55 +00:00
|
|
|
|
if (q1 && q2)
|
|
|
|
|
{
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char *link;
|
|
|
|
|
char *text;
|
|
|
|
|
char *name;
|
2009-10-22 19:45:10 +00:00
|
|
|
|
|
2010-12-10 06:27:55 +00:00
|
|
|
|
if (*q1 == '<')
|
|
|
|
|
{
|
|
|
|
|
/* email */
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char *escaped;
|
2006-12-25 12:21:16 +00:00
|
|
|
|
|
2010-12-10 06:27:55 +00:00
|
|
|
|
text = g_strstrip (g_strndup (q0, q1 - q0));
|
2010-12-22 06:03:58 +00:00
|
|
|
|
name = g_markup_escape_text (text, -1);
|
2010-12-10 06:27:55 +00:00
|
|
|
|
q1++;
|
|
|
|
|
link = g_strndup (q1, q2 - q1);
|
|
|
|
|
q2++;
|
|
|
|
|
escaped = g_uri_escape_string (link, NULL, FALSE);
|
|
|
|
|
g_string_append_printf (str,
|
|
|
|
|
"<a href=\"mailto:%s\">%s</a>",
|
|
|
|
|
escaped,
|
2010-12-22 06:03:58 +00:00
|
|
|
|
name[0] ? name : link);
|
2010-12-10 06:27:55 +00:00
|
|
|
|
g_free (escaped);
|
|
|
|
|
g_free (link);
|
|
|
|
|
g_free (text);
|
2010-12-22 06:03:58 +00:00
|
|
|
|
g_free (name);
|
2010-12-10 06:27:55 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* uri */
|
|
|
|
|
text = g_strstrip (g_strndup (q0, q1 - q0));
|
2010-12-22 06:03:58 +00:00
|
|
|
|
name = g_markup_escape_text (text, -1);
|
2010-12-10 06:27:55 +00:00
|
|
|
|
link = g_strndup (q1, q2 - q1);
|
|
|
|
|
g_string_append_printf (str,
|
|
|
|
|
"<a href=\"%s\">%s</a>",
|
|
|
|
|
link,
|
2010-12-22 06:03:58 +00:00
|
|
|
|
name[0] ? name : link);
|
2010-12-10 06:27:55 +00:00
|
|
|
|
g_free (link);
|
|
|
|
|
g_free (text);
|
2010-12-22 06:03:58 +00:00
|
|
|
|
g_free (name);
|
2010-12-10 06:27:55 +00:00
|
|
|
|
}
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2010-12-10 06:27:55 +00:00
|
|
|
|
q0 = q2;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
g_string_append (str, q0);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
g_string_append (str, "</span>");
|
|
|
|
|
|
|
|
|
|
label = gtk_label_new (str->str);
|
|
|
|
|
gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
2015-05-02 14:42:15 +00:00
|
|
|
|
gtk_label_set_selectable (GTK_LABEL (label), TRUE);
|
2014-01-04 16:08:29 +00:00
|
|
|
|
g_signal_connect_swapped (label, "activate-link",
|
|
|
|
|
G_CALLBACK (emit_activate_link), about);
|
2010-12-10 06:27:55 +00:00
|
|
|
|
g_string_free (str, TRUE);
|
2011-06-10 23:40:58 +00:00
|
|
|
|
gtk_widget_set_halign (label, GTK_ALIGN_START);
|
|
|
|
|
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
|
2010-12-10 06:27:55 +00:00
|
|
|
|
gtk_grid_attach (grid, label, 1, *row, 1, 1);
|
2022-11-28 18:43:36 +00:00
|
|
|
|
gtk_widget_set_visible (label, TRUE);
|
2010-12-10 06:27:55 +00:00
|
|
|
|
(*row)++;
|
|
|
|
|
}
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2010-12-10 06:27:55 +00:00
|
|
|
|
/* skip one at the end */
|
2012-03-21 19:54:45 +00:00
|
|
|
|
label = gtk_label_new ("");
|
|
|
|
|
gtk_grid_attach (grid, label, 1, *row, 1, 1);
|
2010-12-10 06:27:55 +00:00
|
|
|
|
(*row)++;
|
|
|
|
|
}
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2010-12-10 06:27:55 +00:00
|
|
|
|
static void
|
2013-03-22 12:51:40 +00:00
|
|
|
|
populate_credits_page (GtkAboutDialog *about)
|
2010-12-10 06:27:55 +00:00
|
|
|
|
{
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int row;
|
2010-12-10 06:27:55 +00:00
|
|
|
|
|
2012-11-30 04:01:10 +00:00
|
|
|
|
row = 0;
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
if (about->authors != NULL)
|
|
|
|
|
add_credits_section (about, GTK_GRID (about->credits_grid), &row, _("Created by"), about->authors);
|
2009-11-30 00:48:16 +00:00
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
if (about->documenters != NULL)
|
|
|
|
|
add_credits_section (about, GTK_GRID (about->credits_grid), &row, _("Documented by"), about->documenters);
|
2009-11-30 00:48:16 +00:00
|
|
|
|
|
2004-09-16 19:09:29 +00:00
|
|
|
|
/* Don't show an untranslated gettext msgid */
|
2020-03-28 04:42:44 +00:00
|
|
|
|
if (about->translator_credits != NULL &&
|
|
|
|
|
strcmp (about->translator_credits, "translator_credits") != 0 &&
|
|
|
|
|
strcmp (about->translator_credits, "translator-credits") != 0)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char **translators;
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
translators = g_strsplit (about->translator_credits, "\n", 0);
|
|
|
|
|
add_credits_section (about, GTK_GRID (about->credits_grid), &row, _("Translated by"), translators);
|
2010-12-22 05:31:05 +00:00
|
|
|
|
g_strfreev (translators);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
if (about->artists != NULL)
|
|
|
|
|
add_credits_section (about, GTK_GRID (about->credits_grid), &row, _("Design by"), about->artists);
|
2009-11-30 00:48:16 +00:00
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
if (about->credit_sections != NULL)
|
2012-01-25 23:21:47 +00:00
|
|
|
|
{
|
|
|
|
|
GSList *cs;
|
2020-03-28 04:42:44 +00:00
|
|
|
|
for (cs = about->credit_sections; cs != NULL; cs = cs->next)
|
2012-01-25 23:21:47 +00:00
|
|
|
|
{
|
|
|
|
|
CreditSection *section = cs->data;
|
2020-03-28 04:42:44 +00:00
|
|
|
|
add_credits_section (about, GTK_GRID (about->credits_grid), &row, section->heading, section->people);
|
2012-01-25 23:21:47 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2013-03-22 12:51:40 +00:00
|
|
|
|
populate_license_page (GtkAboutDialog *about)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
2013-03-22 12:51:40 +00:00
|
|
|
|
GtkTextBuffer *buffer;
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char *strings[2];
|
2009-11-30 00:48:16 +00:00
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (about->license_view), about->wrap_license ? GTK_WRAP_WORD : GTK_WRAP_NONE);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
strings[0] = about->license;
|
2009-04-08 04:52:38 +00:00
|
|
|
|
strings[1] = NULL;
|
2013-03-22 12:51:40 +00:00
|
|
|
|
buffer = text_buffer_new (about, strings);
|
2020-03-28 04:42:44 +00:00
|
|
|
|
gtk_text_view_set_buffer (GTK_TEXT_VIEW (about->license_view), buffer);
|
2013-03-22 12:51:40 +00:00
|
|
|
|
g_object_unref (buffer);
|
2010-12-10 06:27:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-12-30 04:12:42 +00:00
|
|
|
|
static void
|
|
|
|
|
populate_system_page (GtkAboutDialog *about)
|
|
|
|
|
{
|
|
|
|
|
GtkTextBuffer *buffer;
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char *strings[2];
|
2016-12-30 04:12:42 +00:00
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
strings[0] = about->system_information;
|
2016-12-30 04:12:42 +00:00
|
|
|
|
strings[1] = NULL;
|
|
|
|
|
buffer = text_buffer_new (about, strings);
|
2020-03-28 04:42:44 +00:00
|
|
|
|
gtk_text_view_set_buffer (GTK_TEXT_VIEW (about->system_view), buffer);
|
2016-12-30 04:12:42 +00:00
|
|
|
|
g_object_unref (buffer);
|
|
|
|
|
}
|
|
|
|
|
|
2004-07-12 16:38:04 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_about_dialog_new:
|
|
|
|
|
*
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* Creates a new `GtkAboutDialog`.
|
2004-07-12 16:38:04 +00:00
|
|
|
|
*
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* Returns: a newly created `GtkAboutDialog`
|
2004-07-12 16:38:04 +00:00
|
|
|
|
*/
|
|
|
|
|
GtkWidget *
|
|
|
|
|
gtk_about_dialog_new (void)
|
|
|
|
|
{
|
2014-01-19 22:48:05 +00:00
|
|
|
|
return g_object_new (GTK_TYPE_ABOUT_DIALOG, NULL);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-10-05 15:20:27 +00:00
|
|
|
|
static gboolean
|
2018-01-18 13:38:27 +00:00
|
|
|
|
close_cb (GtkAboutDialog *about,
|
|
|
|
|
gpointer user_data)
|
2006-03-10 22:05:36 +00:00
|
|
|
|
{
|
2020-10-05 15:20:27 +00:00
|
|
|
|
gtk_stack_set_visible_child_name (GTK_STACK (about->stack), "main");
|
2022-11-28 18:43:36 +00:00
|
|
|
|
gtk_widget_set_visible (GTK_WIDGET (about), FALSE);
|
2020-10-05 15:20:27 +00:00
|
|
|
|
|
|
|
|
|
return TRUE;
|
2006-03-10 22:05:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
2004-07-12 16:38:04 +00:00
|
|
|
|
/**
|
|
|
|
|
* gtk_show_about_dialog:
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @parent: (nullable): the parent top-level window
|
2009-11-30 00:48:16 +00:00
|
|
|
|
* @first_property_name: the name of the first property
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @...: value of first property, followed by more pairs of property
|
|
|
|
|
* name and value, `NULL`-terminated
|
|
|
|
|
*
|
|
|
|
|
* A convenience function for showing an application’s about dialog.
|
2004-07-12 16:38:04 +00:00
|
|
|
|
*
|
2009-11-30 00:48:16 +00:00
|
|
|
|
* The constructed dialog is associated with the parent window and
|
2004-11-01 20:14:15 +00:00
|
|
|
|
* reused for future invocations of this function.
|
2004-07-12 16:38:04 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
gtk_show_about_dialog (GtkWindow *parent,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *first_property_name,
|
2009-11-30 00:48:16 +00:00
|
|
|
|
...)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
|
|
|
|
static GtkWidget *global_about_dialog = NULL;
|
|
|
|
|
GtkWidget *dialog = NULL;
|
|
|
|
|
va_list var_args;
|
|
|
|
|
|
|
|
|
|
if (parent)
|
|
|
|
|
dialog = g_object_get_data (G_OBJECT (parent), "gtk-about-dialog");
|
2009-11-30 00:48:16 +00:00
|
|
|
|
else
|
2004-07-12 16:38:04 +00:00
|
|
|
|
dialog = global_about_dialog;
|
|
|
|
|
|
2009-11-30 00:48:16 +00:00
|
|
|
|
if (!dialog)
|
2004-07-12 16:38:04 +00:00
|
|
|
|
{
|
|
|
|
|
dialog = gtk_about_dialog_new ();
|
2017-12-31 16:40:42 +00:00
|
|
|
|
gtk_window_set_hide_on_close (GTK_WINDOW (dialog), TRUE);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2005-11-23 18:06:58 +00:00
|
|
|
|
g_object_ref_sink (dialog);
|
2004-07-12 16:38:04 +00:00
|
|
|
|
|
2020-10-05 15:20:27 +00:00
|
|
|
|
/* Hide the dialog on close request */
|
|
|
|
|
g_signal_connect (dialog, "close-request",
|
2008-08-11 09:17:49 +00:00
|
|
|
|
G_CALLBACK (close_cb), NULL);
|
2006-03-10 22:05:36 +00:00
|
|
|
|
|
2004-07-12 16:38:04 +00:00
|
|
|
|
va_start (var_args, first_property_name);
|
|
|
|
|
g_object_set_valist (G_OBJECT (dialog), first_property_name, var_args);
|
|
|
|
|
va_end (var_args);
|
|
|
|
|
|
2009-11-30 00:48:16 +00:00
|
|
|
|
if (parent)
|
|
|
|
|
{
|
2010-12-10 06:27:55 +00:00
|
|
|
|
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
2009-11-30 00:48:16 +00:00
|
|
|
|
gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
|
|
|
|
|
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
|
|
|
|
|
g_object_set_data_full (G_OBJECT (parent),
|
|
|
|
|
I_("gtk-about-dialog"),
|
|
|
|
|
dialog, g_object_unref);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
global_about_dialog = dialog;
|
|
|
|
|
|
2004-07-12 16:38:04 +00:00
|
|
|
|
}
|
2009-11-30 00:48:16 +00:00
|
|
|
|
|
2004-07-12 16:38:04 +00:00
|
|
|
|
gtk_window_present (GTK_WINDOW (dialog));
|
|
|
|
|
}
|
2010-08-10 04:00:15 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* gtk_about_dialog_set_license_type: (attributes org.gtk.Method.set_property=license-type)
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: a `GtkAboutDialog`
|
2010-08-10 04:00:15 +00:00
|
|
|
|
* @license_type: the type of license
|
|
|
|
|
*
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* Sets the license of the application showing the about dialog from a
|
2010-08-10 04:00:15 +00:00
|
|
|
|
* list of known licenses.
|
|
|
|
|
*
|
|
|
|
|
* This function overrides the license set using
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* [method@Gtk.AboutDialog.set_license].
|
2010-08-10 04:00:15 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
gtk_about_dialog_set_license_type (GtkAboutDialog *about,
|
|
|
|
|
GtkLicense license_type)
|
|
|
|
|
{
|
|
|
|
|
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
|
|
|
|
g_return_if_fail (license_type >= GTK_LICENSE_UNKNOWN &&
|
2020-05-11 17:12:08 +00:00
|
|
|
|
license_type < G_N_ELEMENTS (gtk_license_info));
|
2010-08-10 04:00:15 +00:00
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
if (about->license_type != license_type)
|
2010-08-10 04:00:15 +00:00
|
|
|
|
{
|
|
|
|
|
g_object_freeze_notify (G_OBJECT (about));
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
about->license_type = license_type;
|
2010-08-10 04:00:15 +00:00
|
|
|
|
|
2022-11-28 18:43:36 +00:00
|
|
|
|
gtk_widget_set_visible (about->license_label, TRUE);
|
2010-08-10 04:00:15 +00:00
|
|
|
|
/* custom licenses use the contents of the :license property */
|
2020-03-28 04:42:44 +00:00
|
|
|
|
if (about->license_type != GTK_LICENSE_CUSTOM)
|
2010-08-10 04:00:15 +00:00
|
|
|
|
{
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *name;
|
|
|
|
|
const char *url;
|
|
|
|
|
char *license_string;
|
2010-08-10 04:00:15 +00:00
|
|
|
|
GString *str;
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
name = _(gtk_license_info[about->license_type].name);
|
|
|
|
|
url = gtk_license_info[about->license_type].url;
|
2010-08-10 04:00:15 +00:00
|
|
|
|
if (url == NULL)
|
2020-03-28 04:42:44 +00:00
|
|
|
|
url = about->website_url;
|
2010-08-10 04:00:15 +00:00
|
|
|
|
|
|
|
|
|
str = g_string_sized_new (256);
|
2016-04-04 12:16:17 +00:00
|
|
|
|
/* Translators: this is the license preamble; the string at the end
|
|
|
|
|
* contains the name of the license as link text.
|
|
|
|
|
*/
|
|
|
|
|
g_string_append_printf (str, _("This program comes with absolutely no warranty.\nSee the <a href=\"%s\">%s</a> for details."), url, name);
|
2010-08-10 04:00:15 +00:00
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
g_free (about->license);
|
|
|
|
|
about->license = g_string_free (str, FALSE);
|
|
|
|
|
about->wrap_license = TRUE;
|
2010-12-10 06:27:55 +00:00
|
|
|
|
|
|
|
|
|
license_string = g_strdup_printf ("<span size=\"small\">%s</span>",
|
2020-03-28 04:42:44 +00:00
|
|
|
|
about->license);
|
|
|
|
|
gtk_label_set_markup (GTK_LABEL (about->license_label), license_string);
|
2010-12-10 06:27:55 +00:00
|
|
|
|
g_free (license_string);
|
|
|
|
|
|
2014-06-07 05:06:51 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (about), props[PROP_WRAP_LICENSE]);
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (about), props[PROP_LICENSE]);
|
2010-08-10 04:00:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-10-06 16:53:46 +00:00
|
|
|
|
update_license_button_visibility (about);
|
|
|
|
|
|
2014-06-07 05:06:51 +00:00
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (about), props[PROP_LICENSE_TYPE]);
|
2010-08-10 04:00:15 +00:00
|
|
|
|
|
|
|
|
|
g_object_thaw_notify (G_OBJECT (about));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* gtk_about_dialog_get_license_type: (attributes org.gtk.Method.get_property=license-type)
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: a `GtkAboutDialog`
|
2010-08-10 04:00:15 +00:00
|
|
|
|
*
|
2021-02-26 14:51:10 +00:00
|
|
|
|
* Retrieves the license type.
|
2010-08-10 04:00:15 +00:00
|
|
|
|
*
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* Returns: a [enum@Gtk.License] value
|
2010-08-10 04:00:15 +00:00
|
|
|
|
*/
|
|
|
|
|
GtkLicense
|
|
|
|
|
gtk_about_dialog_get_license_type (GtkAboutDialog *about)
|
|
|
|
|
{
|
|
|
|
|
g_return_val_if_fail (GTK_IS_ABOUT_DIALOG (about), GTK_LICENSE_UNKNOWN);
|
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
return about->license_type;
|
2010-08-10 04:00:15 +00:00
|
|
|
|
}
|
2012-01-25 23:21:47 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gtk_about_dialog_add_credit_section:
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* @about: A `GtkAboutDialog`
|
2012-01-25 23:21:47 +00:00
|
|
|
|
* @section_name: The name of the section
|
2012-11-22 13:51:52 +00:00
|
|
|
|
* @people: (array zero-terminated=1): The people who belong to that section
|
2012-01-25 23:21:47 +00:00
|
|
|
|
*
|
2021-02-18 13:38:55 +00:00
|
|
|
|
* Creates a new section in the "Credits" page.
|
2012-01-25 23:21:47 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
|
|
|
|
gtk_about_dialog_add_credit_section (GtkAboutDialog *about,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *section_name,
|
|
|
|
|
const char **people)
|
2012-01-25 23:21:47 +00:00
|
|
|
|
{
|
|
|
|
|
CreditSection *new_entry;
|
|
|
|
|
|
|
|
|
|
g_return_if_fail (GTK_IS_ABOUT_DIALOG (about));
|
|
|
|
|
g_return_if_fail (section_name != NULL);
|
|
|
|
|
g_return_if_fail (people != NULL);
|
|
|
|
|
|
|
|
|
|
new_entry = g_slice_new (CreditSection);
|
2020-07-24 18:40:36 +00:00
|
|
|
|
new_entry->heading = g_strdup ((char *)section_name);
|
|
|
|
|
new_entry->people = g_strdupv ((char **)people);
|
2012-01-25 23:21:47 +00:00
|
|
|
|
|
2020-03-28 04:42:44 +00:00
|
|
|
|
about->credit_sections = g_slist_append (about->credit_sections, new_entry);
|
2012-01-25 23:21:47 +00:00
|
|
|
|
update_credits_button_visibility (about);
|
|
|
|
|
}
|