[folks] libsocialweb: create a separate library folks-libsocialweb



commit 66a181500d3199f260a856414a9830b99815dc93
Author: Alban Crequy <alban crequy collabora co uk>
Date:   Tue Mar 29 14:18:32 2011 +0100

    libsocialweb: create a separate library folks-libsocialweb
    
    Based on initial work from:
     Thomas Thurman <thomas thurman org uk>
    Reworked by:
     Alban Crequy <alban crequy collabora co uk>

 backends/libsocialweb/Makefile.am                  |   13 ++-
 backends/libsocialweb/lib/Makefile.am              |  114 ++++++++++++++++++++
 .../lib/folks-libsocialweb-uninstalled.pc.in       |   12 ++
 backends/libsocialweb/lib/folks-libsocialweb.deps  |    4 +
 backends/libsocialweb/lib/folks-libsocialweb.pc.in |   15 +++
 .../swf-persona-store.vala}                        |    7 +-
 .../{sw-persona.vala => lib/swf-persona.vala}      |    3 +-
 backends/libsocialweb/sw-backend.vala              |    2 +-
 configure.ac                                       |    3 +
 9 files changed, 164 insertions(+), 9 deletions(-)
---
diff --git a/backends/libsocialweb/Makefile.am b/backends/libsocialweb/Makefile.am
index d0da9a7..1448e2e 100644
--- a/backends/libsocialweb/Makefile.am
+++ b/backends/libsocialweb/Makefile.am
@@ -1,12 +1,19 @@
+SUBDIRS = lib
+
+BACKEND_NAME = "libsocialweb"
+
 AM_CPPFLAGS = \
 	-I$(top_srcdir)/folks \
+	-I$(top_srcdir)/backends/libsocialweb/lib \
 	-include $(CONFIG_HEADER) \
 	-DPACKAGE_DATADIR=\"$(pkgdatadir)\" \
-	-DG_LOG_DOMAIN=\"LibSocialWebBackend\" \
+	-DBACKEND_NAME=\"$(BACKEND_NAME)\" \
+	-DG_LOG_DOMAIN=\"$(BACKEND_NAME)\" \
 	$(NULL)
 
 VALAFLAGS += \
 	--vapidir=. \
+	--vapidir=$(top_builddir)/backends/libsocialweb/lib \
 	--vapidir=$(top_srcdir)/folks \
 	$(addprefix --pkg ,$(folks_backend_libsocialweb_deps)) \
 	$(NULL)
@@ -17,12 +24,11 @@ backend_LTLIBRARIES = libfolks-backend-libsocialweb.la
 libfolks_backend_libsocialweb_la_SOURCES = \
 	sw-backend.vala \
 	sw-backend-factory.vala \
-	sw-persona-store.vala \
-	sw-persona.vala \
 	$(NULL)
 
 folks_backend_libsocialweb_deps = \
 	folks \
+        folks-libsocialweb \
 	gee-1.0 \
 	gio-2.0 \
 	gobject-2.0 \
@@ -42,6 +48,7 @@ libfolks_backend_libsocialweb_la_LIBADD = \
 	$(GEE_LIBS) \
 	$(top_builddir)/folks/libfolks.la \
 	$(SW_CLIENT_LIBS) \
+	lib/libfolks-libsocialweb.la \
 	$(NULL)
 
 libfolks_backend_libsocialweb_la_LDFLAGS = -shared -fPIC -module -avoid-version
