[Xfce4-commits] <postler:master> Support old and new GettingThingsGNOME DBus interface
Christian Dywan
noreply at xfce.org
Fri Aug 12 22:06:05 CEST 2011
Updating branch refs/heads/master
to 9f9dd7d6d0596483f284a24770f4732eac11d042 (commit)
from 6b316ed38bff9f6b53fb1d478295ba84f18aca05 (commit)
commit 9f9dd7d6d0596483f284a24770f4732eac11d042
Author: Christian Dywan <christian at twotoasts.de>
Date: Fri Aug 12 21:39:16 2011 +0200
Support old and new GettingThingsGNOME DBus interface
README | 2 +-
postler/gtg.vala | 29 +++++++++++++++++++++--------
2 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/README b/README
index 2038eb9..fbd45c8 100644
--- a/README
+++ b/README
@@ -10,7 +10,7 @@ integration are provided by Dexter.
Requirements: GIO 2.26, GTK+ 2.18, WebkitGTK+ 1.1.18, Unique 0.9, libnotify,
libcanberra, (Berkeley) db, openssl
-Recommended: libfolks, Zeitgeist, libindicate, Dexter, lynx, libstemmer
+Recommended: libfolks, Zeitgeist, libindicate, Dexter, lynx, libstemmer, Getting Things GNOME!
For installation instructions read INSTALL.
diff --git a/postler/gtg.vala b/postler/gtg.vala
index 048f8fd..fd69f11 100644
--- a/postler/gtg.vala
+++ b/postler/gtg.vala
@@ -12,18 +12,27 @@
namespace GTG {
[DBus (name = "org.GTG")]
- interface GTGService : GLib.DBusProxy {
+ interface LegacyGTGService : GLib.DBusProxy {
[DBus (name = "open_new_task")]
public abstract void open_new_task (string subject, string text) throws IOError;
}
+ [DBus (name = "org.gnome.GTG")]
+ interface GTGService : GLib.DBusProxy {
+ public abstract void open_new_task (string subject, string text) throws IOError;
+ }
public class GTG : Object {
- GTGService? service = null;
+ static LegacyGTGService? legacy = null;
+ static GTGService? service = null;
public GTG () {
- if (service != null)
+ ensure_service ();
+ }
+ public void ensure_service () {
+ if (service != null || legacy != null)
return;
try {
- service = Bus.get_proxy_sync (BusType.SESSION, "org.GTG", "/org/GTG");
+ service = Bus.get_proxy_sync (BusType.SESSION, "org.gnome.GTG", "/org/gnome/GTG");
+ legacy = Bus.get_proxy_sync (BusType.SESSION, "org.GTG", "/org/GTG");
}
catch (GLib.Error error) { }
}
@@ -32,14 +41,18 @@ namespace GTG {
}
}
public void open_new_task (string subject, string text) {
+ ensure_service ();
try {
- if (service == null)
- service = Bus.get_proxy_sync (BusType.SESSION, "org.GTG", "/org/GTG");
service.open_new_task (subject, text);
}
catch (GLib.Error error) {
- /* Fallback if GTG fails to launch automatically */
- Postler.App.execute_command ("gtg_new_task " + subject);
+ try {
+ legacy.open_new_task (subject, text);
+ }
+ catch (GLib.Error legacy_error) {
+ /* Fallback if GTG fails to launch automatically */
+ Postler.App.execute_command ("gtg_new_task " + subject);
+ }
}
}
}
More information about the Xfce4-commits
mailing list