[empathy] Make GOA optional again



commit 7c0dff773920a0796e079d5c79165a12fc7e8ddd
Author: Danielle Madeley <danielle madeley collabora co uk>
Date:   Mon Nov 7 12:03:50 2011 +1100

    Make GOA optional again
    
    There is an --disable-goa flag in Empathy's configure, which should be able to
    disable GOA, except it had been included as a required dependency. This patch
    makes it completely optional again.
    
    Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=663442

 configure.ac                      |    7 +++-
 libempathy/Makefile.am            |   59 +++++++++++++++++++++++--------------
 libempathy/empathy-auth-factory.c |   18 ++++++++++-
 3 files changed, 59 insertions(+), 25 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index c3a8dc6..a5050f7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -201,7 +201,6 @@ PKG_CHECK_MODULES(EMPATHY,
    libpulse-mainloop-glib
    webkitgtk-3.0 >= $WEBKIT_REQUIRED
    libsoup-2.4
-   goa-1.0 >= $GOA_REQUIRED
 ])
 
 PKG_CHECK_MODULES(YELL, [telepathy-yell])
@@ -600,7 +599,7 @@ if test "x$enable_goa" != "xno"; then
    PKG_CHECK_MODULES(GOA,
     [
        mission-control-plugins
-       goa-1.0
+       goa-1.0 >= $GOA_REQUIRED
     ], have_goa="yes", have_goa="no")
 
    AC_MSG_CHECKING([Mission Control plugins dir])
@@ -616,6 +615,10 @@ if test "x$enable_goa" = "xyes" -a "x$have_goa" != "xyes"; then
    AC_MSG_ERROR([Could not find GOA dependencies.])
 fi
 
+if test "x$have_goa" = "xyes"; then
+   AC_DEFINE(HAVE_GOA, 1, [Define to 1 to enable GNOME Online Accounts])
+fi
+
 AM_CONDITIONAL(HAVE_GOA, test "x$have_goa" = "xyes")
 
 # Optional dependency for avatar selection
diff --git a/libempathy/Makefile.am b/libempathy/Makefile.am
index 0662f2c..1f4bdbc 100644
--- a/libempathy/Makefile.am
+++ b/libempathy/Makefile.am
@@ -16,6 +16,7 @@ AM_CPPFLAGS =                                           \
 	$(NETWORK_MANAGER_CFLAGS)			\
 	$(CONNMAN_CFLAGS)				\
 	$(UDEV_CFLAGS)					\
+	$(GOA_CFLAGS)					\
 	$(WARN_CFLAGS)					\
 	$(DISABLE_DEPRECATED)
 
@@ -29,7 +30,6 @@ libempathy_headers =				\
 	action-chain-internal.h			\
 	empathy-account-settings.h		\
 	empathy-auth-factory.h			\
-	empathy-goa-auth-handler.h		\
 	empathy-camera-monitor.h		\
 	empathy-chatroom-manager.h		\
 	empathy-chatroom.h			\
@@ -73,7 +73,6 @@ libempathy_handwritten_source =				\
 	action-chain.c					\
 	empathy-account-settings.c			\
 	empathy-auth-factory.c				\
-	empathy-goa-auth-handler.c			\
 	empathy-camera-monitor.c			\
 	empathy-chatroom-manager.c			\
 	empathy-chatroom.c				\
@@ -109,10 +108,41 @@ libempathy_handwritten_source =				\
 	empathy-tp-streamed-media.c			\
 	empathy-utils.c
 
+# these are sources that depend on GOA
+goa_sources = \
+	empathy-goa-auth-handler.c \
+	empathy-goa-auth-handler.h \
+	$(NULL)
+
 libempathy_la_SOURCES = \
 	$(libempathy_handwritten_source) \
 	cheese-camera-device-monitor.c cheese-camera-device-monitor.h
 
+dtddir = $(datadir)/empathy
+dtd_DATA = 					\
+	empathy-status-presets.dtd		\
+	empathy-contact-groups.dtd		\
+	empathy-chatroom-manager.dtd		\
+	empathy-irc-networks.dtd
+
+ircnetworksdir = $(datadir)/empathy
+ircnetworks_DATA =		\
+	irc-networks.xml
+
+EXTRA_DIST = 			\
+	$(dtd_DATA)		\
+	$(ircnetworks_DATA)
+
+CLEANFILES = 				\
+	$(BUILT_SOURCES)		\
+	stamp-empathy-enum-types.h
+
+if HAVE_GOA
+libempathy_la_SOURCES += $(goa_sources)
+else
+EXTRA_DIST += $(goa_sources)
+endif
+
 # do not distribute generated files
 nodist_libempathy_la_SOURCES =\
 	$(BUILT_SOURCES)
