Package ch.bailu.gtk.gtk
Class AboutDialog
- All Implemented Interfaces:
PointerInterface
The `GtkAboutDialog` 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.
![An example GtkAboutDialog](aboutdialog.png)
About dialogs often contain links and email addresses. `GtkAboutDialog`
displays these as clickable links. By default, it calls [func@Gtk.show_uri]
when a user clicks one. The behaviour can be overridden with the
[signal@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 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.
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 `GtkAboutDialog`,
as shown in the following example:
```c
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);
```
## CSS nodes
`GtkAboutDialog` has a single CSS node with the name `window` and style
class `.aboutdialog`.
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](aboutdialog.png)
About dialogs often contain links and email addresses. `GtkAboutDialog`
displays these as clickable links. By default, it calls [func@Gtk.show_uri]
when a user clicks one. The behaviour can be overridden with the
[signal@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 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.
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 `GtkAboutDialog`,
as shown in the following example:
```c
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);
```
## CSS nodes
`GtkAboutDialog` has a single CSS node with the name `window` and style
class `.aboutdialog`.
-
Nested Class Summary
Nested classes/interfaces inherited from class ch.bailu.gtk.gtk.Window
Window.OnActivateDefault, Window.OnActivateFocus, Window.OnCloseRequest, Window.OnEnableDebugging, Window.OnKeysChanged
Nested classes/interfaces inherited from class ch.bailu.gtk.gtk.Widget
Widget.OnDestroy, Widget.OnDestroyNotify, Widget.OnDirectionChanged, Widget.OnHide, Widget.OnKeynavFailed, Widget.OnMap, Widget.OnMnemonicActivate, Widget.OnMoveFocus, Widget.OnQueryTooltip, Widget.OnRealize, Widget.OnShow, Widget.OnStateFlagsChanged, Widget.OnTickCallback, Widget.OnUnmap, Widget.OnUnrealize
Nested classes/interfaces inherited from class ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Field Summary
Fields inherited from class ch.bailu.gtk.gtk.Window
SIGNAL_ON_ACTIVATE_DEFAULT, SIGNAL_ON_ACTIVATE_FOCUS, SIGNAL_ON_CLOSE_REQUEST, SIGNAL_ON_ENABLE_DEBUGGING, SIGNAL_ON_KEYS_CHANGED
Fields inherited from class ch.bailu.gtk.gtk.Widget
SIGNAL_ON_DESTROY, SIGNAL_ON_DIRECTION_CHANGED, SIGNAL_ON_HIDE, SIGNAL_ON_KEYNAV_FAILED, SIGNAL_ON_MAP, SIGNAL_ON_MNEMONIC_ACTIVATE, SIGNAL_ON_MOVE_FOCUS, SIGNAL_ON_QUERY_TOOLTIP, SIGNAL_ON_REALIZE, SIGNAL_ON_SHOW, SIGNAL_ON_STATE_FLAGS_CHANGED, SIGNAL_ON_UNMAP, SIGNAL_ON_UNREALIZE
Fields inherited from class ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addCreditSection
(Str section_name, Strs people) Creates a new section in the "Credits" page.void
addCreditSection
(String section_name, Strs people) Creates a new section in the "Credits" page.Implements interfaceAccessible
.Implements interfaceBuildable
.Implements interfaceConstraintTarget
.asNative()
Implements interfaceNative
.asRoot()
Implements interfaceRoot
.Implements interfaceShortcutManager
.Returns the names of the artists which are displayed
in the credits page.Returns the names of the authors which are displayed
in the credits page.static ClassHandler
Returns the comments string.Returns the copyright string.Returns the name of the documenters which are displayed
in the credits page.static int
Returns the license information.int
Retrieves the license type.getLogo()
Returns the paintable displayed as logo in the about dialog.Returns the icon name displayed as logo in the about dialog.static long
static TypeSystem.TypeSize
Returns the program name displayed in the about dialog.Returns the system information that is shown in the about dialog.Returns the translator credits string which is displayed
in the credits page.static long
static TypeSystem.TypeSize
Returns the version string.Returns the website URL.Returns the label used for the website link.boolean
Returns whether the license text in the about dialog is
automatically wrapped.Connect to signal "activate-link".void
setArtists
(Strs artists) Sets the names of the artists to be displayed
in the "Credits" page.void
setAuthors
(Strs authors) Sets the names of the authors which are displayed
in the "Credits" page of the about dialog.void
setComments
(Str comments) Sets the comments string to display in the about dialog.void
setComments
(String comments) Sets the comments string to display in the about dialog.void
setCopyright
(Str copyright) Sets the copyright string to display in the about dialog.void
setCopyright
(String copyright) Sets the copyright string to display in the about dialog.void
setDocumenters
(Strs documenters) Sets the names of the documenters which are displayed
in the "Credits" page.void
setLicense
(Str license) Sets the license information to be displayed in the
about dialog.void
setLicense
(String license) Sets the license information to be displayed in the
about dialog.void
setLicenseType
(int license_type) Sets the license of the application showing the about dialog from a
list of known licenses.void
Sets the logo in the about dialog.void
setLogoIconName
(Str icon_name) Sets the icon name to be displayed as logo in the about dialog.void
setLogoIconName
(String icon_name) Sets the icon name to be displayed as logo in the about dialog.void
setProgramName
(Str name) Sets the name to display in the about dialog.void
setProgramName
(String name) Sets the name to display in the about dialog.void
setSystemInformation
(Str system_information) Sets the system information to be displayed in the about
dialog.void
setSystemInformation
(String system_information) Sets the system information to be displayed in the about
dialog.void
setTranslatorCredits
(Str translator_credits) Sets the translator credits string which is displayed in
the credits page.void
setTranslatorCredits
(String translator_credits) Sets the translator credits string which is displayed in
the credits page.void
setVersion
(Str version) Sets the version string to display in the about dialog.void
setVersion
(String version) Sets the version string to display in the about dialog.void
setWebsite
(Str website) Sets the URL to use for the website link.void
setWebsite
(String website) Sets the URL to use for the website link.void
setWebsiteLabel
(Str website_label) Sets the label to be used for the website link.void
setWebsiteLabel
(String website_label) Sets the label to be used for the website link.void
setWrapLicense
(boolean wrap_license) Sets whether the license text in the about dialog should be
automatically wrapped.Methods inherited from class ch.bailu.gtk.gtk.Window
close, destroy, fullscreen, fullscreenOnMonitor, getApplication, getChild, getDecorated, getDefaultIconName, getDefaultSize, getDefaultWidget, getDeletable, getDestroyWithParent, getFocus, getFocusVisible, getGroup, getHandleMenubarAccel, getHideOnClose, getIconName, getMnemonicsVisible, getModal, getResizable, getTitle, getTitlebar, getToplevels, getTransientFor, hasGroup, isActive, isFullscreen, isMaximized, listToplevels, maximize, minimize, onActivateDefault, onActivateFocus, onCloseRequest, onEnableDebugging, onKeysChanged, present, presentWithTime, setApplication, setAutoStartupNotification, setChild, setDecorated, setDefaultIconName, setDefaultSize, setDefaultWidget, setDeletable, setDestroyWithParent, setDisplay, setFocus, setFocusVisible, setHandleMenubarAccel, setHideOnClose, setIconName, setIconName, setInteractiveDebugging, setMnemonicsVisible, setModal, setResizable, setStartupId, setStartupId, setTitle, setTitle, setTitlebar, setTransientFor, unfullscreen, unmaximize, unminimize
Methods inherited from class ch.bailu.gtk.gtk.Widget
actionSetEnabled, actionSetEnabled, activate, activateAction, activateAction, activateActionVariant, activateActionVariant, activateDefault, addController, addCssClass, addCssClass, addMnemonicLabel, addTickCallback, allocate, childFocus, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, createPangoLayout, disposeTemplate, dragCheckThreshold, errorBell, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getCanFocus, getCanTarget, getChildVisible, getClipboard, getCssClasses, getCssName, getCursor, getDefaultDirection, getDirection, getDisplay, getFirstChild, getFocusable, getFocusChild, getFocusOnClick, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getName, getNative, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPreferredSize, getPrevSibling, getPrimaryClipboard, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTemplateChild, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth, grabFocus, hasCssClass, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertActionGroup, insertAfter, insertBefore, isAncestor, isDrawable, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, observeChildren, observeControllers, onDestroy, onDirectionChanged, onHide, onKeynavFailed, onMap, onMnemonicActivate, onMoveFocus, onQueryTooltip, onRealize, onShow, onStateFlagsChanged, onUnmap, onUnrealize, pick, queueAllocate, queueDraw, queueResize, realize, removeController, removeCssClass, removeCssClass, removeMnemonicLabel, removeTickCallback, setCanFocus, setCanTarget, setChildVisible, setCssClasses, setCursor, setCursorFromName, setCursorFromName, setDefaultDirection, setDirection, setFocusable, setFocusChild, setFocusOnClick, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setLayoutManager, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setName, setOpacity, setOverflow, setParent, setReceivesDefault, setSensitive, setSizeRequest, setStateFlags, setTooltipMarkup, setTooltipMarkup, setTooltipText, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible, shouldLayout, show, sizeAllocate, snapshotChild, triggerTooltipQuery, unmap, unparent, unrealize, unsetStateFlags
Methods inherited from class ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Methods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Methods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Field Details
-
SIGNAL_ON_ACTIVATE_LINK
- See Also:
-
-
Constructor Details
-
AboutDialog
-
AboutDialog
public AboutDialog()Creates a new `GtkAboutDialog`.
-
-
Method Details
-
getClassHandler
-
addCreditSection
Creates a new section in the "Credits" page.- Parameters:
section_name
- The name of the sectionpeople
- The people who belong to that section
-
addCreditSection
Creates a new section in the "Credits" page.- Parameters:
section_name
- The name of the sectionpeople
- The people who belong to that section
-
getArtists
Returns the names of the artists which are displayed
in the credits page.- Returns:
- A `NULL`-terminated string array containing the artists
-
getAuthors
Returns the names of the authors which are displayed
in the credits page.- Returns:
- A `NULL`-terminated string array containing the authors
-
getComments
Returns the comments string.- Returns:
- The comments
-
getCopyright
Returns the copyright string.- Returns:
- The copyright 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
Returns the license information.- Returns:
- The license information
-
getLicenseType
public int getLicenseType()Retrieves the license type.- Returns:
- a [enum@Gtk.License] value
-
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 [method@Gtk.AboutDialog.set_logo_icon_name]
-
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 [method@Gtk.AboutDialog.set_logo]
-
getProgramName
Returns the program name displayed in the about dialog.- Returns:
- The program name
-
getSystemInformation
Returns the system information that is shown in the about dialog.- Returns:
- the system information
-
getTranslatorCredits
Returns the translator credits string which is displayed
in the credits page.- Returns:
- The translator credits string
-
getVersion
Returns the version string.- Returns:
- The version string
-
getWebsite
Returns the website URL.- Returns:
- The website URL
-
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
Sets the names of the artists to be displayed
in the "Credits" page.- Parameters:
artists
- the authors of the artwork of the application
-
setAuthors
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
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
-
setComments
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
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
-
setCopyright
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
Sets the names of the documenters which are displayed
in the "Credits" page.- Parameters:
documenters
- the authors of the documentation of the application
-
setLicense
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
-
setLicense
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(int 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
[method@Gtk.AboutDialog.set_license].- Parameters:
license_type
- the type of license
-
setLogo
Sets the logo in the about dialog.- Parameters:
logo
- a `GdkPaintable`
-
setLogoIconName
Sets the icon name to be displayed as logo in the about dialog.- Parameters:
icon_name
- an icon name
-
setLogoIconName
Sets the icon name to be displayed as logo in the about dialog.- Parameters:
icon_name
- an icon name
-
setProgramName
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
-
setProgramName
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
Sets the system information to be displayed in the about
dialog.
If `system_information` is `NULL`, the system information
page is hidden.
See [property@Gtk.AboutDialog:system-information].- Parameters:
system_information
- system information
-
setSystemInformation
Sets the system information to be displayed in the about
dialog.
If `system_information` is `NULL`, the system information
page is hidden.
See [property@Gtk.AboutDialog:system-information].- Parameters:
system_information
- system information
-
setTranslatorCredits
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:
```c
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
-
setTranslatorCredits
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:
```c
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
-
setVersion
Sets the version string to display in the about dialog.- Parameters:
version
- the version string
-
setVersion
Sets the version string to display in the about dialog.- Parameters:
version
- the version string
-
setWebsite
Sets the URL to use for the website link.- Parameters:
website
- a URL string starting with `http://`
-
setWebsite
Sets the URL to use for the website link.- Parameters:
website
- a URL string starting with `http://`
-
setWebsiteLabel
Sets the label to be used for the website link.- Parameters:
website_label
- the label used for the website link
-
setWebsiteLabel
Sets the label to be used for the website link.- Parameters:
website_label
- the label used for the website link
-
setWrapLicense
public void setWrapLicense(boolean wrap_license) Sets whether the license text in the about dialog should be
automatically wrapped.- Parameters:
wrap_license
- whether to wrap the license
-
onActivateLink
Connect to signal "activate-link".
SeeAboutDialog.OnActivateLink.onActivateLink(ch.bailu.gtk.type.Str)
for signal description.
FieldSIGNAL_ON_ACTIVATE_LINK
contains original signal name and can be used as resource reference.- Parameters:
signal
- callback function (lambda).- Returns:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
asAccessible
Implements interfaceAccessible
. Call this to get access to interface functions.- Overrides:
asAccessible
in classWindow
- Returns:
Accessible
-
asBuildable
Implements interfaceBuildable
. Call this to get access to interface functions.- Overrides:
asBuildable
in classWindow
- Returns:
Buildable
-
asConstraintTarget
Implements interfaceConstraintTarget
. Call this to get access to interface functions.- Overrides:
asConstraintTarget
in classWindow
- Returns:
ConstraintTarget
-
asNative
Implements interfaceNative
. Call this to get access to interface functions. -
asRoot
Implements interfaceRoot
. Call this to get access to interface functions. -
asShortcutManager
Implements interfaceShortcutManager
. Call this to get access to interface functions.- Overrides:
asShortcutManager
in classWindow
- Returns:
ShortcutManager
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-