About my projects, examples and tutorials
Gnome::Gtk4::AboutDialog

Gnome::Gtk4::AboutDialog

Description§

The Gnome::Gtk4::AboutDialog offers a simple way to display 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.

<img src="asset_files/images/aboutdialog.png" width="30%" class=inline />

About dialogs often contain links and email addresses. Gnome::Gtk4::AboutDialog displays these as clickable links. By default, it calls .launch() in class FileLauncher when a user clicks one. The behaviour can be overridden with the 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 a Gnome::Gtk4::AboutDialog as convenient as possible, you can use the function .show-about-dialog() in package Gnome::Gtk4::T-aboutdialog 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 a Gnome::Gtk4::AboutDialog, as shown in the following example:

use Gnome::Gtk4::Window:api<2>;
use Gnome::Gtk4::AboutDialog:api<2>;
use Gnome::Gtk4::T-AboutDialog:api<2>;

my Gnome::Gtk4::Window $window .= new-window;

my Gnome::Gtk4::AboutDialog $about .= new-aboutdialog;
$about.set-transient-for($window);
$about.set-version('0.21.4');
$about.set-license-type(GTK_LICENSE_ARTISTIC);

# Normally run() is started by a menu select or button click
$about.run;   # application stays in $about in separate event loop
$about.hide;  # application returns here when buttons
              # on dialog are pressed
Code

CSS nodes§

Gnome::Gtk4::AboutDialog has a single CSS node with the name window and style class .aboutdialog.

Uml Diagram§

Class initialization§

new§

:native-object§

Create an object using a native object from an object of the same type found elsewhere. See also Gnome::N::TopLevelSupportClass.

multi method new ( N-Object() :$native-object! )
Code

new-aboutdialog§

Creates a new Gnome::Gtk4::AboutDialog.

method new-aboutdialog ( --> Gnome::Gtk4::AboutDialog )
Code

Methods§

add-credit-section§

Creates a new section in the "Credits" page.

method add-credit-section ( Str $section-name, Array[Str] $people )
Code
  • $section-name; The name of the section.
  • $people; The people who belong to that section.

get-artists§

Returns the names of the artists which are displayed in the credits page.

method get-artists (--> Array[Str] )
Code

Return value; A string array containing the artists.

get-authors§

Returns the names of the authors which are displayed in the credits page.

method get-authors (--> Array[Str] )
Code

Return value; A string array containing the authors.

get-comments§

Returns the comments string.

method get-comments (--> Str )
Code

Return value; The comments.

Returns the copyright string.

method get-copyright (--> Str )
Code

Return value; The copyright string.

get-documenters§

Returns the name of the documenters which are displayed in the credits page.

method get-documenters (--> Array[Str] )
Code

Return value; A string array containing the documenters.

get-license§

Returns the license information.

method get-license (--> Str )
Code

Return value; The license information.

get-license-type§

Retrieves the license type.

method get-license-type (--> GtkLicense )
Code

Return value; an enumeration License from Gnome::Gtk4::T-aboutdialog value.

Returns the paintable displayed as logo in the about dialog.

method get-logo (--> N-Object )
Code

Return value; the paintable displayed as logo or undefined if the logo is unset or has been set via .set-logo-icon-name().

get-logo-icon-name§

Returns the icon name displayed as logo in the about dialog.

method get-logo-icon-name (--> Str )
Code

Return value; the icon name displayed as logo, or undefined if the logo has been set via .set-logo().

get-program-name§

Returns the program name displayed in the about dialog.

method get-program-name (--> Str )
Code

Return value; The program name.

get-system-information§

Returns the system information that is shown in the about dialog.

method get-system-information (--> Str )
Code

Return value; the system information.

get-translator-credits§

Returns the translator credits string which is displayed in the credits page.

method get-translator-credits (--> Str )
Code

Return value; The translator credits string.

get-version§

Returns the version string.

method get-version (--> Str )
Code

Return value; The version string.

get-website§

Returns the website URL.

method get-website (--> Str )
Code

Return value; The website URL.

get-website-label§

Returns the label used for the website link.

method get-website-label (--> Str )
Code

Return value; The label used for the website link.

get-wrap-license§

Returns whether the license text in the about dialog is automatically wrapped.

method get-wrap-license (--> Bool )
Code

Return value; True if the license text is wrapped.

set-artists§

Sets the names of the artists to be displayed in the "Credits" page.

method set-artists ( Array[Str] $artists )
Code
  • $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.

method set-authors ( Array[Str] $authors )
Code
  • $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.

method set-comments ( Str $comments )
Code
  • $comments; a comments string.

Sets the copyright string to display in the about dialog.

This should be a short string of one or two lines.

method set-copyright ( Str $copyright )
Code
  • $copyright; the copyright string.

set-documenters§

Sets the names of the documenters which are displayed in the "Credits" page.

method set-documenters ( Array[Str] $documenters )
Code
  • $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 undefined, the license page is hidden.

method set-license ( Str $license )
Code
  • $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 .set-license().

method set-license-type ( GtkLicense $license-type )
Code
  • $license-type; the type of license.

Sets the logo in the about dialog.

method set-logo ( N-Object() $logo )
Code

set-logo-icon-name§

Sets $icon-name to be displayed as logo in the about dialog.

method set-logo-icon-name ( Str $icon-name )
Code
  • $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 Gnome::Glib::T-utils()` is used.

method set-program-name ( Str $name )
Code
  • $name; the program name.

set-system-information§

Sets the system information to be displayed in the about dialog.

If system_information is undefined, the system information page is hidden.

See system-information.

method set-system-information ( Str $system-information )
Code
  • $system-information; system information.

set-translator-credits§

Sets the translator credits string which is displayed in the credits page.

method set-translator-credits ( Str $translator-credits )
Code
  • $translator-credits; the translator credits.

set-version§

Sets the version string to display in the about dialog.

method set-version ( Str $version )
Code
  • $version; the version string.

set-website§

Sets the URL to use for the website link.

method set-website ( Str $website )
Code
  • $website; a URL string starting with http://`.

set-website-label§

Sets the label to be used for the website link.

method set-website-label ( Str $website-label )
Code
  • $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.

method set-wrap-license ( Bool() $wrap-license )
Code
  • $wrap-license; whether to wrap the license.

Signals§

Emitted every time a URL is activated.

Applications may connect to it to override the default behaviour, which is to call .launch() in class FileLauncher.

method handler (
  Str $uri,
  Int :$_handle_id,
  N-Object :$_native-object,
  *%user-options
  --> gboolean
)
Code
  • $uri; the URI that is activated.
  • $_handle_id; The registered event handler id.
  • $_native-object; The native object provided by the Raku object which registered this event. This is a native Gnome::Gtk4::AboutDialog object.
  • %user-options; A list of named arguments provided by .register-signal() in class Object.

Return value; True if the link has been activated