AppChooserButton#

Deprecated since version 4.10:

The application selection widgets should be

implemented according to the design of each platform and/or application requiring them.

class AppChooserButton(**properties: Any)#

Superclasses: Widget, InitiallyUnowned, Object

Implemented Interfaces: Accessible, AppChooser, Buildable, ConstraintTarget

The GtkAppChooserButton lets the user select an application.

https://docs.gtk.org/gtk4/appchooserbutton.png

Initially, a GtkAppChooserButton selects the first application in its list, which will either be the most-recently used application or, if 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 show_default_item is set, the default application is also included. To let the user chooser other applications, you can set the show_dialog_item property, which allows to open a full AppChooserDialog.

It is possible to add custom items to the list, using append_custom_item. These items cause the custom_item_activated signal to be emitted when they are selected.

To track changes in the selected application, use the changed signal.

CSS nodes#

GtkAppChooserButton has a single CSS node with the name “appchooserbutton”.

Constructors#

class AppChooserButton
classmethod new(content_type: str) Widget#

Creates a new GtkAppChooserButton for applications that can handle content of the given type.

Deprecated since version 4.10: This widget will be removed in GTK 5

Parameters:

content_type – the content type to show applications for

Methods#

class AppChooserButton
append_custom_item(name: str, label: str, icon: Icon) None#

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 custom_item_activated signal, to add a callback for the activation of a particular custom item in the list.

See also append_separator.

Deprecated since version 4.10: This widget will be removed in GTK 5

Parameters:
  • name – the name of the custom item

  • label – the label for the custom item

  • icon – the icon for the custom item

append_separator() None#

Appends a separator to the list of applications that is shown in the popup.

Deprecated since version 4.10: This widget will be removed in GTK 5

get_heading() str | None#

Returns the text to display at the top of the dialog.

Deprecated since version 4.10: This widget will be removed in GTK 5

get_modal() bool#

Gets whether the dialog is modal.

Deprecated since version 4.10: This widget will be removed in GTK 5

get_show_default_item() bool#

Returns whether the dropdown menu should show the default application at the top.

Deprecated since version 4.10: This widget will be removed in GTK 5

get_show_dialog_item() bool#

Returns whether the dropdown menu shows an item for a GtkAppChooserDialog.

Deprecated since version 4.10: This widget will be removed in GTK 5

set_active_custom_item(name: str) None#

Selects a custom item.

See append_custom_item.

Use refresh to bring the selection to its initial state.

Deprecated since version 4.10: This widget will be removed in GTK 5

Parameters:

name – the name of the custom item

set_heading(heading: str) None#

Sets the text to display at the top of the dialog.

If the heading is not set, the dialog displays a default text.

Deprecated since version 4.10: This widget will be removed in GTK 5

Parameters:

heading – a string containing Pango markup

set_modal(modal: bool) None#

Sets whether the dialog should be modal.

Deprecated since version 4.10: This widget will be removed in GTK 5

Parameters:

modalTrue to make the dialog modal

set_show_default_item(setting: bool) None#

Sets whether the dropdown menu of this button should show the default application for the given content type at top.

Deprecated since version 4.10: This widget will be removed in GTK 5

Parameters:

setting – the new value for show_default_item

set_show_dialog_item(setting: bool) None#

Sets whether the dropdown menu of this button should show an entry to trigger a GtkAppChooserDialog.

Deprecated since version 4.10: This widget will be removed in GTK 5

Parameters:

setting – the new value for show_dialog_item

Properties#

class AppChooserButton
props.heading: str#

The type of the None singleton.

props.modal: bool#

The type of the None singleton.

props.show_default_item: bool#

The type of the None singleton.

props.show_dialog_item: bool#

The type of the None singleton.

Signals#

class AppChooserButton.signals
activate() None#

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.

Added in version 4.4.

changed() None#

The type of the None singleton.

custom_item_activated(item_name: str) None#

The type of the None singleton.

Parameters:

item_name – the name of the activated item