summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2019-10-07 15:04:18 +0200
committerOndrej Holy <oholy@redhat.com>2019-10-14 09:00:49 +0200
commit8c08a18fdd38173c0c5a0533c05044f18dde76f6 (patch)
tree23fe02b9b91d0a0c4ecbba064d1469e66e34889c /src
parent065e4c10068e2359d325e447071c03dba03c453e (diff)
downloadbaobab-8c08a18fdd38173c0c5a0533c05044f18dde76f6.tar.gz
window: Fix issues with opening files
Baobab doesn't expect that file handler doesn't have to exists for certain mime type and consequently fails when opening file with "g_app_info_launch: assertion 'G_IS_APP_INFO (appinfo)' failed" critical in such case. It also requires only handlers which supports URIs. Consequently, for example, it is not possible to open folders in Thunar as it uses "%F" on its Exec line. But all supported URIs should be accessible over gvfsd-fuse mountpoint. Let's replace the whole logic to open files by simple g_app_info_launch_default_for_uri() to fix those issues. Fixes: https://gitlab.gnome.org/GNOME/baobab/issues/31
Diffstat (limited to 'src')
-rw-r--r--src/baobab-window.vala9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/baobab-window.vala b/src/baobab-window.vala
index c91bf46..2fb7835 100644
--- a/src/baobab-window.vala
+++ b/src/baobab-window.vala
@@ -375,14 +375,7 @@ namespace Baobab {
active_location.scanner.get (iter, Scanner.Columns.PARSE_NAME, out parse_name);
var file = File.parse_name (parse_name);
try {
- var info = file.query_info (FileAttribute.STANDARD_CONTENT_TYPE, 0, null);
- var content = info.get_content_type ();
- var appinfo = AppInfo.get_default_for_type (content, true);
- var context = get_display ().get_app_launch_context ();
- context.set_timestamp (Gtk.get_current_event_time ());
- var files = new List<File>();
- files.append (file);
- appinfo.launch(files, context);
+ AppInfo.launch_default_for_uri (file.get_uri (), null);
} catch (Error e) {
message (_("Failed to open file"), e.message, Gtk.MessageType.ERROR);
}