AppChooserButton
Object Hierarchy:
Description:
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.
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