:right-sidebar: True AppChooserButton =================================================================== .. currentmodule:: gi.repository.Gtk .. deprecated:: 4.10 The application selection widgets should be implemented according to the design of each platform and/or application requiring them. .. class:: AppChooserButton(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Gtk.Widget`, :class:`~gi.repository.GObject.InitiallyUnowned`, :class:`~gi.repository.GObject.Object` Implemented Interfaces: :class:`~gi.repository.Gtk.Accessible`, :class:`~gi.repository.Gtk.AppChooser`, :class:`~gi.repository.Gtk.Buildable`, :class:`~gi.repository.Gtk.ConstraintTarget` The ``GtkAppChooserButton`` lets the user select an application. .. image:: 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 :obj:`~gi.repository.Gtk.AppChooserButton.props.show_default_item` is :const:`True`, the default application. The list of applications shown in a ``GtkAppChooserButton`` includes the recommended applications for the given content type. When :obj:`~gi.repository.Gtk.AppChooserButton.props.show_default_item` is set, the default application is also included. To let the user chooser other applications, you can set the :obj:`~gi.repository.Gtk.AppChooserButton.props.show_dialog_item` property, which allows to open a full :obj:`~gi.repository.Gtk.AppChooserDialog`. It is possible to add custom items to the list, using :obj:`~gi.repository.Gtk.AppChooserButton.append_custom_item`. These items cause the :obj:`~gi.repository.Gtk.AppChooserButton.signals.custom_item_activated` signal to be emitted when they are selected. To track changes in the selected application, use the :obj:`~gi.repository.Gtk.AppChooserButton.signals.changed` signal. CSS nodes --------- ``GtkAppChooserButton`` has a single CSS node with the name “appchooserbutton”. Constructors ------------ .. rst-class:: interim-class .. class:: AppChooserButton :no-index: .. classmethod:: new(content_type: str) -> ~gi.repository.Gtk.Widget Creates a new ``GtkAppChooserButton`` for applications that can handle content of the given type. .. deprecated:: 4.10 This widget will be removed in GTK 5 :param content_type: the content type to show applications for Methods ------- .. rst-class:: interim-class .. class:: AppChooserButton :no-index: .. method:: append_custom_item(name: str, label: str, icon: ~gi.repository.Gio.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 :obj:`~gi.repository.Gtk.AppChooserButton.signals.custom_item_activated` signal, to add a callback for the activation of a particular custom item in the list. See also :obj:`~gi.repository.Gtk.AppChooserButton.append_separator`. .. deprecated:: 4.10 This widget will be removed in GTK 5 :param name: the name of the custom item :param label: the label for the custom item :param icon: the icon for the custom item .. method:: append_separator() -> None Appends a separator to the list of applications that is shown in the popup. .. deprecated:: 4.10 This widget will be removed in GTK 5 .. method:: get_heading() -> str | None Returns the text to display at the top of the dialog. .. deprecated:: 4.10 This widget will be removed in GTK 5 .. method:: get_modal() -> bool Gets whether the dialog is modal. .. deprecated:: 4.10 This widget will be removed in GTK 5 .. method:: get_show_default_item() -> bool Returns whether the dropdown menu should show the default application at the top. .. deprecated:: 4.10 This widget will be removed in GTK 5 .. method:: get_show_dialog_item() -> bool Returns whether the dropdown menu shows an item for a ``GtkAppChooserDialog``. .. deprecated:: 4.10 This widget will be removed in GTK 5 .. method:: set_active_custom_item(name: str) -> None Selects a custom item. See :obj:`~gi.repository.Gtk.AppChooserButton.append_custom_item`. Use :obj:`~gi.repository.Gtk.AppChooser.refresh` to bring the selection to its initial state. .. deprecated:: 4.10 This widget will be removed in GTK 5 :param name: the name of the custom item .. method:: 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:: 4.10 This widget will be removed in GTK 5 :param heading: a string containing Pango markup .. method:: set_modal(modal: bool) -> None Sets whether the dialog should be modal. .. deprecated:: 4.10 This widget will be removed in GTK 5 :param modal: :const:`True` to make the dialog modal .. method:: 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:: 4.10 This widget will be removed in GTK 5 :param setting: the new value for :obj:`~gi.repository.Gtk.AppChooserButton.props.show_default_item` .. method:: set_show_dialog_item(setting: bool) -> None Sets whether the dropdown menu of this button should show an entry to trigger a ``GtkAppChooserDialog``. .. deprecated:: 4.10 This widget will be removed in GTK 5 :param setting: the new value for :obj:`~gi.repository.Gtk.AppChooserButton.props.show_dialog_item` Properties ---------- .. rst-class:: interim-class .. class:: AppChooserButton :no-index: .. attribute:: props.heading :type: str The text to show at the top of the dialog that can be opened from the button. The string may contain Pango markup. .. attribute:: props.modal :type: bool Whether the app chooser dialog should be modal. .. attribute:: props.show_default_item :type: bool Determines whether the dropdown menu shows the default application on top for the provided content type. .. attribute:: props.show_dialog_item :type: bool Determines whether the dropdown menu shows an item to open a ``GtkAppChooserDialog``. Signals ------- .. rst-class:: interim-class .. class:: AppChooserButton.signals :no-index: .. method:: 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. .. versionadded:: 4.4 .. method:: changed() -> None Emitted when the active application changes. .. method:: custom_item_activated(item_name: str) -> None Emitted when a custom item is activated. Use :obj:`~gi.repository.Gtk.AppChooserButton.append_custom_item`, to add custom items. :param item_name: the name of the activated item