[folks] Fix build with evolution-data-server master



commit 0ad183e612b5567b055cef7f601cd67461c485cd
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Sun Feb 17 23:50:44 2013 +0100

    Fix build with evolution-data-server master
    
    Eds recently splitted certain enums from libebook into libebook-contacts.
    As part of that, they are now correctly reported as error domains,
    rather than bare enums, so we need to change the syntax to check them.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=694049

 NEWS                                     |    3 +
 backends/eds/lib/Makefile.am             |    1 +
 backends/eds/lib/edsf-persona-store.vala |   81 +++++++++++++----------------
 configure.ac                             |    7 ++-
 4 files changed, 44 insertions(+), 48 deletions(-)
---
diff --git a/NEWS b/NEWS
index cd3c0fc..dbb6e18 100644
--- a/NEWS
+++ b/NEWS
@@ -2,10 +2,13 @@ Overview of changes from libfolks 0.9.0 to libfolks 0.9.1
 =========================================================
 
 Dependencies:
+â libebook-1.2 â 3.7.90
+â libebook-contacts-1.2 â 3.7.90
 
 Major changes:
 
 Bugs fixed:
+â Bug 694049 â Fix build with e-d-s master
 
 API changes:
 
diff --git a/backends/eds/lib/Makefile.am b/backends/eds/lib/Makefile.am
index cc276df..a0dddb0 100644
--- a/backends/eds/lib/Makefile.am
+++ b/backends/eds/lib/Makefile.am
@@ -51,6 +51,7 @@ libfolks_eds_la_VALAFLAGS = \
        --pkg gio-2.0 \
        --pkg gobject-2.0 \
        --pkg libebook-1.2 \
+       --pkg libebook-contacts-1.2 \
        --pkg libedataserver-1.2 \
        --pkg libxml-2.0 \
        --includedir folks \
