Struct gtk4::AboutDialog [−][src]
pub struct AboutDialog(_);
Expand description
The AboutDialog
offers a simple way to display information about
a program.
The shown information includes the programs’ 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. AboutDialog
displays these as clickable links. By default, it calls show_uri()
when a user clicks one. The behaviour can be overridden with the
signal::AboutDialog::activate-link
signal.
To specify a person with an email address, use a string like
Edgar Allan Poe <edgar
poe>
. To specify a website with a title,
use a string like GTK team https://www.gtk.org
.
To make constructing a AboutDialog
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 AboutDialog
,
as shown in the following example:
⚠️ The following code is in c ⚠️
GFile *logo_file = g_file_new_for_path ("./logo.png");
GdkTexture *example_logo = gdk_texture_new_from_file (logo_file, NULL);
g_object_unref (logo_file);
gtk_show_about_dialog (NULL,
"program-name", "ExampleCode",
"logo", example_logo,
"title", _("About ExampleCode"),
NULL);
CSS nodes
AboutDialog
has a single CSS node with the name window
and style
class .aboutdialog
.
Implements
GtkWindowExt
, WidgetExt
, glib::ObjectExt
, AccessibleExt
, BuildableExt
, ConstraintTargetExt
, NativeExt
, RootExt
, ShortcutManagerExt
, WidgetExtManual
, AccessibleExtManual
Implementations
Creates a new builder-pattern struct instance to construct AboutDialog
objects.
This method returns an instance of AboutDialogBuilder
which can be used to create AboutDialog
objects.
Creates a new section in the “Credits” page.
section_name
The name of the section
people
The people who belong to that section
Returns the names of the artists which are displayed in the credits page.
Returns
A
NULL
-terminated string array containing the artists
Returns the names of the authors which are displayed in the credits page.
Returns
A
NULL
-terminated string array containing the authors
Returns the name of the documenters which are displayed in the credits page.
Returns
A
NULL
-terminated string array containing the documenters
Returns the paintable displayed as logo in the about dialog.
Returns
the paintable displayed as
logo or NULL
if the logo is unset or has been set via
set_logo_icon_name()
Returns the icon name displayed as logo in the about dialog.
Returns
the icon name displayed as logo,
or NULL
if the logo has been set via set_logo()
Returns the translator credits string which is displayed in the credits page.
Returns
The translator credits string
Returns whether the license text in the about dialog is automatically wrapped.
Returns
TRUE
if the license text is wrapped
Sets the names of the artists to be displayed in the “Credits” page.
artists
the authors of the artwork of the application
Sets the names of the authors which are displayed in the “Credits” page of the about dialog.
authors
the authors of the application
Sets the comments string to display in the about dialog.
This should be a short string of one or two lines.
comments
a comments string
Sets the copyright string to display in the about dialog.
This should be a short string of one or two lines.
copyright
the copyright string
Sets the names of the documenters which are displayed in the “Credits” page.
documenters
the authors of the documentation of the application
Sets the license information to be displayed in the about dialog.
If license
is NULL
, the license page is hidden.
license
the license information
Sets the license of the application showing the about dialog from a list of known licenses.
This function overrides the license set using
set_license()
.
license_type
the type of license
Sets the name to display in the about dialog.
If name
is not set, the string returned
by g_get_application_name()
is used.
name
the program name
Sets the system information to be displayed in the about dialog.
If system_information
is NULL
, the system information
page is hidden.
See property::AboutDialog::system-information
.
system_information
system information
Sets the translator credits string which is displayed in the credits page.
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:
⚠️ The following code is in c ⚠️
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 AboutDialog
will detect if “translator-credits”
is untranslated and omit translator credits.
translator_credits
the translator credits
Sets whether the license text in the about dialog should be automatically wrapped.
wrap_license
whether to wrap the license
pub fn connect_activate_link<F: Fn(&Self, &str) -> Inhibit + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_activate_link<F: Fn(&Self, &str) -> Inhibit + 'static>(
&self,
f: F
) -> SignalHandlerId
Emitted every time a URL is activated.
Applications may connect to it to override the default behaviour,
which is to call show_uri()
.
uri
the URI that is activated
Returns
TRUE
if the link has been activated
pub fn connect_system_information_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
pub fn connect_translator_credits_notify<F: Fn(&Self) + 'static>(
&self,
f: F
) -> SignalHandlerId
Trait Implementations
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Returns the type identifier of Self
.
Auto Trait Implementations
impl RefUnwindSafe for AboutDialog
impl !Send for AboutDialog
impl !Sync for AboutDialog
impl Unpin for AboutDialog
impl UnwindSafe for AboutDialog
Blanket Implementations
Mutably borrows from an owned value. Read more
Upcasts an object to a superclass or interface T
. Read more
Upcasts an object to a reference of its superclass or interface T
. Read more
Tries to downcast to a subclass or interface implementor T
. Read more
Tries to downcast to a reference of its subclass or interface implementor T
. Read more
Tries to cast to an object of type T
. This handles upcasting, downcasting
and casting between interface and interface implementors. All checks are performed at
runtime, while downcast
and upcast
will do many checks at compile-time already. Read more
Tries to cast to reference to an object of type T
. This handles upcasting, downcasting
and casting between interface and interface implementors. All checks are performed at
runtime, while downcast
and upcast
will do many checks at compile-time already. Read more
Casts to T
unconditionally. Read more
Casts to &T
unconditionally. Read more
Returns true
if the object is an instance of (can be cast to) T
.
pub fn set_property<'a, N, V>(
&self,
property_name: N,
value: V
) -> Result<(), BoolError> where
N: Into<&'a str>,
V: ToValue,
pub fn set_property_from_value<'a, N>(
&self,
property_name: N,
value: &Value
) -> Result<(), BoolError> where
N: Into<&'a str>,
pub fn set_properties_from_value(
&self,
property_values: &[(&str, Value)]
) -> Result<(), BoolError>
pub fn has_property<'a, N>(&self, property_name: N, type_: Option<Type>) -> bool where
N: Into<&'a str>,
pub fn find_property<'a, N>(&self, property_name: N) -> Option<ParamSpec> where
N: Into<&'a str>,
Safety Read more
Safety Read more
Safety Read more
Safety Read more
pub fn connect<'a, N, F>(
&self,
signal_name: N,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
N: Into<&'a str>,
F: 'static + Fn(&[Value]) -> Option<Value> + Send + Sync,
Same as connect
but takes a SignalId
instead of a signal name.
pub fn connect_local<'a, N, F>(
&self,
signal_name: N,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
N: Into<&'a str>,
F: 'static + Fn(&[Value]) -> Option<Value>,
Same as connect_local
but takes a SignalId
instead of a signal name.
pub unsafe fn connect_unsafe<'a, N, F>(
&self,
signal_name: N,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
N: Into<&'a str>,
F: Fn(&[Value]) -> Option<Value>,
Same as connect_unsafe
but takes a SignalId
instead of a signal name.
Emit signal by signal id.
Same as emit
but takes Value
for the arguments.
Emit signal by its name.
Same as emit_by_name
but takes Value
for the arguments.
Emit signal with details by signal id.
Same as emit_with_details
but takes Value
for the arguments.
pub fn connect_notify<F>(&self, name: Option<&str>, f: F) -> SignalHandlerId where
F: 'static + Fn(&T, &ParamSpec) + Send + Sync,
pub fn connect_notify_local<F>(
&self,
name: Option<&str>,
f: F
) -> SignalHandlerId where
F: 'static + Fn(&T, &ParamSpec),
pub unsafe fn connect_notify_unsafe<F>(
&self,
name: Option<&str>,
f: F
) -> SignalHandlerId where
F: Fn(&T, &ParamSpec),
pub fn bind_property<'a, O, N, M>(
&'a self,
source_property: N,
target: &'a O,
target_property: M
) -> BindingBuilder<'a> where
O: ObjectType,
N: Into<&'a str>,
M: Into<&'a str>,
Returns a SendValue
clone of self
.