[evolution-data-server/openismus-work] Migrated EBookClientError back into libebook-contacts



commit f09230965f1aa592e4fe60ade9206d8fb765d6f0
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Mon Feb 18 20:21:40 2013 +0900

    Migrated EBookClientError back into libebook-contacts
    
    This should be a more similar API to EDS master where EBookClientError
    resides in libebook-contacts, also it fixes the libfolks build for some
    reason.

 addressbook/libebook-contacts/Makefile.am          |    1 +
 .../libebook-contacts/e-book-contacts-types.c      |   66 ++++++++++++++++++++
 .../libebook-contacts/e-book-contacts-types.h      |   29 ++++++++-
 addressbook/libebook/e-book-client.c               |   57 -----------------
 addressbook/libebook/e-book-client.h               |   29 ---------
 5 files changed, 95 insertions(+), 87 deletions(-)
---
diff --git a/addressbook/libebook-contacts/Makefile.am b/addressbook/libebook-contacts/Makefile.am
index ef2f2fd..876e50d 100644
--- a/addressbook/libebook-contacts/Makefile.am
+++ b/addressbook/libebook-contacts/Makefile.am
@@ -35,6 +35,7 @@ libebook_contacts_1_2_la_CPPFLAGS = \
 libebook_contacts_1_2_la_SOURCES =                             \
        $(ENUM_GENERATED)                               \
        $(MARSHAL_GENERATED)                            \
+       e-book-contacts-types.c                         \
        e-address-western.c                             \
        e-name-western.c                                \
        e-name-western-tables.h                         \
diff --git a/addressbook/libebook-contacts/e-book-contacts-types.c 
b/addressbook/libebook-contacts/e-book-contacts-types.c
new file mode 100644
index 0000000..e7f87bf
--- /dev/null
+++ b/addressbook/libebook-contacts/e-book-contacts-types.c
@@ -0,0 +1,66 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n-lib.h>
+
+#include "e-book-contacts-types.h"
+
+GQuark
+e_book_client_error_quark (void)
+{
+       static GQuark q = 0;
+       if (q == 0)
+               q = g_quark_from_static_string ("e-book-client-error-quark");
+
+       return q;
+}
+
+/**
+ * e_book_client_error_to_string:
+ *
+ * FIXME: Document me.
+ *
+ * Since: 3.2
+ **/
+const gchar *
+e_book_client_error_to_string (EBookClientError code)
+{
+       switch (code) {
+       case E_BOOK_CLIENT_ERROR_NO_SUCH_BOOK:
+               return _("No such book");
+       case E_BOOK_CLIENT_ERROR_CONTACT_NOT_FOUND:
+               return _("Contact not found");
+       case E_BOOK_CLIENT_ERROR_CONTACT_ID_ALREADY_EXISTS:
+               return _("Contact ID already exists");
+       case E_BOOK_CLIENT_ERROR_NO_SUCH_SOURCE:
+               return _("No such source");
+       case E_BOOK_CLIENT_ERROR_NO_SPACE:
+               return _("No space");
+       }
+
+       return _("Unknown error");
+}
+
+/**
+ * e_book_client_error_create:
+ * @code: an #EBookClientError code to create
+ * @custom_msg: custom message to use for the error; can be %NULL
+ *
+ * Returns: a new #GError containing an E_BOOK_CLIENT_ERROR of the given
+ * @code. If the @custom_msg is NULL, then the error message is
+ * the one returned from e_book_client_error_to_string() for the @code,
+ * otherwise the given message is used.
+ *
+ * Returned pointer should be freed with g_error_free().
+ *
+ * Since: 3.2
+ *
+ * Deprecated: 3.8: Just use the #GError API directly.
+ **/
+GError *
+e_book_client_error_create (EBookClientError code,
+                            const gchar *custom_msg)
+{
+       return g_error_new_literal (E_BOOK_CLIENT_ERROR, code, custom_msg ? custom_msg : 
e_book_client_error_to_string (code));
+}
diff --git a/addressbook/libebook-contacts/e-book-contacts-types.h 
b/addressbook/libebook-contacts/e-book-contacts-types.h
index 0af574e..39dae00 100644
--- a/addressbook/libebook-contacts/e-book-contacts-types.h
+++ b/addressbook/libebook-contacts/e-book-contacts-types.h
@@ -18,8 +18,16 @@
 
 #include <libebook-contacts/e-contact.h>
 
-G_BEGIN_DECLS
+/**
+ * E_BOOK_CLIENT_ERROR:
+ *
+ * FIXME: Document me.
+ *
+ * Since: 3.2
+ **/
+#define E_BOOK_CLIENT_ERROR e_book_client_error_quark ()
 
