query_default_handler
Description:
Returns the AppInfo that is registered as the default application to handle the file specified by this.
If cancellable
is not null, then the operation can be cancelled by triggering the cancellable
object from another thread. If the operation was cancelled, the error g_io_error_cancelled will be returned.
Example: Get the default application to handle a file:
public static int main (string[] args) {
try {
List<string> uris = new List<string> ();
uris.append ("http://developer.gnome.org/");
File file = File.new_for_uri (uris.nth_data (0));
AppInfo appinfo = file.query_default_handler ();
appinfo.launch_uris (uris, null);
} catch (Error e) {
print ("Error: %s\n", e.message);
}
return 0;
}
valac --pkg gio-2.0 GLib.File.query_default_handler.vala
Parameters:
this |
a File to open |
cancellable |
optional Cancellable object, null to ignore |
Returns:
a AppInfo if the handle was found, null if there were errors. When you are done with it, release it with unref |