@@ -127,10 +157,14 @@ libempathy_la_LIBADD =		\
 	$(NETWORK_MANAGER_LIBS) \
 	$(CONNMAN_LIBS) \
 	$(UDEV_LIBS) \
+	$(GOA_LIBS) \
 	$(LIBM)
 
 check_c_sources = \
-    $(libempathy_handwritten_source)
+    $(libempathy_handwritten_source) \
+    $(goa_sources) \
+    $(NULL)
+
 include $(top_srcdir)/tools/check-coding-style.mk
 check-local: check-coding-style
 
@@ -171,22 +205,3 @@ empathy-enum-types.c: $(libempathy_headers) Makefile
 		$(libempathy_headers) ) > xgen-gtc \
 	&& cp xgen-gtc $(@F) \
 	&& rm -f xgen-gtc
-
-dtddir = $(datadir)/empathy
-dtd_DATA = 					\
-	empathy-status-presets.dtd		\
-	empathy-contact-groups.dtd		\
-	empathy-chatroom-manager.dtd		\
-	empathy-irc-networks.dtd
-
-ircnetworksdir = $(datadir)/empathy
-ircnetworks_DATA =		\
-	irc-networks.xml
-
-EXTRA_DIST = 			\
-	$(dtd_DATA)		\
-	$(ircnetworks_DATA)
-
-CLEANFILES = 				\
-	$(BUILT_SOURCES)		\
-	stamp-empathy-enum-types.h
diff --git a/libempathy/empathy-auth-factory.c b/libempathy/empathy-auth-factory.c
index 03f2cd1..d88e9bf 100644
--- a/libempathy/empathy-auth-factory.c
+++ b/libempathy/empathy-auth-factory.c
@@ -18,6 +18,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <config.h>
+
 #include "empathy-auth-factory.h"
 
 #include <telepathy-glib/telepathy-glib.h>
@@ -27,9 +29,12 @@
 #include "empathy-keyring.h"
 #include "empathy-server-sasl-handler.h"
 #include "empathy-server-tls-handler.h"
-#include "empathy-goa-auth-handler.h"
 #include "empathy-utils.h"
 
+#ifdef HAVE_GOA
+#include "empathy-goa-auth-handler.h"
+#endif /* HAVE_GOA */
+
 #include "extensions/extensions.h"
 
 G_DEFINE_TYPE (EmpathyAuthFactory, empathy_auth_factory, TP_TYPE_BASE_CLIENT);
@@ -43,7 +48,10 @@ struct _EmpathyAuthFactoryPriv {
    * reffed (EmpathyServerSASLHandler *)
    * */
   GHashTable *sasl_handlers;
+
+#ifdef HAVE_GOA
   EmpathyGoaAuthHandler *goa_handler;
+#endif /* HAVE_GOA */
 
   gboolean dispose_run;
 };
@@ -391,6 +399,7 @@ get_password_cb (GObject *source,
     }
 }
 
+#ifdef HAVE_GOA
 static void
 goa_claim_cb (GObject *source,
     GAsyncResult *result,
@@ -414,6 +423,7 @@ goa_claim_cb (GObject *source,
 
   observe_channels_data_free (data);
 }
+#endif /* HAVE_GOA */
 
 static void
 observe_channels (TpBaseClient *client,
@@ -449,6 +459,7 @@ observe_channels (TpBaseClient *client,
   data->account = g_object_ref (account);
   data->channel = g_object_ref (channel);
 
+#ifdef HAVE_GOA
   /* GOA auth? */
   if (empathy_goa_auth_handler_supports (self->priv->goa_handler, channel, account))
     {
@@ -460,6 +471,7 @@ observe_channels (TpBaseClient *client,
       tp_observe_channels_context_accept (context);
       return;
     }
+#endif /* HAVE_GOA */
 
   /* Password auth? */
   if (empathy_sasl_channel_supports_mechanism (data->channel,
@@ -511,7 +523,9 @@ empathy_auth_factory_init (EmpathyAuthFactory *self)
 
   self->priv->sasl_handlers = g_hash_table_new_full (g_str_hash, g_str_equal,
       NULL, g_object_unref);
+#ifdef HAVE_GOA
   self->priv->goa_handler = empathy_goa_auth_handler_new ();
+#endif /* HAVE_GOA */
 }
 
 static void
@@ -573,7 +587,9 @@ empathy_auth_factory_dispose (GObject *object)
   priv->dispose_run = TRUE;
 
   g_hash_table_unref (priv->sasl_handlers);
+#ifdef HAVE_GOA
   g_object_unref (priv->goa_handler);
+#endif /* HAVE_GOA */
 
   G_OBJECT_CLASS (empathy_auth_factory_parent_class)->dispose (object);
 }



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