[Xfce4-commits] <postler:master> Implement single-instance handling with Gtk.Application

Christian Dywan noreply at xfce.org
Wed Jul 6 19:38:04 CEST 2011


Updating branch refs/heads/master
         to b8a9cb8a1c656f2da0effb7cc7c131efa4e853c6 (commit)
       from 325fee9f952934342a3ee9128e788487c0aeadcb (commit)

commit b8a9cb8a1c656f2da0effb7cc7c131efa4e853c6
Author: Lucas Baudin <xapantu at gmail.com>
Date:   Wed Jul 6 19:35:16 2011 +0200

    Implement single-instance handling with Gtk.Application

 postler/postler-app.vala    |    4 +++-
 postler/postler-reader.vala |   11 ++++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/postler/postler-app.vala b/postler/postler-app.vala
index 52f2a9f..8153080 100644
--- a/postler/postler-app.vala
+++ b/postler/postler-app.vala
@@ -71,7 +71,9 @@ public class Postler.App : Unique.App {
     }
 
 #if HAVE_GTK3
-    /* FIXME: Implement instance callback */
+    public override void activate () {
+        bureau.present ();
+   }
 #else
     public override Unique.Response message_received (int command,
         Unique.MessageData data, uint timestamp) {
diff --git a/postler/postler-reader.vala b/postler/postler-reader.vala
index c9eb09f..05f9bb2 100644
--- a/postler/postler-reader.vala
+++ b/postler/postler-reader.vala
@@ -218,7 +218,16 @@ public class Postler.Reader {
 
         var app = new Postler.App ();
 #if HAVE_GTK3
-        /* FIXME: Implement instance check */
+        try {
+            app.register ();
+            if (app.is_remote) {
+                app.activate ();
+                return 0;
+            }
+        }
+        catch (GLib.Error error) {
+            GLib.error (_("Failed to activate running instance"));
+        }
 #else
         if (app.is_running) {
             Unique.MessageData data = new Unique.MessageData ();



More information about the Xfce4-commits mailing list