AboutDialog


Object Hierarchy:

Gtk.AboutDialog Gtk.AboutDialog Gtk.AboutDialog Gtk.Dialog Gtk.Dialog Gtk.Dialog->Gtk.AboutDialog Gtk.Window Gtk.Window Gtk.Window->Gtk.Dialog Gtk.Bin Gtk.Bin Gtk.Bin->Gtk.Window Gtk.Container Gtk.Container Gtk.Container->Gtk.Bin Gtk.Widget Gtk.Widget Gtk.Widget->Gtk.Container GLib.InitiallyUnowned GLib.InitiallyUnowned GLib.InitiallyUnowned->Gtk.Widget GLib.Object GLib.Object GLib.Object->GLib.InitiallyUnowned Atk.Implementor Atk.Implementor Atk.Implementor->Gtk.AboutDialog Atk.Implementor->Gtk.Dialog Atk.Implementor->Gtk.Window Atk.Implementor->Gtk.Bin Atk.Implementor->Gtk.Container Atk.Implementor->Gtk.Widget Gtk.Buildable Gtk.Buildable Gtk.Buildable->Gtk.AboutDialog Gtk.Buildable->Gtk.Dialog Gtk.Buildable->Gtk.Window Gtk.Buildable->Gtk.Bin Gtk.Buildable->Gtk.Container Gtk.Buildable->Gtk.Widget

Description:

[ CCode ( type_id = "gtk_about_dialog_get_type ()" ) ]
public class AboutDialog : Dialog, Implementor, Buildable

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 show_uri_on_window when a user clicks one. The behaviour can be overridden with the 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 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 AboutDialog like any other Dialog , e.g. using run. In this case, you might need to know that the “Close” button returns the CANCEL response id.

GtkAboutDialog

Example: AboutDialog:

public static int main (string[] args) {
Gtk.init (ref args);

// Create a window:
Gtk.Window window = new Gtk.Window ();
window.destroy.connect (Gtk.main_quit);
window.set_default_size (500, 500);
window.show_all ();

// Configure the dialog:
Gtk.AboutDialog dialog = new Gtk.AboutDialog ();
dialog.set_destroy_with_parent (true);
dialog.set_transient_for (window);
dialog.set_modal (true);

dialog.artists = {"Darkwing Duck", "Launchpad McQuack"};
dialog.authors = {"Scrooge McDuck", "Gyro Gearloose"};
dialog.documenters = null; // Real inventors don't document.
dialog.translator_credits = null; // We only need a scottish version.

dialog.program_name = "SWMS";
dialog.comments = "Scrooges wealth management system";
dialog.copyright = "Copyright © 1998-2000 Gyro Gearloose";
dialog.version = "3.0";

dialog.license = "Permission is hereby granted, NOT free of charge, ..., very long text";
dialog.wrap_license = true;

dialog.website = "http://en.wikipedia.org/wiki/Scrooge_McDuck";
dialog.website_label = "Scrooge McDuck and Co.";

dialog.response.connect ((response_id) => {
if (response_id == Gtk.ResponseType.CANCEL || response_id == Gtk.ResponseType.DELETE_EVENT) {
dialog.hide_on_delete ();
}
});

// Show the dialog:
dialog.present ();
Gtk.main ();
return 0;
}

valac --pkg gtk+-3.0 Gtk.AboutDialog.vala

Example: AboutDialog (convenience function):

public static int main (string[] args) {
Gtk.init (ref args);

Gtk.Window window = new Gtk.Window ();
window.destroy.connect (Gtk.main_quit);
window.set_default_size (500, 500);
window.show_all ();

string[] authors = {"Scrooge McDuck", "Gyro Gearloose"};

// Use property names as keys
Gtk.show_about_dialog (window,
program_name: "SWMS",
copyright: "Copyright © 1998-2000 Gyro Gearloose",
authors: authors,
website: "http://en.wikipedia.org/wiki/Scrooge_McDuck",
website_label: "Scrooge McDuck and Co.");

window.show_all ();
Gtk.main ();
return 0;
}

valac --pkg gtk+-3.0 Gtk.show_about_dialog.vala


Namespace: Gtk
Package: gtk+-3.0

Content:

Properties:

Creation methods:

Methods:

Signals:

Inherited Members:

All known members inherited from class Gtk.Window
All known members inherited from class Gtk.Bin
All known members inherited from class Gtk.Widget
All known members inherited from interface Atk.Implementor