diff --git a/backends/eds/lib/edsf-persona-store.vala b/backends/eds/lib/edsf-persona-store.vala
index 0066c8b..27af5f5 100644
--- a/backends/eds/lib/edsf-persona-store.vala
+++ b/backends/eds/lib/edsf-persona-store.vala
@@ -626,21 +626,21 @@ public class Edsf.PersonaStore : Folks.PersonaStore
         }
       catch (GLib.Error e)
         {
-          if (e.domain == BookClient.error_quark ())
+          if (e is BookClientError)
             {
-              switch ((BookClientError) e.code)
+              if (e is BookClientError.CONTACT_NOT_FOUND)
                 {
-                  case BookClientError.CONTACT_NOT_FOUND:
-                    /* Not an error, since we've got nothing to do! */
-                    return;
-                  /* We don't expect to receive any of the error codes below: */
-                  case BookClientError.NO_SUCH_BOOK:
-                  case BookClientError.CONTACT_ID_ALREADY_EXISTS:
-                  case BookClientError.NO_SUCH_SOURCE:
-                  case BookClientError.NO_SPACE:
-                  default:
-                    /* Fall out */
-                    break;
+                  /* Not an error, since we've got nothing to do! */
+                  return;
+                }
+
+              /* We don't expect to receive any of the error codes below: */
+              if (e is BookClientError.NO_SUCH_BOOK ||
+                  e is BookClientError.CONTACT_ID_ALREADY_EXISTS ||
+                  e is BookClientError.NO_SUCH_SOURCE ||
+                  e is BookClientError.NO_SPACE)
+                {
+                  /* Fall out */
                 }
             }
           else if (e.domain == Client.error_quark ())
@@ -760,20 +760,17 @@ public class Edsf.PersonaStore : Folks.PersonaStore
               /* Remove the persona store on error */
               this.removed ();
 
-              if (e1.domain == BookClient.error_quark ())
+              if (e1 is BookClientError)
                 {
-                  switch ((BookClientError) e1.code)
+                  /* We don't expect to receive any of the error codes
+                   * below: */
+                  if (e1 is BookClientError.NO_SUCH_BOOK ||
+                      e1 is BookClientError.NO_SUCH_SOURCE ||
+                      e1 is BookClientError.CONTACT_NOT_FOUND ||
+                      e1 is BookClientError.CONTACT_ID_ALREADY_EXISTS ||
+                      e1 is BookClientError.NO_SPACE)
                     {
-                      /* We don't expect to receive any of the error codes
-                       * below: */
-                      case BookClientError.NO_SUCH_BOOK:
-                      case BookClientError.NO_SUCH_SOURCE:
-                      case BookClientError.CONTACT_NOT_FOUND:
-                      case BookClientError.CONTACT_ID_ALREADY_EXISTS:
-                      case BookClientError.NO_SPACE:
-                      default:
                         /* Fall out */
-                        break;
                     }
                 }
               else if (e1.domain == Client.error_quark ())
@@ -954,20 +951,17 @@ public class Edsf.PersonaStore : Folks.PersonaStore
               /* Remove the persona store on error */
               this.removed ();
 
-              if (e3.domain == BookClient.error_quark ())
+              if (e3 is BookClientError)
                 {
-                  switch ((BookClientError) e3.code)
+                  /* We don't expect to receive any of the error codes
+                   * below: */
+                  if (e3 is BookClientError.NO_SUCH_BOOK ||
+                      e3 is BookClientError.NO_SUCH_SOURCE ||
+                      e3 is BookClientError.CONTACT_NOT_FOUND ||
+                      e3 is BookClientError.CONTACT_ID_ALREADY_EXISTS ||
+                      e3 is BookClientError.NO_SPACE)
                     {
-                      /* We don't expect to receive any of the error codes
-                       * below: */
-                      case BookClientError.NO_SUCH_BOOK:
-                      case BookClientError.NO_SUCH_SOURCE:
-                      case BookClientError.CONTACT_NOT_FOUND:
-                      case BookClientError.CONTACT_ID_ALREADY_EXISTS:
-                      case BookClientError.NO_SPACE:
-                      default:
                         /* Fall out */
-                        break;
                     }
                 }
               else if (e3.domain == Client.error_quark ())
@@ -2371,19 +2365,16 @@ public class Edsf.PersonaStore : Folks.PersonaStore
   private PropertyError e_client_error_to_property_error (string property_name,
       GLib.Error error_in)
     {
-      if (error_in.domain == BookClient.error_quark ())
+      if (error_in is BookClientError)
         {
-          switch ((BookClientError) error_in.code)
+          /* We don't expect to receive any of the error codes below: */
+          if (error_in is BookClientError.CONTACT_NOT_FOUND ||
+              error_in is BookClientError.NO_SUCH_BOOK ||
+              error_in is BookClientError.CONTACT_ID_ALREADY_EXISTS ||
+              error_in is BookClientError.NO_SUCH_SOURCE ||
+              error_in is BookClientError.NO_SPACE)
             {
-              /* We don't expect to receive any of the error codes below: */
-              case BookClientError.CONTACT_NOT_FOUND:
-              case BookClientError.NO_SUCH_BOOK:
-              case BookClientError.CONTACT_ID_ALREADY_EXISTS:
-              case BookClientError.NO_SUCH_SOURCE:
-              case BookClientError.NO_SPACE:
-              default:
                 /* Fall out */
-                break;
             }
         }
       else if (error_in.domain == Client.error_quark ())
diff --git a/configure.ac b/configure.ac
index f6fe031..c29f837 100644
--- a/configure.ac
+++ b/configure.ac
@@ -177,7 +177,7 @@ VALA_REQUIRED=0.17.6
 VALADOC_REQUIRED=0.3.1
 TRACKER_SPARQL_MAJOR=0.16
 TRACKER_SPARQL_REQUIRED=0.15.2
-EBOOK_REQUIRED=3.5.3
+EBOOK_REQUIRED=3.7.90
 EDATASERVER_REQUIRED=3.5.3.1
 ZEITGEIST_REQUIRED=0.3.14
 GEE_REQUIRED=0.8.4
@@ -217,7 +217,8 @@ AS_IF([test x$enable_tracker_backend = xyes], [
 ])
 
 AS_IF([test x$enable_eds_backend = xyes], [
-        PKG_CHECK_MODULES([EBOOK], [libebook-1.2 >= $EBOOK_REQUIRED])
+        PKG_CHECK_MODULES([EBOOK], [libebook-1.2 >= $EBOOK_REQUIRED
+                                    libebook-contacts-1.2 >= $EBOOK_REQUIRED])
         PKG_CHECK_MODULES([EDATASERVER], [libedataserver-1.2 >= $EDATASERVER_REQUIRED])
 ])
 
@@ -312,7 +313,7 @@ AS_IF([test "x$enable_vala" = "xyes"], [
         ])
 
         AS_IF([test x$enable_eds_backend = xyes], [
-          VALA_CHECK_PACKAGES([libebook-1.2 libedataserver-1.2 libxml-2.0])
+          VALA_CHECK_PACKAGES([libebook-1.2 libebook-contacts-1.2 libedataserver-1.2 libxml-2.0])
         ])
 
         AS_IF([test x$enable_ofono_backend = xyes], [


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