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 dialogs often contain links and email addresses. GtkAboutDialog displays these as clickable links. By default, it calls gtk_show_uri_on_window when a user clicks one. The behaviour can be overridden with the Gtk.About_Dialog.Gtk_About_Dialog::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 http://www.gtk.org".
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:
GdkPixbuf *example_logo = gdk_pixbuf_new_from_file ("./logo.png", NULL);
gtk_show_about_dialog (NULL,
"program-name", "ExampleCode",
"logo", example_logo,
"title", _("About ExampleCode"),
NULL);
It is also possible to show a Gtk.About_Dialog.Gtk_About_Dialog like any other Gtk.Dialog.Gtk_Dialog, e.g. using Gtk.Dialog.Run. In this case, you might need to know that the "Close" button returns the GTK_RESPONSE_CANCEL response id.
<group>Windows</group> <testgtk>create_about.adb</testgtk>
function "+"
(Widget : access Gtk_About_Dialog_Record'Class)
return Gtk.Buildable.Gtk_Buildable
function "-"
(Interf : Gtk.Buildable.Gtk_Buildable)
return Gtk_About_Dialog
procedure Add_Credit_Section
(About : not null access Gtk_About_Dialog_Record;
Section_Name : UTF8_String;
People : GNAT.Strings.String_List)
Creates a new section in the Credits page. Since: gtk+ 3.4
The name of the section
The people who belong to that section
Artists_Property : constant Glib.Properties.Property_String :=
Glib.Properties.Build ("artists");
Unknown type: unspecified
Authors_Property : constant Glib.Properties.Property_String :=
Glib.Properties.Build ("authors");
Unknown type: unspecified
type Cb_GObject_UTF8_String_Boolean is not null access function
(Self : access Glib.Object.GObject_Record'Class;
URI : UTF8_String) return Boolean;
type Cb_Gtk_About_Dialog_UTF8_String_Boolean is not null access function
(Self : access Gtk_About_Dialog_Record'Class;
URI : UTF8_String) return Boolean;
Comments_Property : constant Glib.Properties.Property_String;
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.
Copyright_Property : constant Glib.Properties.Property_String;
Copyright information for the program.
Documenters_Property : constant Glib.Properties.Property_String :=
Glib.Properties.Build ("documenters");
Unknown type: unspecified
function Get_Artists
(About : not null access Gtk_About_Dialog_Record)
return GNAT.Strings.String_List
Returns the string which are displayed in the artists tab of the secondary credits dialog. Since: gtk+ 2.6
A null-terminated string array containing the artists. The array is owned by the about dialog and must not be modified.
function Get_Authors
(About : not null access Gtk_About_Dialog_Record)
return GNAT.Strings.String_List
Returns the string which are displayed in the authors tab of the secondary credits dialog. Since: gtk+ 2.6
A null-terminated string array containing the authors. The array is owned by the about dialog and must not be modified.
function Get_Comments
(About : not null access Gtk_About_Dialog_Record) return UTF8_String
Returns the comments string. Since: gtk+ 2.6
The comments. The string is owned by the about dialog and must not be modified.
function Get_Copyright
(About : not null access Gtk_About_Dialog_Record) return UTF8_String
Returns the copyright string. Since: gtk+ 2.6
The copyright string. The string is owned by the about dialog and must not be modified.
function Get_Documenters
(About : not null access Gtk_About_Dialog_Record)
return GNAT.Strings.String_List
Returns the string which are displayed in the documenters tab of the secondary credits dialog. Since: gtk+ 2.6
A null-terminated string array containing the documenters. The array is owned by the about dialog and must not be modified.
function Get_License
(About : not null access Gtk_About_Dialog_Record) return UTF8_String
Returns the license information. Since: gtk+ 2.6
The license information. The string is owned by the about dialog and must not be modified.
function Get_License_Type
(About : not null access Gtk_About_Dialog_Record) return Gtk_License
Retrieves the license set using Gtk.About_Dialog.Set_License_Type Since: gtk+ 3.0
a Gtk.About_Dialog.Gtk_License value
function Get_Logo
(About : not null access Gtk_About_Dialog_Record)
return Gdk.Pixbuf.Gdk_Pixbuf
Returns the pixbuf displayed as logo in the about dialog. Since: gtk+ 2.6
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.
function Get_Logo_Icon_Name
(About : not null access Gtk_About_Dialog_Record) return UTF8_String
Returns the icon name displayed as logo in the about dialog. Since: gtk+ 2.6
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.
function Get_Program_Name
(About : not null access Gtk_About_Dialog_Record) return UTF8_String
Returns the program name displayed in the about dialog. Since: gtk+ 2.12
The program name. The string is owned by the about dialog and must not be modified.
function Get_Translator_Credits
(About : not null access Gtk_About_Dialog_Record) return UTF8_String
Returns the translator credits string which is displayed in the translators tab of the secondary credits dialog. Since: gtk+ 2.6
The translator credits string. The string is owned by the about dialog and must not be modified.
function Get_Type return Glib.GType
function Get_Version
(About : not null access Gtk_About_Dialog_Record) return UTF8_String
Returns the version string. Since: gtk+ 2.6
The version string. The string is owned by the about dialog and must not be modified.
function Get_Website
(About : not null access Gtk_About_Dialog_Record) return UTF8_String
Returns the website URL. Since: gtk+ 2.6
The website URL. The string is owned by the about dialog and must not be modified.
function Get_Website_Label
(About : not null access Gtk_About_Dialog_Record) return UTF8_String
Returns the label used for the website link. Since: gtk+ 2.6
The label used for the website link. The string is owned by the about dialog and must not be modified.
function Get_Wrap_License
(About : not null access Gtk_About_Dialog_Record) return Boolean
Returns whether the license text in About is automatically wrapped. Since: gtk+ 2.8
True if the license text is wrapped
type Gtk_About_Dialog is access all Gtk_About_Dialog_Record'Class;
function Gtk_About_Dialog_New return Gtk_About_Dialog
Creates a new Gtk.About_Dialog.Gtk_About_Dialog. Since: gtk+ 2.6
type Gtk_About_Dialog_Record is new Gtk_Dialog_Record with null record;
type Gtk_License is (
License_Unknown,
License_Custom,
License_Gpl_2_0,
License_Gpl_3_0,
License_Lgpl_2_1,
License_Lgpl_3_0,
License_Bsd,
License_Mit_X11,
…,
License_Mpl_2_0);
The type of license for an application.
This enumeration can be expanded at later date.
package Gtk_License_Properties is
new Generic_Internal_Discrete_Property (Gtk_License);
procedure Gtk_New (About : out Gtk_About_Dialog)
Creates a new Gtk.About_Dialog.Gtk_About_Dialog. Since: gtk+ 2.6 Initialize does nothing if the object was already created with another call to Initialize* or G_New.
package Implements_Gtk_Buildable is new Glib.Types.Implements
(Gtk.Buildable.Gtk_Buildable, Gtk_About_Dialog_Record, Gtk_About_Dialog);
procedure Initialize
(About : not null access Gtk_About_Dialog_Record'Class)
Creates a new Gtk.About_Dialog.Gtk_About_Dialog. Since: gtk+ 2.6 Initialize does nothing if the object was already created with another call to Initialize* or G_New.
License_Property : constant Glib.Properties.Property_String;
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 Gtk.About_Dialog.Gtk_About_Dialog:license-type property is set to Gtk.About_Dialog.License_Custom as a side effect.
License_Type_Property : constant Gtk.About_Dialog.Property_Gtk_License;
Type: Gtk_License The license of the program, as a value of the GtkLicense enumeration.
The Gtk.About_Dialog.Gtk_About_Dialog will automatically fill out a standard disclaimer and link the user to the appropriate online resource for the license text.
If Gtk.About_Dialog.License_Unknown is used, the link used will be the same specified in the Gtk.About_Dialog.Gtk_About_Dialog:website property.
If Gtk.About_Dialog.License_Custom is used, the current contents of the Gtk.About_Dialog.Gtk_About_Dialog:license property are used.
For any other Gtk.About_Dialog.Gtk_License value, the contents of the Gtk.About_Dialog.Gtk_About_Dialog:license property are also set by this property as a side effect.
Logo_Icon_Name_Property : constant Glib.Properties.Property_String;
A named icon to use as the logo for the about box. This property overrides the Gtk.About_Dialog.Gtk_About_Dialog:logo property.
Logo_Property : constant Glib.Properties.Property_Object;
Type: Gdk.Pixbuf.Gdk_Pixbuf A logo for the about box. If it is null, the default window icon set with Gtk.Window.Set_Default_Icon will be used.
procedure On_Activate_Link
(Self : not null access Gtk_About_Dialog_Record;
Call : Cb_GObject_UTF8_String_Boolean;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
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_on_window.
Callback parameters: -- @param URI the URI that is activated
procedure On_Activate_Link
(Self : not null access Gtk_About_Dialog_Record;
Call : Cb_Gtk_About_Dialog_UTF8_String_Boolean;
After : Boolean := False)
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_on_window.
Callback parameters: -- @param URI the URI that is activated
Program_Name_Property : constant Glib.Properties.Property_String;
The name of the program. If this is not set, it defaults to g_get_application_name.
type Property_Gtk_License is new Gtk_License_Properties.Property;
procedure Set_Artists
(About : not null access Gtk_About_Dialog_Record;
Artists : GNAT.Strings.String_List)
Sets the strings which are displayed in the artists tab of the secondary credits dialog. Since: gtk+ 2.6
a null-terminated array of strings
procedure Set_Authors
(About : not null access Gtk_About_Dialog_Record;
Authors : GNAT.Strings.String_List)
Sets the strings which are displayed in the authors tab of the secondary credits dialog. Since: gtk+ 2.6
a null-terminated array of strings
procedure Set_Comments
(About : not null access Gtk_About_Dialog_Record;
Comments : UTF8_String := "")
Sets the comments string to display in the about dialog. This should be a short string of one or two lines. Since: gtk+ 2.6
a comments string
procedure Set_Copyright
(About : not null access Gtk_About_Dialog_Record;
Copyright : UTF8_String := "")
Sets the copyright string to display in the about dialog. This should be a short string of one or two lines. Since: gtk+ 2.6
the copyright string
procedure Set_Documenters
(About : not null access Gtk_About_Dialog_Record;
Documenters : GNAT.Strings.String_List)
Sets the strings which are displayed in the documenters tab of the secondary credits dialog. Since: gtk+ 2.6
a null-terminated array of strings
procedure Set_License
(About : not null access Gtk_About_Dialog_Record;
License : UTF8_String := "")
Sets the license information to be displayed in the secondary license dialog. If License is null, the license button is hidden. Since: gtk+ 2.6
the license information or null
procedure Set_License_Type
(About : not null access Gtk_About_Dialog_Record;
License_Type : Gtk_License)
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. Since: gtk+ 3.0
the type of license
procedure Set_Logo
(About : not null access Gtk_About_Dialog_Record;
Logo : access Gdk.Pixbuf.Gdk_Pixbuf_Record'Class)
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: gtk+ 2.6
a Gdk.Pixbuf.Gdk_Pixbuf, or null
procedure Set_Logo_Icon_Name
(About : not null access Gtk_About_Dialog_Record;
Icon_Name : UTF8_String := "")
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: gtk+ 2.6
an icon name, or null
procedure Set_Program_Name
(About : not null access Gtk_About_Dialog_Record;
Name : UTF8_String)
Sets the name to display in the about dialog. If this is not set, it defaults to g_get_application_name. Since: gtk+ 2.12
the program name
procedure Set_Translator_Credits
(About : not null access Gtk_About_Dialog_Record;
Translator_Credits : UTF8_String := "")
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:
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 Gtk.About_Dialog.Gtk_About_Dialog will detect if "translator-credits" is untranslated and hide the tab. Since: gtk+ 2.6
the translator credits
procedure Set_Version
(About : not null access Gtk_About_Dialog_Record;
Version : UTF8_String := "")
Sets the version string to display in the about dialog. Since: gtk+ 2.6
the version string
procedure Set_Website
(About : not null access Gtk_About_Dialog_Record;
Website : UTF8_String := "")
Sets the URL to use for the website link. Since: gtk+ 2.6
a URL string starting with "http://"
procedure Set_Website_Label
(About : not null access Gtk_About_Dialog_Record;
Website_Label : UTF8_String)
Sets the label to be used for the website link. Since: gtk+ 2.6
the label used for the website link
procedure Set_Wrap_License
(About : not null access Gtk_About_Dialog_Record;
Wrap_License : Boolean)
Sets whether the license text in About is automatically wrapped. Since: gtk+ 2.8
whether to wrap the license
Signal_Activate_Link : constant Glib.Signal_Name := "activate-link";
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_on_window.
Callback parameters: -- @param URI the URI that is activated
Translator_Credits_Property : constant Glib.Properties.Property_String;
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.
Version_Property : constant Glib.Properties.Property_String;
The version of the program.
Website_Label_Property : constant Glib.Properties.Property_String;
The label for the link to the website of the program.
Website_Property : constant Glib.Properties.Property_String;
The URL for the link to the website of the program. This should be a string starting with "http://.
Wrap_License_Property : constant Glib.Properties.Property_Boolean;
Whether to wrap the text in the license dialog.