AppChooserWidget
Object Hierarchy:
Description:
public class AppChooserWidget : Box, Implementor, AppChooser, Buildable, Orientable
AppChooserWidget is a widget for selecting applications.
It is the main building block for AppChooserDialog. Most applications only need to use the latter; but you can use this widget as part of a larger widget if you have special needs.
AppChooserWidget offers detailed control over what applications are shown, using the show_default, show_recommended, show_fallback, show_other and show_all properties. See the AppChooser documentation for more information about these groups of applications.
To keep track of the selected application, use the application_selected and application_activated signals.
CSS nodes
GtkAppChooserWidget has a single CSS node with name appchooser.
Example: AppChooserWidget:
public class Application : Gtk.Window {
private void print_selection (string title, Gtk.AppChooserWidget widget) {
AppInfo info = widget.get_app_info ();
if (info != null) {
print ("%s:\n", title);
print (" Name: %s\n", info.get_display_name ());
print (" Desc: %s\n", info.get_description ());
}
}
public Application () {
// Prepare Gtk.Window:
this.title = "My Gtk.AppChooserWidget";
this.window_position = Gtk.WindowPosition.CENTER;
this.destroy.connect (Gtk.main_quit);
// The button:
Gtk.AppChooserWidget widget = new Gtk.AppChooserWidget ("image/png");
this.add (widget);
// Catch all selections:
widget.application_activated.connect (() => {
print_selection ("Activated", widget);
});
widget.application_selected.connect (() => {
print_selection ("Selected", widget);
});
}
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.AppChooserWidget.vala