GTK+ 3 Reference Manual | ||||
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces | Properties | Signals |
#include <gtk/gtk.h> struct GtkAboutDialog; enum GtkLicense; GtkWidget * gtk_about_dialog_new (void
); const gchar * gtk_about_dialog_get_program_name (GtkAboutDialog *about
); void gtk_about_dialog_set_program_name (GtkAboutDialog *about
,const gchar *name
); const gchar * gtk_about_dialog_get_version (GtkAboutDialog *about
); void gtk_about_dialog_set_version (GtkAboutDialog *about
,const gchar *version
); const gchar * gtk_about_dialog_get_copyright (GtkAboutDialog *about
); void gtk_about_dialog_set_copyright (GtkAboutDialog *about
,const gchar *copyright
); const gchar * gtk_about_dialog_get_comments (GtkAboutDialog *about
); void gtk_about_dialog_set_comments (GtkAboutDialog *about
,const gchar *comments
); const gchar * gtk_about_dialog_get_license (GtkAboutDialog *about
); void gtk_about_dialog_set_license (GtkAboutDialog *about
,const gchar *license
); gboolean gtk_about_dialog_get_wrap_license (GtkAboutDialog *about
); void gtk_about_dialog_set_wrap_license (GtkAboutDialog *about
,gboolean wrap_license
); GtkLicense gtk_about_dialog_get_license_type (GtkAboutDialog *about
); void gtk_about_dialog_set_license_type (GtkAboutDialog *about
,GtkLicense license_type
); const gchar * gtk_about_dialog_get_website (GtkAboutDialog *about
); void gtk_about_dialog_set_website (GtkAboutDialog *about
,const gchar *website
); const gchar * gtk_about_dialog_get_website_label (GtkAboutDialog *about
); void gtk_about_dialog_set_website_label (GtkAboutDialog *about
,const gchar *website_label
); const gchar * const * gtk_about_dialog_get_authors (GtkAboutDialog *about
); void gtk_about_dialog_set_authors (GtkAboutDialog *about
,const gchar **authors
); const gchar * const * gtk_about_dialog_get_artists (GtkAboutDialog *about
); void gtk_about_dialog_set_artists (GtkAboutDialog *about
,const gchar **artists
); const gchar * const * gtk_about_dialog_get_documenters (GtkAboutDialog *about
); void gtk_about_dialog_set_documenters (GtkAboutDialog *about
,const gchar **documenters
); const gchar * gtk_about_dialog_get_translator_credits (GtkAboutDialog *about
); void gtk_about_dialog_set_translator_credits (GtkAboutDialog *about
,const gchar *translator_credits
); GdkPixbuf * gtk_about_dialog_get_logo (GtkAboutDialog *about
); void gtk_about_dialog_set_logo (GtkAboutDialog *about
,GdkPixbuf *logo
); const gchar * gtk_about_dialog_get_logo_icon_name (GtkAboutDialog *about
); void gtk_about_dialog_set_logo_icon_name (GtkAboutDialog *about
,const gchar *icon_name
); void gtk_show_about_dialog (GtkWindow *parent
,const gchar *first_property_name
,...
);
GObject +----GInitiallyUnowned +----GtkWidget +----GtkContainer +----GtkBin +----GtkWindow +----GtkDialog +----GtkAboutDialog
"artists" GStrv : Read / Write "authors" GStrv : Read / Write "comments" gchar* : Read / Write "copyright" gchar* : Read / Write "documenters" GStrv : Read / Write "license" gchar* : Read / Write "license-type" GtkLicense : Read / Write "logo" GdkPixbuf* : Read / Write "logo-icon-name" gchar* : Read / Write "program-name" gchar* : Read / Write "translator-credits" gchar* : Read / Write "version" gchar* : Read / Write "website" gchar* : Read / Write "website-label" gchar* : Read / Write "wrap-license" gboolean : Read / Write
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
displays these as clickable links. By default, it calls gtk_show_uri()
when a user clicks one. The behaviour can be overridden with the
"activate-link" signal.
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); |
struct GtkAboutDialog;
The GtkAboutDialog struct contains only private fields and should not be directly accessed.
typedef enum { GTK_LICENSE_UNKNOWN, GTK_LICENSE_CUSTOM, GTK_LICENSE_GPL_2_0, GTK_LICENSE_GPL_3_0, GTK_LICENSE_LGPL_2_1, GTK_LICENSE_LGPL_3_0, GTK_LICENSE_BSD, GTK_LICENSE_MIT_X11, GTK_LICENSE_ARTISTIC } GtkLicense;
The type of license for an application.
This enumeration can be expanded at later date.
No license specified | |
A license text is going to be specified by the developer | |
The GNU General Public License, version 2.0 | |
The GNU General Public License, version 3.0 | |
The GNU Lesser General Public License, version 2.1 | |
The GNU Lesser General Public License, version 3.0 | |
The BSD standard license | |
The MIT/X11 standard license | |
The Artistic License, version 2.0 |
Since 3.0
GtkWidget * gtk_about_dialog_new (void
);
Creates a new GtkAboutDialog.
Returns : |
a newly created GtkAboutDialog |
Since 2.6
const gchar * gtk_about_dialog_get_program_name (GtkAboutDialog *about
);
Returns the program name displayed in the about dialog.
|
a GtkAboutDialog |
Returns : |
The program name. The string is owned by the about dialog and must not be modified. |
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()
.
|
a GtkAboutDialog |
|
the program name |
Since 2.12
const gchar * gtk_about_dialog_get_version (GtkAboutDialog *about
);
Returns the version string.
|
a GtkAboutDialog |
Returns : |
The version string. The string is owned by the about dialog and must not be modified. |
Since 2.6
void gtk_about_dialog_set_version (GtkAboutDialog *about
,const gchar *version
);
Sets the version string to display in the about dialog.
|
a GtkAboutDialog |
|
the version string. [allow-none] |
Since 2.6
const gchar * gtk_about_dialog_get_copyright (GtkAboutDialog *about
);
Returns the copyright string.
|
a GtkAboutDialog |
Returns : |
The copyright string. The string is owned by the about dialog and must not be modified. |
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.
|
a GtkAboutDialog |
|
(allow-none) the copyright string |
Since 2.6
const gchar * gtk_about_dialog_get_comments (GtkAboutDialog *about
);
Returns the comments string.
|
a GtkAboutDialog |
Returns : |
The comments. The string is owned by the about dialog and must not be modified. |
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.
|
a GtkAboutDialog |
|
a comments string. [allow-none] |
Since 2.6
const gchar * gtk_about_dialog_get_license (GtkAboutDialog *about
);
Returns the license information.
|
a GtkAboutDialog |
Returns : |
The license information. The string is owned by the about dialog and must not be modified. |
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.
|
a GtkAboutDialog |
|
the license information or NULL . [allow-none]
|
Since 2.6
gboolean gtk_about_dialog_get_wrap_license (GtkAboutDialog *about
);
Returns whether the license text in about
is
automatically wrapped.
|
a GtkAboutDialog |
Returns : |
TRUE if the license text is 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.
|
a GtkAboutDialog |
|
whether to wrap the license |
Since 2.8
GtkLicense gtk_about_dialog_get_license_type (GtkAboutDialog *about
);
Retrieves the license set using gtk_about_dialog_set_license_type()
|
a GtkAboutDialog |
Returns : |
a GtkLicense value |
Since 3.0
void gtk_about_dialog_set_license_type (GtkAboutDialog *about
,GtkLicense 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
gtk_about_dialog_set_license()
.
|
a GtkAboutDialog |
|
the type of license |
Since 3.0
const gchar * gtk_about_dialog_get_website (GtkAboutDialog *about
);
Returns the website URL.
|
a GtkAboutDialog |
Returns : |
The website URL. The string is owned by the about dialog and must not be modified. |
Since 2.6
void gtk_about_dialog_set_website (GtkAboutDialog *about
,const gchar *website
);
Sets the URL to use for the website link.
|
a GtkAboutDialog |
|
a URL string starting with "http://". [allow-none] |
Since 2.6
const gchar * gtk_about_dialog_get_website_label (GtkAboutDialog *about
);
Returns the label used for the website link.
|
a GtkAboutDialog |
Returns : |
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.
|
a GtkAboutDialog |
|
the label used for the website link |
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 GtkAboutDialog |
Returns : |
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.
|
a GtkAboutDialog |
|
a NULL -terminated array of strings. [array zero-terminated=1]
|
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 GtkAboutDialog |
Returns : |
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.
|
a GtkAboutDialog |
|
a NULL -terminated array of strings. [array zero-terminated=1]
|
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 GtkAboutDialog |
Returns : |
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.
|
a GtkAboutDialog |
|
a NULL -terminated array of strings. [array zero-terminated=1]
|
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.
|
a GtkAboutDialog |
Returns : |
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.
|
a GtkAboutDialog |
|
the translator credits. [allow-none] |
Since 2.6
GdkPixbuf * gtk_about_dialog_get_logo (GtkAboutDialog *about
);
Returns the pixbuf displayed as logo in the about dialog.
|
a GtkAboutDialog |
Returns : |
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.
|
a GtkAboutDialog |
|
a GdkPixbuf, or NULL . [allow-none]
|
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.
|
a GtkAboutDialog |
Returns : |
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.
|
a GtkAboutDialog |
|
an icon name, or NULL . [allow-none]
|
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.
|
transient parent, or NULL for none. [allow-none]
|
|
the name of the first property |
|
value of first property, followed by more properties, NULL -terminated |
Since 2.6
"artists"
property"artists" GStrv : Read / Write
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.
Since 2.6
"authors"
property"authors" GStrv : Read / Write
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.
Since 2.6
"comments"
property"comments" gchar* : Read / Write
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.
Default value: NULL
Since 2.6
"copyright"
property"copyright" gchar* : Read / Write
Copyright information for the program.
Default value: NULL
Since 2.6
"documenters"
property"documenters" GStrv : Read / Write
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.
Since 2.6
"license"
property"license" gchar* : Read / Write
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.
When setting this property to a non-NULL
value, the
"license-type" property is set to GTK_LICENSE_CUSTOM
as a side effect.
Default value: NULL
Since 2.6
"license-type"
property"license-type" GtkLicense : Read / Write
The license of the program, as a value of the GtkLicense
enumeration.
The GtkAboutDialog will automatically fill out a standard disclaimer and link the user to the appropriate online resource for the license text.
If GTK_LICENSE_UNKNOWN
is used, the link used will be the same
specified in the "website" property.
If GTK_LICENSE_CUSTOM
is used, the current contents of the
"license" property are used.
For any other GtkLicense value, the contents of the "license" property are also set by this property as a side effect.
Default value: GTK_LICENSE_UNKNOWN
Since 3.0
"logo"
property"logo" GdkPixbuf* : Read / Write
A logo for the about box. If this is not set, it defaults to
gtk_window_get_default_icon_list()
.
Since 2.6
"logo-icon-name"
property"logo-icon-name" gchar* : Read / Write
A named icon to use as the logo for the about box. This property overrides the "logo" property.
Default value: NULL
Since 2.6
"program-name"
property"program-name" gchar* : Read / Write
The name of the program.
If this is not set, it defaults to g_get_application_name()
.
Default value: NULL
Since 2.12
"translator-credits"
property"translator-credits" gchar* : Read / Write
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.
Default value: NULL
Since 2.6
"version"
property"version" gchar* : Read / Write
The version of the program.
Default value: NULL
Since 2.6
"website"
property"website" gchar* : Read / Write
The URL for the link to the website of the program. This should be a string starting with "http://.
Default value: NULL
Since 2.6
"website-label"
property"website-label" gchar* : Read / Write
The label for the link to the website of the program.
Default value: NULL
Since 2.6
"wrap-license"
property"wrap-license" gboolean : Read / Write
Whether to wrap the text in the license dialog.
Default value: FALSE
Since 2.8
"activate-link"
signalgboolean user_function (GtkAboutDialog *label,
gchar *uri,
gpointer user_data) : Run Last
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()
.
|
The object on which the signal was emitted |
|
the URI that is activated |
|
user data set when the signal handler was connected. |
Returns : |
TRUE if the link has been activated |
Since 2.24