[evolution-data-server] Adapt EBookBackendVCF to libedata-book changes.



commit 368192d1e0638a2e7bbc1819aa117a069ee6a57a
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Sep 9 13:19:31 2011 -0400

    Adapt EBookBackendVCF to libedata-book changes.

 .../backends/vcf/e-book-backend-vcf-factory.c      |   49 ++++++++++++++------
 addressbook/backends/vcf/e-book-backend-vcf.c      |   27 ++++------
 addressbook/backends/vcf/e-book-backend-vcf.h      |   49 +++++++++++++------
 3 files changed, 79 insertions(+), 46 deletions(-)
---
diff --git a/addressbook/backends/vcf/e-book-backend-vcf-factory.c b/addressbook/backends/vcf/e-book-backend-vcf-factory.c
index ec95587..d041e86 100644
--- a/addressbook/backends/vcf/e-book-backend-vcf-factory.c
+++ b/addressbook/backends/vcf/e-book-backend-vcf-factory.c
@@ -25,30 +25,51 @@
 #include <config.h>
 #endif
 
-#include "libebackend/e-data-server-module.h"
-#include "libedata-book/e-book-backend-factory.h"
+#include <libedata-book/e-book-backend-factory.h>
 #include "e-book-backend-vcf.h"
 
-E_BOOK_BACKEND_FACTORY_SIMPLE (vcf, VCF, e_book_backend_vcf_new)
+#define FACTORY_NAME "vcf"
 
-static GType vcf_type;
+typedef EBookBackendFactory EBookBackendVCFFactory;
+typedef EBookBackendFactoryClass EBookBackendVCFFactoryClass;
 
-void
-eds_module_initialize (GTypeModule *type_module)
+/* Module Entry Points */
+void e_module_load (GTypeModule *type_module);
+void e_module_unload (GTypeModule *type_module);
+
+/* Forward Declarations */
+GType e_book_backend_vcf_factory_get_type (void);
+
+G_DEFINE_DYNAMIC_TYPE (
+	EBookBackendVCFFactory,
+	e_book_backend_vcf_factory,
+	E_TYPE_BOOK_BACKEND_FACTORY)
+
+static void
+e_book_backend_vcf_factory_class_init (EBookBackendFactoryClass *class)
+{
+	class->factory_name = FACTORY_NAME;
+	class->backend_type = E_TYPE_BOOK_BACKEND_VCF;
+}
+
+static void
+e_book_backend_vcf_factory_class_finalize (EBookBackendFactoryClass *class)
+{
+}
+
+static void
+e_book_backend_vcf_factory_init (EBookBackendFactory *factory)
 {
-	vcf_type = _vcf_factory_get_type (type_module);
 }
 
-void
-eds_module_shutdown (void)
+G_MODULE_EXPORT void
+e_module_load (GTypeModule *type_module)
 {
+	e_book_backend_vcf_factory_register_type (type_module);
 }
 
-void
-eds_module_list_types (const GType **types,
-                       gint *num_types)
+G_MODULE_EXPORT void
+e_module_unload (GTypeModule *type_module)
 {
-	*types = & vcf_type;
-	*num_types = 1;
 }
 