diff --git a/backends/libsocialweb/lib/Makefile.am b/backends/libsocialweb/lib/Makefile.am
new file mode 100644
index 0000000..b0859a8
--- /dev/null
+++ b/backends/libsocialweb/lib/Makefile.am
@@ -0,0 +1,114 @@
+BACKEND_NAME = "libsocialweb"
+
+AM_CPPFLAGS = \
+	-I$(top_srcdir)/folks \
+	-include $(CONFIG_HEADER) \
+	-DPACKAGE_DATADIR=\"$(pkgdatadir)\" \
+	-DBACKEND_NAME=\"$(BACKEND_NAME)\" \
+	-DG_LOG_DOMAIN=\"$(BACKEND_NAME)\" \
+	$(NULL)
+
+VAPIGENFLAGS += \
+	--vapidir=. \
+	--vapidir=$(top_srcdir)/folks \
+	$(NULL)
+
+folks_libsocialwebdir = $(libdir)
+folks_libsocialweb_LTLIBRARIES = libfolks-libsocialweb.la
+
+CLEANFILES =
+
+##################################################################
+# Support library
+##################################################################
+
+pkgconfig_in = folks-libsocialweb.pc.in
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = $(pkgconfig_in:.in=)
+
+libfolks_libsocialweb_la_vala.stamp:
+
+folks_libsocialweb_valasources = \
+	swf-persona.vala \
+	swf-persona-store.vala \
+	$(NULL)
+
+libfolks_libsocialweb_la_SOURCES = \
+	$(folks_libsocialweb_valasources) \
+	$(NULL)
+
+libfolks_libsocialweb_la_VALAFLAGS = \
+        --vapidir=. \
+        --vapidir=$(top_srcdir)/folks \
+        --pkg folks \
+        --pkg gobject-2.0 \
+        --pkg gio-2.0 \
+        --pkg gee-1.0 \
+        --pkg dbus-glib-1 \
+        --pkg libsocialweb-client \
+        --vapi folks-libsocialweb.vapi \
+        -H folks-libsocialweb.h \
+        $(NULL)
+
+folks_backend_libsocialweb_deps = \
+	folks \
+	gee-1.0 \
+	gio-2.0 \
+	gobject-2.0 \
+	libsocialweb-client \
+	$(NULL)
+
+libfolks_libsocialweb_la_CFLAGS = \
+	$(GIO_CFLAGS) \
+	$(GLIB_CFLAGS) \
+	$(GEE_CFLAGS) \
+	$(SW_CLIENT_CFLAGS) \
+	$(NULL)
+
+libfolks_libsocialweb_la_LIBADD = \
+	$(GIO_LIBS) \
+	$(GLIB_LIBS) \
+	$(GEE_LIBS) \
+	$(top_builddir)/folks/libfolks.la \
+	$(SW_CLIENT_LIBS) \
+	$(NULL)
+
+
+libfolks_libsocialweb_la_LDFLAGS = \
+	-version-info "$(LT_CURRENT)":"$(LT_REVISION)":"$(LT_AGE)" \
+        -export-symbols-regex "^swf_.*" \
+	$(NULL)
+
+folks_libsocialweb_includedir = $(includedir)/folks
+folks_libsocialweb_include_HEADERS = \
+	folks-libsocialweb.h \
+	$(NULL)
+
+vapidir = $(datadir)/vala/vapi
+dist_vapi_DATA = \
+	folks-libsocialweb.vapi \
+	folks-libsocialweb.deps \
+	$(NULL)
+
+##################################################################
+# General
+##################################################################
+
+CLEANFILES += \
+	$(pkgconfig_in:.in=) \
+	folks-libsocialweb-uninstalled.pc \
+	$(NULL)
+
+MAINTAINERCLEANFILES = \
+	$(folks_libsocialweb_valasources:.vala=.c) \
+	libfolks_libsocialweb_la_vala.stamp \
+	folks-libsocialweb.h \
+	folks-libsocialweb.vapi \
+	$(NULL)
+
+EXTRA_DIST = \
+	$(pkgconfig_in) \
+	$(MAINTAINERCLEANFILES) \
+	$(NULL)
+
+-include $(top_srcdir)/git.mk
diff --git a/backends/libsocialweb/lib/folks-libsocialweb-uninstalled.pc.in b/backends/libsocialweb/lib/folks-libsocialweb-uninstalled.pc.in
new file mode 100644
index 0000000..60af3f3
--- /dev/null
+++ b/backends/libsocialweb/lib/folks-libsocialweb-uninstalled.pc.in
@@ -0,0 +1,12 @@
+prefix=
+exec_prefix=
+abs_top_srcdir= abs_top_srcdir@
+abs_top_builddir= abs_top_builddir@
+vapidir= abs_top_srcdir@/folks
+
+Name: Folks Libsocialweb support library (uninstalled copy)
+Description: Libsocialweb support library for the Folks meta-contacts library
+Version: @VERSION@
+Requires: folks glib-2.0 gobject-2.0 gee-1.0 libsocialweb-client
+Libs: ${abs_top_builddir}/backends/telepathy/libfolks-libsocialweb.la
+Cflags: -I${abs_top_srcdir} -I${abs_top_srcdir}/backends/libsocialweb -I${abs_top_builddir}
diff --git a/backends/libsocialweb/lib/folks-libsocialweb.deps b/backends/libsocialweb/lib/folks-libsocialweb.deps
new file mode 100644
index 0000000..a61e5c8
--- /dev/null
+++ b/backends/libsocialweb/lib/folks-libsocialweb.deps
@@ -0,0 +1,4 @@
+glib-2.0
+gobject-2.0
+folks
+libsocialweb-client
diff --git a/backends/libsocialweb/lib/folks-libsocialweb.pc.in b/backends/libsocialweb/lib/folks-libsocialweb.pc.in
new file mode 100644
index 0000000..6e43b5c
--- /dev/null
+++ b/backends/libsocialweb/lib/folks-libsocialweb.pc.in
@@ -0,0 +1,15 @@
+prefix= prefix@
+exec_prefix= exec_prefix@
+libdir= libdir@
+bindir= bindir@
+includedir= includedir@
+datarootdir= datarootdir@
+datadir= datadir@
+vapidir= datadir@/vala/vapi
+
+Name: Folks libsocialweb support library
+Description: Libsocialweb support library for the Folks meta-contacts library
+Version: @VERSION@
+Requires: folks glib-2.0 gobject-2.0 gee-1.0 libsocialweb-client
+Libs: -L${libdir} -lfolks-libsocialweb
+Cflags: -I${includedir} -I${includedir}/folks
diff --git a/backends/libsocialweb/sw-persona-store.vala b/backends/libsocialweb/lib/swf-persona-store.vala
similarity index 97%
rename from backends/libsocialweb/sw-persona-store.vala
rename to backends/libsocialweb/lib/swf-persona-store.vala
index c0c8f6f..956bbb5 100644
--- a/backends/libsocialweb/sw-persona-store.vala
+++ b/backends/libsocialweb/lib/swf-persona-store.vala
@@ -24,12 +24,14 @@ using GLib;
 using Folks;
 using SocialWebClient;
 
