Top |
GStrv | artists | Read / Write |
GStrv | authors | Read / Write |
char * | comments | Read / Write |
char * | copyright | Read / Write |
GStrv | documenters | Read / Write |
char * | license | Read / Write |
GdkPixbuf * | logo | Read / Write |
char * | logo-icon-name | Read / Write |
char * | program-name | Read / Write |
char * | translator-credits | Read / Write |
char * | version | Read / Write |
char * | website | Read / Write |
char * | website-label | Read / Write |
gboolean | wrap-license | Read / Write |
GObject ╰── GInitiallyUnowned ╰── GtkObject ╰── GtkWidget ╰── GtkContainer ╰── GtkBin ╰── GtkWindow ╰── GtkDialog ╰── GtkAboutDialog
The GtkAboutDialog 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. GtkAboutDialog
supports this by offering global hooks, which are called when the user
clicks on a link or email address, see gtk_about_dialog_set_email_hook()
and gtk_about_dialog_set_url_hook()
. Email addresses in the
authors, documenters and artists properties are recognized by looking for
<user@host>
, 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_show_uri()
.
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:
1 2 |
gtk_about_dialog_set_url_hook (GTK_ABOUT_DIALOG (dialog), launch_url, NULL, NULL); gtk_about_dialog_set_website (GTK_ABOUT_DIALOG (dialog), app_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.
To make constructing a GtkAboutDialog 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
a GtkAboutDialog, as shown in the following example:
1 2 3 4 5 |
gtk_show_about_dialog (NULL, "program-name", "ExampleCode", "logo", example_logo, "title" _("About ExampleCode"), NULL); |
Note that prior to GTK+ 2.12, the “program-name” property was called "name". This was changed to avoid the conflict with the “name” property.
GtkWidget *
gtk_about_dialog_new (void
);
Creates a new GtkAboutDialog.
Since: 2.6
const gchar *
gtk_about_dialog_get_name (GtkAboutDialog *about
);
gtk_about_dialog_get_name
has been deprecated since version 2.12 and should not be used in newly-written code.
Use gtk_about_dialog_get_program_name()
instead.
Returns the program name displayed in the about dialog.
Since: 2.6
void gtk_about_dialog_set_name (GtkAboutDialog *about
,const gchar *name
);
gtk_about_dialog_set_name
has been deprecated since version 2.12 and should not be used in newly-written code.
Use gtk_about_dialog_set_program_name()
instead.
Sets the name to display in the about dialog.
If this is not set, it defaults to g_get_application_name()
.
Since: 2.6
const gchar *
gtk_about_dialog_get_program_name (GtkAboutDialog *about
);
Returns the program name displayed in the about dialog.
Since: 2.12
void gtk_about_dialog_set_program_name (GtkAboutDialog *about
,const gchar *name
);
Sets the name to display in the about dialog.
If this is not set, it defaults to g_get_application_name()
.
Since: 2.12
const gchar *
gtk_about_dialog_get_version (GtkAboutDialog *about
);
Returns the version string.
Since: 2.6
void gtk_about_dialog_set_version (GtkAboutDialog *about
,const gchar *version
);
Sets the version string to display in the about dialog.
Since: 2.6
const gchar *
gtk_about_dialog_get_copyright (GtkAboutDialog *about
);
Returns the copyright string.
Since: 2.6
void gtk_about_dialog_set_copyright (GtkAboutDialog *about
,const gchar *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
const gchar *
gtk_about_dialog_get_comments (GtkAboutDialog *about
);
Returns the comments string.
Since: 2.6
void gtk_about_dialog_set_comments (GtkAboutDialog *about
,const gchar *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
const gchar *
gtk_about_dialog_get_license (GtkAboutDialog *about
);
Returns the license information.
Since: 2.6
void gtk_about_dialog_set_license (GtkAboutDialog *about
,const gchar *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
gboolean
gtk_about_dialog_get_wrap_license (GtkAboutDialog *about
);
Returns whether the license text in about
is
automatically wrapped.
Since: 2.8
void gtk_about_dialog_set_wrap_license (GtkAboutDialog *about
,gboolean wrap_license
);
Sets whether the license text in about
is
automatically wrapped.
Since: 2.8
const gchar *
gtk_about_dialog_get_website (GtkAboutDialog *about
);
Returns the website URL.
Since: 2.6
void gtk_about_dialog_set_website (GtkAboutDialog *about
,const gchar *website
);
Sets the URL to use for the website link.
Note that that the hook functions need to be set up before calling this function.
Since: 2.6
const gchar *
gtk_about_dialog_get_website_label (GtkAboutDialog *about
);
Returns the label used for the website link.
The label used for the website link. The string is owned by the about dialog and must not be modified.
Since: 2.6
void gtk_about_dialog_set_website_label (GtkAboutDialog *about
,const gchar *website_label
);
Sets the label to be used for the website link. It defaults to the website URL.
Since: 2.6
const gchar * const *
gtk_about_dialog_get_authors (GtkAboutDialog *about
);
Returns the string which are displayed in the authors tab of the secondary credits dialog.
A
NULL
-terminated string array containing the authors. The array is
owned by the about dialog and must not be modified.
[array zero-terminated=1][transfer none]
Since: 2.6
void gtk_about_dialog_set_authors (GtkAboutDialog *about
,const gchar **authors
);
Sets the strings which are displayed in the authors tab of the secondary credits dialog.
Since: 2.6
const gchar * const *
gtk_about_dialog_get_artists (GtkAboutDialog *about
);
Returns the string which are displayed in the artists tab of the secondary credits dialog.
A
NULL
-terminated string array containing the artists. The array is
owned by the about dialog and must not be modified.
[array zero-terminated=1][transfer none]
Since: 2.6
void gtk_about_dialog_set_artists (GtkAboutDialog *about
,const gchar **artists
);
Sets the strings which are displayed in the artists tab of the secondary credits dialog.
Since: 2.6
const gchar * const *
gtk_about_dialog_get_documenters (GtkAboutDialog *about
);
Returns the string which are displayed in the documenters tab of the secondary credits dialog.
A
NULL
-terminated string array containing the documenters. The
array is owned by the about dialog and must not be modified.
[array zero-terminated=1][transfer none]
Since: 2.6
void gtk_about_dialog_set_documenters (GtkAboutDialog *about
,const gchar **documenters
);
Sets the strings which are displayed in the documenters tab of the secondary credits dialog.
Since: 2.6
const gchar *
gtk_about_dialog_get_translator_credits
(GtkAboutDialog *about
);
Returns the translator credits string which is displayed in the translators tab of the secondary credits dialog.
The translator credits string. The string is owned by the about dialog and must not be modified.
Since: 2.6
void gtk_about_dialog_set_translator_credits (GtkAboutDialog *about
,const gchar *translator_credits
);
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:
1 |
gtk_about_dialog_set_translator_credits (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 hide the tab.
Since: 2.6
GdkPixbuf *
gtk_about_dialog_get_logo (GtkAboutDialog *about
);
Returns the pixbuf displayed as logo in the about dialog.
the pixbuf displayed as logo. The
pixbuf is owned by the about dialog. If you want to keep a
reference to it, you have to call g_object_ref()
on it.
[transfer none]
Since: 2.6
void gtk_about_dialog_set_logo (GtkAboutDialog *about
,GdkPixbuf *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_set_default_icon()
will be used.
Since: 2.6
const gchar *
gtk_about_dialog_get_logo_icon_name (GtkAboutDialog *about
);
Returns the icon name displayed as logo in the about dialog.
the icon name displayed as logo. The string is
owned by the dialog. If you want to keep a reference
to it, you have to call g_strdup()
on it.
Since: 2.6
void gtk_about_dialog_set_logo_icon_name (GtkAboutDialog *about
,const gchar *icon_name
);
Sets the pixbuf to be displayed as logo in the about dialog.
If it is NULL
, the default window icon set with
gtk_window_set_default_icon()
will be used.
Since: 2.6
void (*GtkAboutDialogActivateLinkFunc) (GtkAboutDialog *about
,const gchar *link_
,gpointer data
);
The type of a function which is called when a URL or email link is activated.
about |
the GtkAboutDialog in which the link was activated |
|
link_ |
the URL or email address to which the activated link points |
|
data |
user data that was passed when the function was registered
with |
GtkAboutDialogActivateLinkFunc gtk_about_dialog_set_email_hook (GtkAboutDialogActivateLinkFunc func
,gpointer data
,GDestroyNotify destroy
);
gtk_about_dialog_set_email_hook
has been deprecated since version 2.24 and should not be used in newly-written code.
Use the “activate-link” signal
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_show_uri()
. To
deactivate it, you can pass NULL
for func
.
func |
a function to call when an email link is activated. |
|
data |
data to pass to |
|
destroy |
GDestroyNotify for |
Since: 2.6
GtkAboutDialogActivateLinkFunc gtk_about_dialog_set_url_hook (GtkAboutDialogActivateLinkFunc func
,gpointer data
,GDestroyNotify destroy
);
gtk_about_dialog_set_url_hook
has been deprecated since version 2.24 and should not be used in newly-written code.
Use the “activate-link” signal
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_show_uri()
. To
deactivate it, you can pass NULL
for func
.
func |
a function to call when a URL link is activated. |
|
data |
data to pass to |
|
destroy |
GDestroyNotify for |
Since: 2.6
void gtk_show_about_dialog (GtkWindow *parent
,const gchar *first_property_name
,...
);
This is a convenience function for showing an application's about box. The constructed dialog is associated with the parent window and reused for future invocations of this function.
parent |
transient parent, or |
[allow-none] |
first_property_name |
the name of the first property |
|
Varargs |
value of first property, followed by more properties, |
Since: 2.6
“artists”
property “artists” GStrv
The people who contributed artwork to the program, as a NULL
-terminated
array of strings. Each string may contain email addresses and URLs, which
will be displayed as links, see the introduction for more details.
Owner: GtkAboutDialog
Flags: Read / Write
Since: 2.6
“authors”
property “authors” GStrv
The authors of the program, as a NULL
-terminated array of strings.
Each string may contain email addresses and URLs, which will be displayed
as links, see the introduction for more details.
Owner: GtkAboutDialog
Flags: Read / Write
Since: 2.6
“comments”
property “comments” char *
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.
Owner: GtkAboutDialog
Flags: Read / Write
Default value: NULL
Since: 2.6
“copyright”
property “copyright” char *
Copyright information for the program.
Owner: GtkAboutDialog
Flags: Read / Write
Default value: NULL
Since: 2.6
“documenters”
property “documenters” GStrv
The people documenting the program, as a NULL
-terminated array of strings.
Each string may contain email addresses and URLs, which will be displayed
as links, see the introduction for more details.
Owner: GtkAboutDialog
Flags: Read / Write
Since: 2.6
“license”
property “license” char *
The license of the program. 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.
Owner: GtkAboutDialog
Flags: Read / Write
Default value: NULL
Since: 2.6
“logo”
property“logo” GdkPixbuf *
A logo for the about box. If this is not set, it defaults to
gtk_window_get_default_icon_list()
.
Owner: GtkAboutDialog
Flags: Read / Write
Since: 2.6
“logo-icon-name”
property “logo-icon-name” char *
A named icon to use as the logo for the about box. This property overrides the “logo” property.
Owner: GtkAboutDialog
Flags: Read / Write
Default value: NULL
Since: 2.6
“program-name”
property “program-name” char *
The name of the program.
If this is not set, it defaults to g_get_application_name()
.
Owner: GtkAboutDialog
Flags: Read / Write
Default value: NULL
Since: 2.12
“translator-credits”
property “translator-credits” char *
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.
Owner: GtkAboutDialog
Flags: Read / Write
Default value: NULL
Since: 2.6
“version”
property “version” char *
The version of the program.
Owner: GtkAboutDialog
Flags: Read / Write
Default value: NULL
Since: 2.6
“website”
property “website” char *
The URL for the link to the website of the program. This should be a string starting with "http://.
Owner: GtkAboutDialog
Flags: Read / Write
Default value: NULL
Since: 2.6
“website-label”
property “website-label” char *
The label for the link to the website of the program. If this is not set, it defaults to the URL specified in the “website” property.
Owner: GtkAboutDialog
Flags: Read / Write
Default value: NULL
Since: 2.6
“wrap-license”
property “wrap-license” gboolean
Whether to wrap the text in the license dialog.
Owner: GtkAboutDialog
Flags: Read / Write
Default value: FALSE
Since: 2.8
“activate-link”
signalgboolean user_function (GtkAboutDialog *label, char *uri, gpointer user_data)
The signal which gets emitted to activate a URI.
Applications may connect to it to override the default behaviour,
which is to call gtk_show_uri()
.
label |
The object on which the signal was emitted |
|
uri |
the URI that is activated |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
Since: 2.24