[geary/wip/522-mailto-broken] Explicitly handle Application::open



commit 7724fd14b2d20619edca4119d076a7b0fcdc1c4d
Author: Michael Gratton <mike vee net>
Date:   Thu Aug 29 23:31:50 2019 +1000

    Explicitly handle Application::open
    
    Using Geary not working as a mailto: handler broke after the conversion
    to being DBus-activated, due to the GAppplication DBus implementation
    not passing on the open action if the `HANDLES_OPEN` flag is not set.
    
    This sets the flag and implements the `open` signal.
    
    See GNOME/glib#1853
    
    Fixes #522

 src/client/application/geary-application.vala | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
---
diff --git a/src/client/application/geary-application.vala b/src/client/application/geary-application.vala
index 77307393..11e6480b 100644
--- a/src/client/application/geary-application.vala
+++ b/src/client/application/geary-application.vala
@@ -363,7 +363,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;
@@ -460,6 +463,14 @@ 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") {
+                this.new_composer.begin(target.get_uri());
+            }
+        }
+    }
+
     public void add_window_accelerators(string action,
                                         string[] accelerators,
                                         Variant? param = null) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]