About all my projects
Gnome::Gtk4::AppChooserButton

Gnome::Gtk4::AppChooserButton

Description

The Gnome::Gtk4::AppChooserButton lets the user select an application.

No caption

Initially, a Gnome::Gtk4::AppChooserButton 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 Gnome::Gtk4::AppChooserButton 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 Gnome::Gtk4::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

Gnome::Gtk4::AppChooserButton has a single CSS node with the name “appchooserbutton”.

Class initialization

Note: The native version of this class is deprecated in gtk4-lib() since version 4.10

new

:native-object

Create an object using a native object from elsewhere. See also Gnome::N::TopLevelSupportClass.

multi method new ( N-Object :$native-object! )

new-appchooserbutton

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Creates a new Gnome::Gtk4::AppChooserButton for applications that can handle content of the given type.

method new-appchooserbutton ( Str $content-type --> Gnome::Gtk4::AppChooserButton \)
  • $content-type; the content type to show applications for.

Methods

append-custom-item

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

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().

method append-custom-item ( Str $name, Str $label, N-Object() $icon )
  • $name; the name of the custom item.

  • $label; the label for the custom item.

  • $icon; the icon for the custom item.

append-separator

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

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

method append-separator ( )

get-heading

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

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

method get-heading (--> Str )

Return value; the text to display at the top of the dialog, or undefined, in which case a default text is displayed.

get-modal

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Gets whether the dialog is modal.

method get-modal (--> Bool )

Return value; True if the dialog is modal.

get-show-default-item

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

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

method get-show-default-item (--> Bool )

Return value; the value of show-default-item.

get-show-dialog-item

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Returns whether the dropdown menu shows an item for a Gnome::Gtk4::AppChooserDialog.

method get-show-dialog-item (--> Bool )

Return value; the value of show-dialog-item.

set-active-custom-item

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Selects a custom item.

See .append-custom-item().

Use .refresh() in class Gnome::Gtk4::R-AppChooser to bring the selection to its initial state.

method set-active-custom-item ( Str $name )
  • $name; the name of the custom item.

set-heading

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

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

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

method set-heading ( Str $heading )
  • $heading; a string containing Pango markup.

set-modal

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Sets whether the dialog should be modal.

method set-modal ( Bool() $modal )
  • $modal; True to make the dialog modal.

set-show-default-item

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

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

method set-show-default-item ( Bool() $setting )
  • $setting; the new value for show-default-item.

set-show-dialog-item

Note: The native version of this routine is deprecated in gtk4-lib() since version 4.10

Sets whether the dropdown menu of this button should show an entry to trigger a Gnome::Gtk4::AppChooserDialog.

method set-show-dialog-item ( Bool() $setting )
  • $setting; the new value for show-dialog-item.

Signals

activate

Emitted to when the button is activated.

The `::activate` signal on Gnome::Gtk4::AppChooserButton is an action signal and emitting it causes the button to pop up its dialog.

method handler (
  Int :$_handle_id,
  N-GObject :$_native-object,
  Gnome::Gtk4::AppChooserButton :$_widget,
  *C<user>-options
)
  • $_handle_id; The registered event handler id.

  • $_native-object; The native object provided by the Raku object which registered this event. This a native Gnome::Gtk4::AppChooserButton object.

  • $_widget; The object which registered the signal. User code may have left the object going out of scope.

  • user-options; A list of named arguments provided at the .register-signal() method from Gnome::GObject::Object.

changed

Emitted when the active application changes.

method handler (
  Int :$_handle_id,
  N-GObject :$_native-object,
  Gnome::Gtk4::AppChooserButton :$_widget,
  *C<user>-options
)
  • $_handle_id; The registered event handler id.

  • $_native-object; The native object provided by the Raku object which registered this event. This a native Gnome::Gtk4::AppChooserButton object.

  • $_widget; The object which registered the signal. User code may have left the object going out of scope.

  • user-options; A list of named arguments provided at the .register-signal() method from Gnome::GObject::Object.

custom-item-activated

Emitted when a custom item is activated.

Use .append-custom-item(), to add custom items.

method handler (
  Str $item-name,
  Int :$_handle_id,
  N-GObject :$_native-object,
  Gnome::Gtk4::AppChooserButton :$_widget,
  *C<user>-options
)
  • $item-name; the name of the activated item.

  • $_handle_id; The registered event handler id.

  • $_native-object; The native object provided by the Raku object which registered this event. This a native Gnome::Gtk4::AppChooserButton object.

  • $_widget; The object which registered the signal. User code may have left the object going out of scope.

  • user-options; A list of named arguments provided at the .register-signal() method from Gnome::GObject::Object.