[Xfce4-commits] <postler:master> Handle the case where dexter service can't be created

Christian Dywan noreply at xfce.org
Mon Jan 24 23:18:01 CET 2011


Updating branch refs/heads/master
         to dee839dcfa8b10c26d7c2bfdf94bd4f1a18a9cd6 (commit)
       from c600ff30715484f7ea56535e04f2338e3bb0dcd4 (commit)

commit dee839dcfa8b10c26d7c2bfdf94bd4f1a18a9cd6
Author: Christian Dywan <christian at twotoasts.de>
Date:   Mon Jan 24 23:17:39 2011 +0100

    Handle the case where dexter service can't be created

 postler/dexter.vala |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/postler/dexter.vala b/postler/dexter.vala
index d7b0927..ddde325 100644
--- a/postler/dexter.vala
+++ b/postler/dexter.vala
@@ -20,7 +20,7 @@ namespace Dexter {
     }
 
     public class Dexter : Object {
-        DexterService service;
+        DexterService? service = null;
         public Dexter () {
             try {
                 service = Bus.get_proxy_sync (BusType.SESSION,
@@ -36,6 +36,8 @@ namespace Dexter {
         }
         public void edit_contact (string name, string email_address) {
             try {
+                if (service == null)
+                    throw new GLib.IOError.FAILED ("Service unavailable");
                 service.edit_contact (name, email_address);
             } catch (GLib.Error error) {
                 Postler.App.execute_command ("dexter");
@@ -43,6 +45,8 @@ namespace Dexter {
         }
         public string? get_name (string email_address) {
             try {
+                if (service == null)
+                    throw new GLib.IOError.FAILED ("Service unavailable");
                 string name = service.get_name (email_address);
                 return name != "" ? name : null;
             } catch (GLib.Error error) {
@@ -51,6 +55,8 @@ namespace Dexter {
         }
         public string[] autocomplete_contact (string keywords) {
             try {
+                if (service == null)
+                    throw new GLib.IOError.FAILED ("Service unavailable");
                 return service.autocomplete_contact (keywords);
             } catch (GLib.Error error) {
                 return {};
@@ -58,6 +64,8 @@ namespace Dexter {
         }
         public void show_window () {
             try {
+                if (service == null)
+                    throw new GLib.IOError.FAILED ("Service unavailable");
                 service.show_window ();
             } catch (GLib.Error error) {
                 Postler.App.execute_command ("dexter");



More information about the Xfce4-commits mailing list