Skip to content

Gtk.AppChooserDialog

class — extends Dialog, Accessible, AppChooser, Buildable, ConstraintTarget, Native, Root, ShortcutManager

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

GtkAppChooserDialog shows a GtkAppChooserWidget inside a GtkDialog.

<picture> <source srcset="appchooserdialog-dark.png" media="(prefers-color-scheme: dark)"> <img alt="An example GtkAppChooserDialog" src="appchooserdialog.png"> </picture>

Note that GtkAppChooserDialog does not have any interesting methods of its own. Instead, you should get the embedded GtkAppChooserWidget using AppChooserDialog.get_widget and call its methods if the generic AppChooser interface is not sufficient for your needs.

To set the heading that is shown above the GtkAppChooserWidget, use AppChooserDialog.set_heading.

CSS nodes

GtkAppChooserDialog has a single CSS node with the name window and style class .appchooser.

Constructors

new

@classmethod
def new(cls, parent: Window | None, flags: DialogFlags | int, file: Gio.File) -> Widget

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

Creates a new GtkAppChooserDialog for the provided GFile.

The dialog will show applications that can open the file.

Parameters:

  • parent — a GtkWindow
  • flags — flags for this dialog
  • file — a GFile

new_for_content_type

@classmethod
def new_for_content_type(cls, parent: Window | None, flags: DialogFlags | int, content_type: str) -> Widget

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

Creates a new GtkAppChooserDialog for the provided content type.

The dialog will show applications that can open the content type.

Parameters:

  • parent — a GtkWindow
  • flags — flags for this dialog
  • content_type — a content type string

Methods

get_heading

def get_heading(self) -> str | None

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

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

get_widget

def get_widget(self) -> Widget

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

Returns the GtkAppChooserWidget of this dialog.

set_heading

def set_heading(self, heading: str) -> None

:::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

Properties

gfile

gfile: Gio.File  # read/write

The GFile used by the GtkAppChooserDialog.

The dialog's GtkAppChooserWidget content type will be guessed from the file, if present.

heading

heading: str  # read/write

The text to show at the top of the dialog.

The string may contain Pango markup.