Skip to content

Gtk.AppChooserWidget

class — extends Widget, Accessible, AppChooser, Buildable, ConstraintTarget

:::warning Deprecated since 4.10 This API is deprecated. :::

GtkAppChooserWidget is a widget for selecting applications.

It is the main building block for AppChooserDialog. Most applications only need to use the latter; but you can use this widget as part of a larger widget if you have special needs.

GtkAppChooserWidget offers detailed control over what applications are shown, using the AppChooserWidget.show-default, AppChooserWidget.show-recommended, AppChooserWidget.show-fallback, AppChooserWidget.show-other and AppChooserWidget.show-all properties. See the AppChooser documentation for more information about these groups of applications.

To keep track of the selected application, use the AppChooserWidget.application-selected and AppChooserWidget.application-activated signals.

CSS nodes

GtkAppChooserWidget has a single CSS node with name appchooser.

Constructors

new

@classmethod
def new(cls, content_type: str) -> Widget

:::warning Deprecated since 4.10 This API is deprecated. :::

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

Parameters:

  • content_type — the content type to show applications for

Methods

get_default_text

def get_default_text(self) -> str | None

:::warning Deprecated since 4.10 This API is deprecated. :::

Returns the text that is shown if there are not applications that can handle the content type.

get_show_all

def get_show_all(self) -> bool

:::warning Deprecated since 4.10 This API is deprecated. :::

Gets whether the app chooser should show all applications in a flat list.

get_show_default

def get_show_default(self) -> bool

:::warning Deprecated since 4.10 This API is deprecated. :::

Gets whether the app chooser should show the default handler for the content type in a separate section.

get_show_fallback

def get_show_fallback(self) -> bool

:::warning Deprecated since 4.10 This API is deprecated. :::

Gets whether the app chooser should show related applications for the content type in a separate section.

get_show_other

def get_show_other(self) -> bool

:::warning Deprecated since 4.10 This API is deprecated. :::

Gets whether the app chooser should show applications which are unrelated to the content type.

def get_show_recommended(self) -> bool

:::warning Deprecated since 4.10 This API is deprecated. :::

Gets whether the app chooser should show recommended applications for the content type in a separate section.

set_default_text

def set_default_text(self, text: str) -> None

:::warning Deprecated since 4.10 This API is deprecated. :::

Sets the text that is shown if there are not applications that can handle the content type.

Parameters:

set_show_all

def set_show_all(self, setting: bool) -> None

:::warning Deprecated since 4.10 This API is deprecated. :::

Sets whether the app chooser should show all applications in a flat list.

Parameters:

set_show_default

def set_show_default(self, setting: bool) -> None

:::warning Deprecated since 4.10 This API is deprecated. :::

Sets whether the app chooser should show the default handler for the content type in a separate section.

Parameters:

set_show_fallback

def set_show_fallback(self, setting: bool) -> None

:::warning Deprecated since 4.10 This API is deprecated. :::

Sets whether the app chooser should show related applications for the content type in a separate section.

Parameters:

set_show_other

def set_show_other(self, setting: bool) -> None

:::warning Deprecated since 4.10 This API is deprecated. :::

Sets whether the app chooser should show applications which are unrelated to the content type.

Parameters:

def set_show_recommended(self, setting: bool) -> None

:::warning Deprecated since 4.10 This API is deprecated. :::

Sets whether the app chooser should show recommended applications for the content type in a separate section.

Parameters:

Properties

default_text

default_text: str  # read/write

The text that appears in the widget when there are no applications for the given content type.

show_all

show_all: bool  # read/write

If True, the app chooser presents all applications in a single list, without subsections for default, recommended or related applications.

show_default

show_default: bool  # read/write

Determines whether the app chooser should show the default handler for the content type in a separate section.

If False, the default handler is listed among the recommended applications.

show_fallback

show_fallback: bool  # read/write

Determines whether the app chooser should show a section for fallback applications.

If False, the fallback applications are listed among the other applications.

show_other

show_other: bool  # read/write

Determines whether the app chooser should show a section for other applications.

show_recommended: bool  # read/write

Determines whether the app chooser should show a section for recommended applications.

If False, the recommended applications are listed among the other applications.

Signals

application-activated

def on_application_activated(self, application: Gio.AppInfo) -> None: ...

Emitted when an application item is activated from the widget's list.

This usually happens when the user double clicks an item, or an item is selected and the user presses one of the keys Space, Shift+Space, Return or Enter.

application-selected

def on_application_selected(self, application: Gio.AppInfo) -> None: ...

Emitted when an application item is selected from the widget's list.