Gtk.AppChooserButton¶
class — extends Widget, Accessible, AppChooser, Buildable, ConstraintTarget
:::warning Deprecated since 4.10 This API is deprecated. :::
The GtkAppChooserButton lets the user select an application.
<picture> <source srcset="appchooserbutton-dark.png" media="(prefers-color-scheme: dark)"> <img alt="An example GtkAppChooserButton" src="appchooserbutton.png"> </picture>
Initially, a GtkAppChooserButton selects the first application
in its list, which will either be the most-recently used application
or, if AppChooserButton.show-default-item is True, the
default application.
The list of applications shown in a GtkAppChooserButton includes
the recommended applications for the given content type. When
AppChooserButton.show-default-item is set, the default
application is also included. To let the user chooser other applications,
you can set the AppChooserButton.show-dialog-item property,
which allows to open a full AppChooserDialog.
It is possible to add custom items to the list, using
AppChooserButton.append_custom_item. These items cause
the AppChooserButton.custom-item-activated signal to be
emitted when they are selected.
To track changes in the selected application, use the
AppChooserButton.changed signal.
CSS nodes¶
GtkAppChooserButton has a single CSS node with the name “appchooserbutton”.
Constructors¶
new¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Creates a new GtkAppChooserButton for applications
that can handle content of the given type.
Parameters:
content_type— the content type to show applications for
Methods¶
append_custom_item¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Appends a custom item to the list of applications that is shown in the popup.
The item name must be unique per-widget. Clients can use the
provided name as a detail for the
AppChooserButton.custom-item-activated signal, to add a
callback for the activation of a particular custom item in the list.
See also AppChooserButton.append_separator.
Parameters:
name— the name of the custom itemlabel— the label for the custom itemicon— the icon for the custom item
append_separator¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Appends a separator to the list of applications that is shown in the popup.
get_heading¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Returns the text to display at the top of the dialog.
get_modal¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Gets whether the dialog is modal.
get_show_default_item¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Returns whether the dropdown menu should show the default application at the top.
get_show_dialog_item¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Returns whether the dropdown menu shows an item
for a GtkAppChooserDialog.
set_active_custom_item¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Selects a custom item.
See AppChooserButton.append_custom_item.
Use AppChooser.refresh to bring the selection
to its initial state.
Parameters:
name— the name of the custom item
set_heading¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Sets the text to display at the top of the dialog.
If the heading is not set, the dialog displays a default text.
Parameters:
heading— a string containing Pango markup
set_modal¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Sets whether the dialog should be modal.
Parameters:
modal—Trueto make the dialog modal
set_show_default_item¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Sets whether the dropdown menu of this button should show the default application for the given content type at top.
Parameters:
setting— the new value forAppChooserButton.show-default-item
set_show_dialog_item¶
:::warning Deprecated since 4.10 This API is deprecated. :::
Sets whether the dropdown menu of this button should show an
entry to trigger a GtkAppChooserDialog.
Parameters:
setting— the new value forAppChooserButton.show-dialog-item
Properties¶
heading¶
The text to show at the top of the dialog that can be opened from the button.
The string may contain Pango markup.
modal¶
Whether the app chooser dialog should be modal.
show_default_item¶
Determines whether the dropdown menu shows the default application on top for the provided content type.
show_dialog_item¶
Determines whether the dropdown menu shows an item to open
a GtkAppChooserDialog.
Signals¶
activate¶
Emitted to when the button is activated.
The ::activate signal on GtkAppChooserButton is an action signal and
emitting it causes the button to pop up its dialog.
changed¶
Emitted when the active application changes.
custom-item-activated¶
Emitted when a custom item is activated.
Use AppChooserButton.append_custom_item,
to add custom items.