+G_BEGIN_DECLS
 
 /**
  * EBookClientViewFlags:
@@ -113,6 +121,25 @@ typedef enum {
        E_BOOK_INDEX_PHONE,
 } EBookIndexType;
 
+/**
+ * EBookClientError:
+ *
+ * FIXME: Document me.
+ *
+ * Since: 3.2
+ **/
+typedef enum {
+       E_BOOK_CLIENT_ERROR_NO_SUCH_BOOK,
+       E_BOOK_CLIENT_ERROR_CONTACT_NOT_FOUND,
+       E_BOOK_CLIENT_ERROR_CONTACT_ID_ALREADY_EXISTS,
+       E_BOOK_CLIENT_ERROR_NO_SUCH_SOURCE,
+       E_BOOK_CLIENT_ERROR_NO_SPACE
+} EBookClientError;
+
+GQuark          e_book_client_error_quark (void) G_GNUC_CONST;
+const gchar *  e_book_client_error_to_string (EBookClientError code);
+GError *       e_book_client_error_create (EBookClientError code, const gchar *custom_msg);
+
 G_END_DECLS
 
 #endif /* __E_BOOK_CONTACTS_TYPES_H__ */
diff --git a/addressbook/libebook/e-book-client.c b/addressbook/libebook/e-book-client.c
index 33bb088..a5d709c 100644
--- a/addressbook/libebook/e-book-client.c
+++ b/addressbook/libebook/e-book-client.c
@@ -74,63 +74,6 @@ G_DEFINE_TYPE (EBookClient, e_book_client, E_TYPE_CLIENT)
  *   @CLIENT_BACKEND_PROPERTY_CACHE_DIR, @CLIENT_BACKEND_PROPERTY_CAPABILITIES
  */
 
-GQuark
-e_book_client_error_quark (void)
-{
-       static GQuark q = 0;
-       if (q == 0)
-               q = g_quark_from_static_string ("e-book-client-error-quark");
-
-       return q;
-}
-
-/**
- * e_book_client_error_to_string:
- *
- * FIXME: Document me.
- *
- * Since: 3.2
- **/
-const gchar *
-e_book_client_error_to_string (EBookClientError code)
-{
-       switch (code) {
-       case E_BOOK_CLIENT_ERROR_NO_SUCH_BOOK:
-               return _("No such book");
-       case E_BOOK_CLIENT_ERROR_CONTACT_NOT_FOUND:
-               return _("Contact not found");
-       case E_BOOK_CLIENT_ERROR_CONTACT_ID_ALREADY_EXISTS:
-               return _("Contact ID already exists");
-       case E_BOOK_CLIENT_ERROR_NO_SUCH_SOURCE:
-               return _("No such source");
-       case E_BOOK_CLIENT_ERROR_NO_SPACE:
-               return _("No space");
-       }
-
-       return _("Unknown error");
-}
-
-/**
- * e_book_client_error_create:
- * @code: an #EBookClientError code to create
- * @custom_msg: custom message to use for the error; can be %NULL
- *
- * Returns: a new #GError containing an E_BOOK_CLIENT_ERROR of the given
- * @code. If the @custom_msg is NULL, then the error message is
- * the one returned from e_book_client_error_to_string() for the @code,
- * otherwise the given message is used.
- *
- * Returned pointer should be freed with g_error_free().
- *
- * Since: 3.2
- **/
-GError *
-e_book_client_error_create (EBookClientError code,
-                            const gchar *custom_msg)
-{
-       return g_error_new_literal (E_BOOK_CLIENT_ERROR, code, custom_msg ? custom_msg : 
e_book_client_error_to_string (code));
-}
-
 /*
  * If the specified GError is a remote error, then create a new error
  * representing the remote error.  If the error is anything else, then
diff --git a/addressbook/libebook/e-book-client.h b/addressbook/libebook/e-book-client.h
index 12cc404..985cf5d 100644
--- a/addressbook/libebook/e-book-client.h
+++ b/addressbook/libebook/e-book-client.h
@@ -67,35 +67,6 @@ G_BEGIN_DECLS
  **/
 #define BOOK_BACKEND_PROPERTY_SUPPORTED_AUTH_METHODS   "supported-auth-methods"
 
-/**
- * E_BOOK_CLIENT_ERROR:
- *
- * FIXME: Document me.
- *
- * Since: 3.2
- **/
-#define E_BOOK_CLIENT_ERROR e_book_client_error_quark ()
-
-GQuark e_book_client_error_quark (void) G_GNUC_CONST;
-
-/**
- * EBookClientError:
- *
- * FIXME: Document me.
- *
- * Since: 3.2
- **/
-typedef enum {
-       E_BOOK_CLIENT_ERROR_NO_SUCH_BOOK,
-       E_BOOK_CLIENT_ERROR_CONTACT_NOT_FOUND,
-       E_BOOK_CLIENT_ERROR_CONTACT_ID_ALREADY_EXISTS,
-       E_BOOK_CLIENT_ERROR_NO_SUCH_SOURCE,
-       E_BOOK_CLIENT_ERROR_NO_SPACE
-} EBookClientError;
-
-const gchar *  e_book_client_error_to_string (EBookClientError code);
-GError *       e_book_client_error_create (EBookClientError code, const gchar *custom_msg);
-
 typedef struct _EBookClient        EBookClient;
 typedef struct _EBookClientClass   EBookClientClass;
 typedef struct _EBookClientPrivate EBookClientPrivate;


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