Skip to content

Commit

Permalink
Bookmarks Plugin: Get default file browser name (#517)
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit authored Nov 23, 2021
1 parent 85965f3 commit 32c9778
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/synapse-plugins/file-bookmarks-plugin.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 32c9778

Please sign in to comment.