gtk.AboutDialog
- class
AboutDialog
: gtk.Dialog.Dialog;
- The
AboutDialog
offers a simple way to display information about
a program like its 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.
About dialog often contain links and email addresses.
AboutDialog
supports this by offering global hooks, which are called when the user
clicks on a link or email address, see setEmailHook() and
setUrlHook(). Email addresses in the authors, documenters and
artists properties are recognized by looking for
, URLs are recognized by looking for http://url, with
url extending to the next space, tab or line break.
Since 2.18 GtkAboutDialog provides default website and email hooks that
use gtk.MountOperation.showUri().
If you want provide your own hooks overriding the default ones, it is important
to do so before setting the website and email URL properties, like this:
AboutDialog.setUrlHook(cast(GtkAboutDialogActivateLinkFunc)&launchUrl, null, null);
dialog.setWebsite(url);
To disable the default hooks, you can pass null as the hook func. Then,
the GtkAboutDialog widget will not display the website or the
email addresses as clickable.
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:
auto dialog = new Dialog();
dialog.setProgramName("Example Code");
dialog.setLogo(exampleLogo);
dialog.setTitle("About ExampleCode");
- protected GtkAboutDialog*
gtkAboutDialog
;
- the main Gtk struct
- protected void*
getStruct
();
- the main Gtk struct as a void*
- this(GtkAboutDialog* gtkAboutDialog);
- Sets our main struct and passes it to the parent class
- this();
- Since 2.6
Throws:
ConstructionException GTK+ fails to create the object.
- string
getName
();
- Deprecated:
Replaced with getProgramName in GTK version 2.12
and should not be used in newly-written code.
Since 2.6
Returns:
The program name.
- void
setName
(string name);
- Deprecated:
Replaced with setProgramName in GTK version 2.12
and should not be used in newly-written code.
If this is not set, it defaults to glib.Util.getApplicationName().
Since 2.6
Params:
| string name |
the program name |
- string
getProgramName
();
- Since 2.12
Returns:
The program name.
- void
setProgramName
(string name);
- Sets the name to display in the about dialog.
If this is not set, it defaults to glib.Util.getApplicationName().
Since 2.12
Params:
| string name |
the program name |
- string
getVersion
();
- Since 2.6
Returns:
The version string.
- void
setVersion
(string versio);
- Sets the version string to display in the about dialog.
Since 2.6
- string
getCopyright
();
- Since 2.6
Returns:
The copyright string.
- void
setCopyright
(string copyright);
- Sets the copyright string to display in the about dialog.
This should be a short string of one or two lines.
Since 2.6
Params:
| string copyright |
the copyright string |
- string
getComments
();
- Since 2.6
Returns:
The comments.
- void
setComments
(string comments);
- Sets the comments string to display in the about
dialog. This should be a short string of one or
two lines.
Since 2.6
Params:
| string comments |
a comments string |
- string
getLicense
();
- Since 2.6
Returns:
The license information.
- void
setLicense
(string license);
- Sets the license information to be displayed in the secondary
license dialog. If license is null, the license button is
hidden.
Since 2.6
Params:
| string license |
the license information or null |
- int
getWrapLicense
();
- Since 2.8
Returns:
true if the license text is wrapped
- void
setWrapLicense
(int wrapLicense);
- Sets whether the license text in about is
automatically wrapped.
Since 2.8
Params:
| int wrapLicense |
whether to wrap the license |
- string
getWebsite
();
- Since 2.6
Returns:
The website URL.
- void
setWebsite
(string website);
- Sets the URL to use for the website link.
Since 2.6
Params:
| string website |
a URL string starting with "http://" |
- string
getWebsiteLabel
();
- Since 2.6
Returns:
The label used for the website link.
- void
setWebsiteLabel
(string websiteLabel);
- Sets the label to be used for the website link.
It defaults to the website URL.
Since 2.6
Params:
| string websiteLabel |
the label used for the website link |
- string[]
getAuthors
();
- Returns the strings which are displayed in the authors tab
of the secondary credits dialog.
Since 2.6
Returns:
A string array containing the authors.
- void
setAuthors
(string[] authors);
- Sets the strings which are displayed in the authors tab
of the secondary credits dialog.
Since 2.6
Params:
| string[] authors |
the authors |
- string[]
getArtists
();
- Returns the strings which are displayed in the artists tab
of the secondary credits dialog.
Since 2.6
Returns:
A string array containing the artists.
- void
setArtists
(string[] artists);
- Sets the strings which are displayed in the artists tab
of the secondary credits dialog.
Since 2.6
Params:
| string[] artists |
the artists. |
- string[]
getDocumenters
();
- Returns the string which are displayed in the documenters
tab of the secondary credits dialog.
Since 2.6
Returns:
A string array containing the documenters.
- void
setDocumenters
(string[] documenters);
- Sets the strings which are displayed in the documenters tab
of the secondary credits dialog.
Since 2.6
Params:
| string[] documenters |
the documenters |
- string
getTranslatorCredits
();
- Returns the translator credits string which is displayed
in the translators tab of the secondary credits dialog.
Since 2.6
Returns:
The translator credits string.
- void
setTranslatorCredits
(string translatorCredits);
- Sets the translator credits string which is displayed in
the translators tab of the secondary credits dialog.
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:
dialog.setTranslatorCredits( _("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 hide the tab.
Since 2.6
Params:
| string translatorCredits |
the translator credits |
- Pixbuf
getLogo
();
- Since 2.6
Returns:
the pixbuf displayed as logo.
- void
setLogo
(Pixbuf logo);
- Sets the pixbuf to be displayed as logo in
the about dialog. If it is null, the default
window icon set with gtk.Window.setDefaultIcon()
will be used.
Since 2.6
Params:
| Pixbuf logo |
a GdkPixbuf, or null |
- string
getLogoIconName
();
- Since 2.6
Returns:
the icon name displayed as logo.
- void
setLogoIconName
(string iconName);
- Sets the pixbuf to be displayed as logo in
the about dialog. If it is null, the default
window icon set with gtk.Window.setDefaultIcon()
will be used.
Since 2.6
Params:
| string iconName |
an icon name, or null |
- static GtkAboutDialogActivateLinkFunc
setEmailHook
(GtkAboutDialogActivateLinkFunc func, void* data, GDestroyNotify destroy);
- Installs a global function to be called whenever the user
activates an email link in an about dialog.
Since 2.18 there exists a default function which uses
gtk.MountOperation.showUri(). To deactivate it,
you can pass null for func.
Since 2.6
Params:
| GtkAboutDialogActivateLinkFunc func |
a function to call when an email link is activated. |
| void* data |
data to pass to func |
| GDestroyNotify destroy |
GDestroyNotify for data |
Returns:
the previous email hook.
- static GtkAboutDialogActivateLinkFunc
setUrlHook
(GtkAboutDialogActivateLinkFunc func, void* data, GDestroyNotify destroy);
- Installs a global function to be called whenever the user
activates a URL link in an about dialog.
Since 2.18 there exists a default function which uses
gtk.MountOperation.showUri(). To deactivate it,
you can pass null for func.
Since 2.6
Params:
| GtkAboutDialogActivateLinkFunc func |
a function to call when a URL link is activated. |
| void* data |
data to pass to func |
| GDestroyNotify destroy |
GDestroyNotify for data |
Returns:
the previous URL hook.
|