Class AboutDialog

All Implemented Interfaces:
Accessible, Buildable, ConstraintTarget, Native, Root, ShortcutManager, Proxy

@Generated("org.javagi.JavaGI") public class AboutDialog extends Window implements 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.

An example GtkAboutDialog

About dialogs often contain links and email addresses. GtkAboutDialog displays these as clickable links. By default, it calls FileLauncher.launch(Window, Cancellable, AsyncReadyCallback) when a user clicks one. The behaviour can be overridden with the Gtk.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.showAboutDialog(Window, String, Object...) 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:

  • Escape closes the window.

CSS nodes

GtkAboutDialog has a single CSS node with the name window and style class .aboutdialog.

  • Constructor Details

    • AboutDialog

      public AboutDialog(MemorySegment address)
      Create a AboutDialog instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • AboutDialog

      public AboutDialog()
      Create a new AboutDialog.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the AboutDialog class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected AboutDialog asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class Window
      Returns:
      the instance as if it were its parent type
    • addCreditSection

      public void addCreditSection(String sectionName, @Nullable String @Nullable [] people)
      Creates a new section in the "Credits" page.
      Parameters:
      sectionName - The name of the section
      people - the people who belong to that section
    • getArtists

      public String[] getArtists()
      Returns the names of the artists which are displayed in the credits page.
      Returns:
      A NULL-terminated string array containing the artists
    • getAuthors

      public String[] getAuthors()
      Returns the names of the authors which are displayed in the credits page.
      Returns:
      A NULL-terminated string array containing the authors
    • getComments

      public @Nullable String getComments()
      Returns the comments string.
      Returns:
      The comments
    • getCopyright

      public @Nullable String getCopyright()
      Returns the copyright string.
      Returns:
      The copyright string
    • getDocumenters

      public String[] getDocumenters()
      Returns the name of the documenters which are displayed in the credits page.
      Returns:
      A NULL-terminated string array containing the documenters
    • getLicense

      public @Nullable String getLicense()
      Returns the license information.
      Returns:
      The license information
    • getLicenseType

      public License getLicenseType()
      Retrieves the license type.
      Returns:
      a Gtk.License value
    • getLogo

      public @Nullable Paintable getLogo()
      Returns the paintable displayed as logo in the about dialog.
      Returns:
      the paintable displayed as logo or NULL if the logo is unset or has been set via setLogoIconName(String)
    • getLogoIconName

      public @Nullable String getLogoIconName()
      Returns the icon name displayed as logo in the about dialog.
      Returns:
      the icon name displayed as logo, or NULL if the logo has been set via setLogo(Paintable)
    • getProgramName

      public @Nullable String getProgramName()
      Returns the program name displayed in the about dialog.
      Returns:
      the program name
    • getSystemInformation

      public @Nullable String getSystemInformation()
      Returns the system information that is shown in the about dialog.
      Returns:
      the system information
    • getTranslatorCredits

      public @Nullable String getTranslatorCredits()
      Returns the translator credits string which is displayed in the credits page.
      Returns:
      The translator credits string
    • getVersion

      public @Nullable String getVersion()
      Returns the version string.
      Returns:
      The version string
    • getWebsite

      public @Nullable String getWebsite()
      Returns the website URL.
      Returns:
      The website URL
    • getWebsiteLabel

      public @Nullable String getWebsiteLabel()
      Returns the label used for the website link.
      Returns:
      The label used for the website link
    • getWrapLicense

      public boolean getWrapLicense()
      Returns whether the license text in the about dialog is automatically wrapped.
      Returns:
      TRUE if the license text is wrapped
    • setArtists

      public void setArtists(@Nullable String @Nullable [] artists)
      Sets the names of the artists to be displayed in the "Credits" page.
      Parameters:
      artists - the authors of the artwork of the application
    • setAuthors

      public void setAuthors(@Nullable String @Nullable [] 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
    • setComments

      public void setComments(@Nullable String 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
    • setCopyright

      public void setCopyright(@Nullable String 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
    • setDocumenters

      public void setDocumenters(@Nullable String @Nullable [] documenters)
      Sets the names of the documenters which are displayed in the "Credits" page.
      Parameters:
      documenters - the authors of the documentation of the application
    • setLicense

      public void setLicense(@Nullable String 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
    • setLicenseType

      public void setLicenseType(License licenseType)

      Sets the license of the application showing the about dialog from a list of known licenses.

      This function overrides the license set using setLicense(String).

      Parameters:
      licenseType - the type of license
    • setLogo

      public void setLogo(@Nullable Paintable logo)
      Sets the logo in the about dialog.
      Parameters:
      logo - a GdkPaintable
    • setLogoIconName

      public void setLogoIconName(@Nullable String iconName)
      Sets the icon name to be displayed as logo in the about dialog.
      Parameters:
      iconName - an icon name
    • setProgramName

      public void setProgramName(@Nullable String 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
    • setSystemInformation

      public void setSystemInformation(@Nullable String systemInformation)

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

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

      See Gtk.AboutDialog:system-information.

      Parameters:
      systemInformation - system information
    • setTranslatorCredits

      public void setTranslatorCredits(@Nullable String translatorCredits)

      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:
      translatorCredits - the translator credits
    • setVersion

      public void setVersion(@Nullable String version)
      Sets the version string to display in the about dialog.
      Parameters:
      version - the version string
    • setWebsite

      public void setWebsite(@Nullable String website)
      Sets the URL to use for the website link.
      Parameters:
      website - a URL string starting with http://
    • setWebsiteLabel

      public void setWebsiteLabel(String websiteLabel)
      Sets the label to be used for the website link.
      Parameters:
      websiteLabel - the label used for the website link
    • setWrapLicense

      public void setWrapLicense(boolean wrapLicense)
      Sets whether the license text in the about dialog should be automatically wrapped.
      Parameters:
      wrapLicense - whether to wrap the license
    • onActivateLink

      Emitted every time a URL is activated.

      Applications may connect to it to override the default behaviour, which is to call FileLauncher.launch(Window, Cancellable, AsyncReadyCallback).

      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      See Also:
    • emitActivateLink

      public boolean emitActivateLink(String uri)
      Emits the "activate-link" signal. See onActivateLink(AboutDialog.ActivateLinkCallback).
    • builder

      public static AboutDialog.Builder<? extends AboutDialog.Builder> builder()
      A AboutDialog.Builder object constructs a AboutDialog with the specified properties. Use the various set...() methods to set properties, and finish construction with AboutDialog.Builder.build().
      Returns:
      the builder object