Gtk.AboutDialog¶
class — extends Window, Accessible, Buildable, ConstraintTarget, Native, Root, ShortcutManager
Displays information about a program.
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.
<picture> <source srcset="aboutdialot-dark.png" media="(prefers-color-scheme: dark)"> <img alt="An example GtkAboutDialog" src="aboutdialog.png"> </picture>
About dialogs often contain links and email addresses. GtkAboutDialog
displays these as clickable links. By default, it calls FileLauncher.launch
when a user clicks one. The behaviour can be overridden with the
AboutDialog.activate-link signal.
To specify a person with an email address, use a string like
Edgar Allan Poe <edgar@poe.com>. To specify a website with a title,
use a string like GTK team https://www.gtk.org.
To make constructing an about dialog as convenient as possible, you can
use the function Gtk.show_about_dialog which constructs and shows
a dialog and keeps it around so that it can be shown again.
Note that GTK sets a default title of _("About %s") on the dialog
window (where %s is replaced by the name of the application, but in
order to ensure proper translation of the title, applications should
set the title property explicitly when constructing an about dialog,
as shown in the following example:
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);
gtk_show_about_dialog (NULL,
"program-name", "ExampleCode",
"logo", example_logo,
"title", _("About ExampleCode"),
NULL);
Shortcuts and Gestures¶
GtkAboutDialog supports the following keyboard shortcuts:
- <kbd>Escape</kbd> closes the window.
CSS nodes¶
GtkAboutDialog has a single CSS node with the name window and style
class .aboutdialog.
Constructors¶
new¶
Creates a new GtkAboutDialog.
Methods¶
add_credit_section¶
Creates a new section in the "Credits" page.
Parameters:
section_name— The name of the sectionpeople— the people who belong to that section
get_artists¶
Returns the names of the artists which are displayed in the credits page.
get_authors¶
Returns the names of the authors which are displayed in the credits page.
get_comments¶
Returns the comments string.
get_copyright¶
Returns the copyright string.
get_documenters¶
Returns the name of the documenters which are displayed in the credits page.
get_license¶
Returns the license information.
get_license_type¶
Retrieves the license type.
get_logo¶
Returns the paintable displayed as logo in the about dialog.
get_logo_icon_name¶
Returns the icon name displayed as logo in the about dialog.
get_program_name¶
Returns the program name displayed in the about dialog.
get_system_information¶
Returns the system information that is shown in the about dialog.
get_translator_credits¶
Returns the translator credits string which is displayed in the credits page.
get_version¶
Returns the version string.
get_website¶
Returns the website URL.
get_website_label¶
Returns the label used for the website link.
get_wrap_license¶
Returns whether the license text in the about dialog is automatically wrapped.
set_artists¶
Sets the names of the artists to be displayed in the "Credits" page.
Parameters:
artists— the authors of the artwork of the application
set_authors¶
Sets the names of the authors which are displayed in the "Credits" page of the about dialog.
Parameters:
authors— the authors of the application
set_comments¶
Sets the comments string to display in the about dialog.
This should be a short string of one or two lines.
Parameters:
comments— a comments string
set_copyright¶
Sets the copyright string to display in the about dialog.
This should be a short string of one or two lines.
Parameters:
copyright— the copyright string
set_documenters¶
Sets the names of the documenters which are displayed in the "Credits" page.
Parameters:
documenters— the authors of the documentation of the application
set_license¶
Sets the license information to be displayed in the about dialog.
If license is NULL, the license page is hidden.
Parameters:
license— the license information
set_license_type¶
Sets the license of the application showing the about dialog from a list of known licenses.
This function overrides the license set using
AboutDialog.set_license.
Parameters:
license_type— the type of license
set_logo¶
Sets the logo in the about dialog.
Parameters:
logo— aGdkPaintable
set_logo_icon_name¶
Sets the icon name to be displayed as logo in the about dialog.
Parameters:
icon_name— an icon name
set_program_name¶
Sets the name to display in the about dialog.
If name is not set, the string returned
by g_get_application_name() is used.
Parameters:
name— the program name
set_system_information¶
Sets the system information to be displayed in the about dialog.
If system_information is NULL, the system information
page is hidden.
See AboutDialog.system-information.
Parameters:
system_information— system information
set_translator_credits¶
Sets the translator credits string which is displayed in the credits page.
The intended use for this string is to display the translator
of the language which is currently used in the user interface.
Using gettext(), a simple way to achieve that is to mark the
string for translation:
GtkWidget *about = gtk_about_dialog_new ();
gtk_about_dialog_set_translator_credits (GTK_ABOUT_DIALOG (about),
_("translator-credits"));
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.
Parameters:
translator_credits— the translator credits
set_version¶
Sets the version string to display in the about dialog.
Parameters:
version— the version string
set_website¶
Sets the URL to use for the website link.
Parameters:
website— a URL string starting withhttp://
set_website_label¶
Sets the label to be used for the website link.
Parameters:
website_label— the label used for the website link
set_wrap_license¶
Sets whether the license text in the about dialog should be automatically wrapped.
Parameters:
wrap_license— whether to wrap the license
Properties¶
artists¶
The people who contributed artwork to the program.
Each string may contain email addresses and URLs, which will be displayed as links.
authors¶
The authors of the program.
Each string may contain email addresses and URLs, which will be displayed as links, see the introduction for more details.
comments¶
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.
copyright¶
Copyright information for the program.
documenters¶
The people documenting the program.
Each string may contain email addresses and URLs, which will be displayed as links, see the introduction for more details.
license¶
The license of the program, as free-form text.
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;
otherwise the text itself must contain the intended linebreaks.
When setting this property to a non-NULL value, the
AboutDialog.license-type property is set to
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
be converted into clickable links.
license_type¶
The license of the program.
The GtkAboutDialog will automatically fill out a standard disclaimer
and link the user to the appropriate online resource for the license
text.
If License.unknown is used, the link used will be the same
specified in the AboutDialog.website property.
If License.custom is used, the current contents of the
AboutDialog.license property are used.
For any other License value, the contents of the
AboutDialog.license property are also set by
this property as a side effect.
logo¶
A logo for the about box.
If it is NULL, the default window icon set with
Window.set_default_icon_name will be used.
logo_icon_name¶
A named icon to use as the logo for the about box.
This property overrides the AboutDialog.logo property.
program_name¶
The name of the program.
If this is not set, it defaults to the value returned by
GLib.get_application_name.
system_information¶
Information about the system on which the program is running.
This information is displayed in a separate page, therefore it is fine to use a long multi-paragraph text. Note that the text should contain the intended linebreaks.
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
be converted into clickable links.
translator_credits¶
Credits to the translators.
This string should be marked as translatable.
The string may contain email addresses and URLs, which will be displayed as links, see the introduction for more details.
version¶
The version of the program.
website¶
The URL for the link to the website of the program.
This should be a string starting with http:// or https://.
website_label¶
The label for the link to the website of the program.
wrap_license¶
Whether to wrap the text in the license dialog.
Signals¶
activate-link¶
Emitted every time a URL is activated.
Applications may connect to it to override the default behaviour,
which is to call FileLauncher.launch.