diff --git a/addressbook/backends/vcf/e-book-backend-vcf.c b/addressbook/backends/vcf/e-book-backend-vcf.c
index e4cf253..ff92b8c 100644
--- a/addressbook/backends/vcf/e-book-backend-vcf.c
+++ b/addressbook/backends/vcf/e-book-backend-vcf.c
@@ -563,12 +563,13 @@ e_book_backend_vcf_open (EBookBackendSync *backend,
                          GError **perror)
 {
 	EBookBackendVCF *bvcf = E_BOOK_BACKEND_VCF (backend);
-	ESource *source = e_book_backend_get_source (E_BOOK_BACKEND (backend));
-	gchar           *dirname;
-	gboolean        readonly = TRUE;
-	gchar          *uri;
+	ESource *source;
+	gchar *dirname;
+	gboolean readonly = TRUE;
+	gchar *uri;
 	gint fd;
 
+	source = e_backend_get_source (E_BACKEND (backend));
 	uri = e_source_get_uri (source);
 
 	dirname = e_book_backend_vcf_extract_path_from_uri (uri);
@@ -675,22 +676,13 @@ e_book_backend_vcf_get_backend_property (EBookBackendSync *backend,
 }
 
 static void
-e_book_backend_vcf_set_online (EBookBackend *backend,
-                               gboolean is_online)
+e_book_backend_vcf_notify_online_cb (EBookBackend *backend,
+                                     GParamSpec *pspec)
 {
 	if (e_book_backend_is_opened (backend))
 		e_book_backend_notify_online (backend, TRUE);
 }
 
-/**
- * e_book_backend_vcf_new:
- */
-EBookBackend *
-e_book_backend_vcf_new (void)
-{
-	return g_object_new (E_TYPE_BOOK_BACKEND_VCF, NULL);
-}
-
 static void
 e_book_backend_vcf_dispose (GObject *object)
 {
@@ -740,7 +732,6 @@ e_book_backend_vcf_class_init (EBookBackendVCFClass *klass)
 	/* Set the virtual methods. */
 	backend_class->start_book_view		= e_book_backend_vcf_start_book_view;
 	backend_class->stop_book_view		= e_book_backend_vcf_stop_book_view;
-	backend_class->set_online		= e_book_backend_vcf_set_online;
 
 	sync_class->open_sync			= e_book_backend_vcf_open;
 	sync_class->get_backend_property_sync	= e_book_backend_vcf_get_backend_property;
@@ -763,4 +754,8 @@ e_book_backend_vcf_init (EBookBackendVCF *backend)
 	priv->mutex = g_mutex_new ();
 
 	backend->priv = priv;
+
+	g_signal_connect (
+		backend, "notify::online",
+		G_CALLBACK (e_book_backend_vcf_notify_online_cb), NULL);
 }
diff --git a/addressbook/backends/vcf/e-book-backend-vcf.h b/addressbook/backends/vcf/e-book-backend-vcf.h
index 5ca067a..6ee104b 100644
--- a/addressbook/backends/vcf/e-book-backend-vcf.h
+++ b/addressbook/backends/vcf/e-book-backend-vcf.h
@@ -21,31 +21,48 @@
  * Authors: Chris Toshok <toshok ximian com>
  */
 
-#ifndef __E_BOOK_BACKEND_VCF_H__
-#define __E_BOOK_BACKEND_VCF_H__
+#ifndef E_BOOK_BACKEND_VCF_H
+#define E_BOOK_BACKEND_VCF_H
 
 #include <libedata-book/e-book-backend-sync.h>
 
-#define E_TYPE_BOOK_BACKEND_VCF         (e_book_backend_vcf_get_type ())
-#define E_BOOK_BACKEND_VCF(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TYPE_BOOK_BACKEND_VCF, EBookBackendVCF))
-#define E_BOOK_BACKEND_VCF_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), E_TYPE_BOOK_BACKEND_VCF, EBookBackendVCFClass))
-#define E_IS_BOOK_BACKEND_VCF(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TYPE_BOOK_BACKEND_VCF))
-#define E_IS_BOOK_BACKEND_VCF_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), E_TYPE_BOOK_BACKEND_VCF))
-#define E_BOOK_BACKEND_VCF_GET_CLASS(k) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TYPE_BOOK_BACKEND_VCF, EBookBackendVCFClass))
+/* Standard GObject macros */
+#define E_TYPE_BOOK_BACKEND_VCF \
+	(e_book_backend_vcf_get_type ())
+#define E_BOOK_BACKEND_VCF(obj) \
+	(G_TYPE_CHECK_INSTANCE_CAST \
+	((obj), E_TYPE_BOOK_BACKEND_VCF, EBookBackendVCF))
+#define E_BOOK_BACKEND_VCF_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_CAST \
+	((cls), E_TYPE_BOOK_BACKEND_VCF, EBookBackendVCFClass))
+#define E_IS_BOOK_BACKEND_VCF(obj) \
+	(G_TYPE_CHECK_INSTANCE_TYPE \
+	((obj), E_TYPE_BOOK_BACKEND_VCF))
+#define E_IS_BOOK_BACKEND_VCF_CLASS(cls) \
+	(G_TYPE_CHECK_CLASS_TYPE \
+	((cls), E_TYPE_BOOK_BACKEND_VCF))
+#define E_BOOK_BACKEND_VCF_GET_CLASS(obj) \
+	(G_TYPE_INSTANCE_GET_CLASS \
+	((obj), E_TYPE_BOOK_BACKEND_VCF, EBookBackendVCFClass))
 
+G_BEGIN_DECLS
+
+typedef struct _EBookBackendVCF EBookBackendVCF;
+typedef struct _EBookBackendVCFClass EBookBackendVCFClass;
 typedef struct _EBookBackendVCFPrivate EBookBackendVCFPrivate;
 
-typedef struct {
-	EBookBackendSync         parent_object;
+struct _EBookBackendVCF {
+	EBookBackendSync parent;
 	EBookBackendVCFPrivate *priv;
-} EBookBackendVCF;
+};
 
-typedef struct {
+struct _EBookBackendVCFClass {
 	EBookBackendSyncClass parent_class;
-} EBookBackendVCFClass;
+};
+
+GType		e_book_backend_vcf_get_type	(void);
 
-EBookBackend *e_book_backend_vcf_new      (void);
-GType       e_book_backend_vcf_get_type (void);
+G_END_DECLS
 
-#endif /* __E_BOOK_BACKEND_VCF_H__ */
+#endif /* E_BOOK_BACKEND_VCF_H */
 



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