diff --git a/src/client/application/geary-application.vala b/src/client/application/geary-application.vala index 727cbaff..834ea088 100644 --- a/src/client/application/geary-application.vala +++ b/src/client/application/geary-application.vala @@ -366,7 +366,10 @@ public class GearyApplication : Gtk.Application { public GearyApplication() { Object( application_id: APP_ID, - flags: GLib.ApplicationFlags.HANDLES_COMMAND_LINE + flags: ( + GLib.ApplicationFlags.HANDLES_OPEN | + GLib.ApplicationFlags.HANDLES_COMMAND_LINE + ) ); this.add_main_option_entries(OPTION_ENTRIES); _instance = this; @@ -463,6 +466,23 @@ public class GearyApplication : Gtk.Application { this.present.begin(); } + public override void open(GLib.File[] targets, string hint) { + foreach (GLib.File target in targets) { + if (target.get_uri_scheme() == "mailto") { + string mailto = target.get_uri(); + // Due to GNOME/glib#1886, the email address may be + // prefixed by a '///'. If so, remove it. + if (mailto.has_prefix("mailto:///")) { + mailto = ( + Geary.ComposedEmail.MAILTO_SCHEME + + mailto.substring("mailto:///".length) + ); + } + this.new_composer.begin(mailto); + } + } + } + public void add_window_accelerators(string action, string[] accelerators, Variant? param = null) {