+extern const string BACKEND_NAME;
+
 /**
  * A persona store which is associated with a single libsocialweb service.
  * It will create { link Persona}s for each of the contacts known to that
  * service.
  */
-public class Folks.Backends.Sw.PersonaStore : Folks.PersonaStore
+public class Swf.PersonaStore : Folks.PersonaStore
 {
   private HashTable<string, Persona> _personas;
   private bool _is_prepared = false;
@@ -41,7 +43,7 @@ public class Folks.Backends.Sw.PersonaStore : Folks.PersonaStore
    *
    * See { link Folks.PersonaStore.type_id}.
    */
-  public override string type_id { get { return "libsocialweb"; } }
+  public override string type_id { get { return BACKEND_NAME; } }
 
   /**
    * Whether this PersonaStore can add { link Folks.Persona}s.
@@ -230,5 +232,4 @@ public class Folks.Backends.Sw.PersonaStore : Folks.PersonaStore
       if (removed_personas.length > 0)
         this.personas_changed (null, removed_personas.head, null, null, 0);
     }
-
 }
diff --git a/backends/libsocialweb/sw-persona.vala b/backends/libsocialweb/lib/swf-persona.vala
similarity index 98%
rename from backends/libsocialweb/sw-persona.vala
rename to backends/libsocialweb/lib/swf-persona.vala
index d3d0eaf..bb03a7a 100644
--- a/backends/libsocialweb/sw-persona.vala
+++ b/backends/libsocialweb/lib/swf-persona.vala
@@ -26,7 +26,7 @@ using SocialWebClient;
 /**
  * A persona subclass which represents a single libsocialweb contact.
  */
-internal class Folks.Backends.Sw.Persona : Folks.Persona,
+public class Swf.Persona : Folks.Persona,
     AvatarDetails,
     GenderDetails,
     ImDetails,
@@ -132,7 +132,6 @@ internal class Folks.Backends.Sw.Persona : Folks.Persona,
               uid: uid,
               iid: iid,
               store: store,
-              gender: Gender.UNSPECIFIED,
               is_user: false);
 
       debug ("Creating new Sw.Persona '%s' for %s UID '%s': %p",
diff --git a/backends/libsocialweb/sw-backend.vala b/backends/libsocialweb/sw-backend.vala
index 739cb2c..98931fe 100644
--- a/backends/libsocialweb/sw-backend.vala
+++ b/backends/libsocialweb/sw-backend.vala
@@ -116,7 +116,7 @@ public class Folks.Backends.Sw.Backend : Folks.Backend
       if (this._persona_stores.lookup (service_name) != null)
         return;
 
-      var store = new PersonaStore (this._client.get_service (service_name));
+      var store = new Swf.PersonaStore (this._client.get_service (service_name));
       this._persona_stores.insert (store.id, store);
       store.removed.connect (this.store_removed_cb);
       this.persona_store_added (store);
diff --git a/configure.ac b/configure.ac
index 5ad65c3..8199bf2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -367,6 +367,9 @@ AC_CONFIG_FILES([
     backends/Makefile
     backends/key-file/Makefile
     backends/libsocialweb/Makefile
+    backends/libsocialweb/lib/Makefile
+    backends/libsocialweb/lib/folks-libsocialweb.pc
+    backends/libsocialweb/lib/folks-libsocialweb-uninstalled.pc
     backends/telepathy/Makefile
     backends/telepathy/lib/Makefile
     backends/tracker/Makefile



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