From 32c977866baa93dea6e2e84598d3ef375c5e617e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Danielle=20For=C3=A9?= Date: Tue, 23 Nov 2021 11:44:25 -0800 Subject: [PATCH] Bookmarks Plugin: Get default file browser name (#517) --- .../file-bookmarks-plugin.vala | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/synapse-plugins/file-bookmarks-plugin.vala b/src/synapse-plugins/file-bookmarks-plugin.vala index cf43a5e6..f769e0c9 100644 --- a/src/synapse-plugins/file-bookmarks-plugin.vala +++ b/src/synapse-plugins/file-bookmarks-plugin.vala @@ -64,7 +64,24 @@ namespace Synapse { _name = location.get_basename (); } - string _title = _("Open %s in Files").printf (_name); + var appinfo = AppInfo.get_default_for_uri_scheme (file.get_uri_scheme ()); + if (appinfo == null) { + try { + var info = file.query_info ( + FileAttribute.STANDARD_CONTENT_TYPE, FileQueryInfoFlags.NOFOLLOW_SYMLINKS, null + ); + + if (info.has_attribute (FileAttribute.STANDARD_CONTENT_TYPE)) { + appinfo = AppInfo.get_default_for_type ( + info.get_attribute_string (FileAttribute.STANDARD_CONTENT_TYPE), true + ); + } + } catch (Error e) { + appinfo = new DesktopAppInfo ("io.elementary.files.desktop"); + } + } + + string _title = _("Open %s in %s").printf (_name, appinfo.get_display_name ()); this.title = _title; this.icon_name = _icon_name;