AppChooserButton


Object Hierarchy:

Gtk.AppChooserButton Gtk.AppChooserButton Gtk.AppChooserButton Gtk.ComboBox Gtk.ComboBox Gtk.ComboBox->Gtk.AppChooserButton Gtk.Bin Gtk.Bin Gtk.Bin->Gtk.ComboBox Gtk.Container Gtk.Container Gtk.Container->Gtk.Bin Gtk.Widget Gtk.Widget Gtk.Widget->Gtk.Container GLib.InitiallyUnowned GLib.InitiallyUnowned GLib.InitiallyUnowned->Gtk.Widget GLib.Object GLib.Object GLib.Object->GLib.InitiallyUnowned Atk.Implementor Atk.Implementor Atk.Implementor->Gtk.AppChooserButton Atk.Implementor->Gtk.ComboBox Atk.Implementor->Gtk.Bin Atk.Implementor->Gtk.Container Atk.Implementor->Gtk.Widget Gtk.Buildable Gtk.Buildable Gtk.Buildable->Gtk.AppChooserButton Gtk.Buildable->Gtk.ComboBox Gtk.Buildable->Gtk.Bin Gtk.Buildable->Gtk.Container Gtk.Buildable->Gtk.Widget Gtk.CellEditable Gtk.CellEditable Gtk.CellEditable->Gtk.AppChooserButton Gtk.CellEditable->Gtk.ComboBox Gtk.CellLayout Gtk.CellLayout Gtk.CellLayout->Gtk.AppChooserButton Gtk.CellLayout->Gtk.ComboBox Gtk.AppChooser Gtk.AppChooser Gtk.AppChooser->Gtk.AppChooserButton

Description:

[ CCode ( type_id = "gtk_app_chooser_button_get_type ()" ) ]
public class AppChooserButton : ComboBox, Implementor, AppChooser, Buildable, CellEditable, CellLayout

The AppChooserButton is a widget that lets the user select an application.

It implements the AppChooser interface.

Initially, a 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 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 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.

GtkAppChooserButton

Example: AppChooserButton:

public class Application : Gtk.Window {
public Application () {
// Prepare Gtk.Window:
this.title = "My Gtk.AppChooserButton";
this.window_position = Gtk.WindowPosition.CENTER;
this.destroy.connect (Gtk.main_quit);

// The button:
Gtk.AppChooserButton button = new Gtk.AppChooserButton ("image/png");
this.add (button);

// Add a separator line:
button.append_separator ();

// Add a custom entry:
ThemedIcon themed_icon = new ThemedIcon ("folder-new");
button.append_custom_item ("my-image-viewer", "My image Viewer", themed_icon);

// Catch custom selections:
button.custom_item_activated.connect ((item_name) => {
print ("%s\n", item_name);
});

// Catch all selections:
button.changed.connect (() => {
AppInfo info = button.get_app_info ();
if (info != null) {
print ("Selection:\n");
print (" Name: %s\n", info.get_display_name ());
print (" Desc: %s\n", info.get_description ());
}
});
}

public static int main (string[] args) {
Gtk.init (ref args);

Application app = new Application ();
app.show_all ();
Gtk.main ();
return 0;
}
}

valac --pkg gtk+-3.0 Gtk.AppChooserButton.vala

Namespace: Gtk
Package: gtk+-3.0

Content:

Properties:

Creation methods:

Methods:

Signals:

Inherited Members:

All known members inherited from class Gtk.Bin
All known members inherited from class Gtk.Widget
All known members inherited from class GLib.Object
All known members inherited from interface Atk.Implementor
All known members inherited from interface Gtk.AppChooser
All known members inherited from interface Gtk.CellEditable



2022 vala-language.org