[shotwell] Make it possible to disable individual publishers



commit 3d26c342a7e7aaf8e89c5ab4b695618a0f6ee1a7
Author: Jens Georg <mail jensge org>
Date:   Sat Mar 4 15:58:58 2017 +0100

    Make it possible to disable individual publishers
    
    Signed-off-by: Jens Georg <mail jensge org>
    
    https://bugzilla.gnome.org/show_bug.cgi?id=775158

 configure.ac                                       |   67 +++++++++++++++++++-
 .../shotwell-publishing-extras.vala                |   11 +++
 .../shotwell-publishing/shotwell-publishing.vala   |   12 +++-
 publish-extra.am                                   |    1 +
 publish.am                                         |    1 +
 5 files changed, 90 insertions(+), 2 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 5044b86..9bd09b9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -163,6 +163,70 @@ AC_SUBST([HAVE_UNITY])
 AM_CONDITIONAL([HAVE_UNITY],[test "x$HAVE_UNITY" = "xyes"])
 
 dnl ***********************************************************************
+dnl Publishers
+dnl ***********************************************************************
+
+m4_define(ALL_PUBLISHERS, [facebook, flickr, picasa, piwigo, youtube, gallery3, rajce, tumblr, yandex])
+AC_ARG_ENABLE([publishers],
+            AS_HELP_STRING([--enable-publishers=@<:@list-of-publishers or all@:>@],
+                           [A comma-separated list of publishers from ALL_PUBLISHERS]),
+            [],[enable_publishers="ALL_PUBLISHERS"])
+
+AS_IF([test "$xenable_publishers" = "xall"],
+      [enable_publishers="ALL_PUBLISHERS"],[])
+
+save_ifs=$IFS
+IFS=,
+PUBLISHER_VALAFLAGS=""
+ENABLED_PUBLISHERS=""
+for publisher in $enable_publishers; do
+    echo "Checking publisher >${publisher}<"
+    case $publisher in
+        *facebook*)
+            PUBLISHER_VALAFLAGS="$PUBLISHER_VALAFLAGS --define HAVE_FACEBOOK"
+            ENABLED_PUBLISHERS="$ENABLED_PUBLISHERS facebook"
+        ;;
+        *flickr*)
+            PUBLISHER_VALAFLAGS="$PUBLISHER_VALAFLAGS --define HAVE_FLICKR"
+            ENABLED_PUBLISHERS="$ENABLED_PUBLISHERS flickr"
+        ;;
+        *picasa*)
+            PUBLISHER_VALAFLAGS="$PUBLISHER_VALAFLAGS --define HAVE_PICASA"
+            ENABLED_PUBLISHERS="$ENABLED_PUBLISHERS picasa"
+        ;;
+        *piwigo*)
+            PUBLISHER_VALAFLAGS="$PUBLISHER_VALAFLAGS --define HAVE_PIWIGO"
+            ENABLED_PUBLISHERS="$ENABLED_PUBLISHERS piwigo"
+        ;;
+        *youtube*)
+            PUBLISHER_VALAFLAGS="$PUBLISHER_VALAFLAGS --define HAVE_YOUTUBE"
+            ENABLED_PUBLISHERS="$ENABLED_PUBLISHERS youtube"
+        ;;
+        *gallery3*)
+            PUBLISHER_VALAFLAGS="$PUBLISHER_VALAFLAGS --define HAVE_GALLERY3"
+            ENABLED_PUBLISHERS="$ENABLED_PUBLISHERS gallery3"
+        ;;
+        *rajce*)
+            PUBLISHER_VALAFLAGS="$PUBLISHER_VALAFLAGS --define HAVE_RAJCE"
+            ENABLED_PUBLISHERS="$ENABLED_PUBLISHERS rajce"
+        ;;
+        *tumblr*)
+            PUBLISHER_VALAFLAGS="$PUBLISHER_VALAFLAGS --define HAVE_TUMBLR"
+            ENABLED_PUBLISHERS="$ENABLED_PUBLISHERS tumblr"
+        ;;
+        *yandex*)
+            PUBLISHER_VALAFLAGS="$PUBLISHER_VALAFLAGS --define HAVE_YANDEX"
+            ENABLED_PUBLISHERS="$ENABLED_PUBLISHERS yandex"
+        ;;
+        *)
+        ;;
+    esac
+done
+IFS=$save_ifs
+AC_SUBST([PUBLISHER_VALAFLAGS])
+
+
+dnl ***********************************************************************
 dnl Extra publishing plugins
 dnl ***********************************************************************
 AC_ARG_ENABLE([extra-plugins],
@@ -222,5 +286,6 @@ echo "  Prefix ............................... : ${prefix}"
 echo "  Libdir ............................... : ${libdir}"
 echo "  Unity support ........................ : ${HAVE_UNITY}"
 echo "  Additional publishing plugins ........ : ${HAVE_EXTRA_PLUGINS}"
-echo "  Authentication library ................: ${with_authenticator}"
+echo "  Authentication library ............... : ${with_authenticator}"
+echo "  Publishers ........................... : ${ENABLED_PUBLISHERS}"
 echo ""
diff --git a/plugins/shotwell-publishing-extras/shotwell-publishing-extras.vala 
b/plugins/shotwell-publishing-extras/shotwell-publishing-extras.vala
index 9e70d30..2f47771 100644
--- a/plugins/shotwell-publishing-extras/shotwell-publishing-extras.vala
+++ b/plugins/shotwell-publishing-extras/shotwell-publishing-extras.vala
@@ -10,10 +10,21 @@ private class ShotwellPublishingExtraServices : Object, Spit.Module {
     private Spit.Pluggable[] pluggables = new Spit.Pluggable[0];
 
     public ShotwellPublishingExtraServices(GLib.File module_file) {
+#if HAVE_YANDEX
         pluggables += new YandexService();
+#endif
+
+#if HAVE_TUMBLR
         pluggables += new TumblrService(module_file.get_parent());
+#endif
+
+#if HAVE_RAJCE
         pluggables += new RajceService(module_file.get_parent());
+#endif
+
+#if HAVE_GALLERY3
         pluggables += new Gallery3Service(module_file.get_parent());
+#endif
     }
     
     public unowned string get_module_name() {
diff --git a/plugins/shotwell-publishing/shotwell-publishing.vala 
b/plugins/shotwell-publishing/shotwell-publishing.vala
index f4b3353..1c266bf 100644
--- a/plugins/shotwell-publishing/shotwell-publishing.vala
+++ b/plugins/shotwell-publishing/shotwell-publishing.vala
@@ -16,24 +16,34 @@ private class ShotwellPublishingCoreServices : Object, Spit.Module {
         GLib.File resource_directory = module_file.get_parent();
         var factory = Publishing.Authenticator.Factory.get_instance();
         var authenicators = factory.get_available_authenticators();
-        
+
+#if HAVE_FACEBOOK
         if (authenicators.contains("facebook")) {
             pluggables += new FacebookService(resource_directory);
         }
+#endif
 
+#if HAVE_PICASA
         if (authenicators.contains("picasa")) {
             pluggables += new PicasaService(resource_directory);
         }
+#endif
 
+#if HAVE_FLICKR
         if (authenicators.contains("flickr")) {
             pluggables += new FlickrService(resource_directory);
         }
+#endif
 
+#if HAVE_YOUTUBE
         if (authenicators.contains("youtube")) {
             pluggables += new YouTubeService(resource_directory);
         }
+#endif
 
+#if HAVE_PIWIGO
         pluggables += new PiwigoService(resource_directory);
+#endif
     }
     
     public unowned string get_module_name() {
diff --git a/publish-extra.am b/publish-extra.am
index 7448bf6..801cc9a 100644
--- a/publish-extra.am
+++ b/publish-extra.am
@@ -31,6 +31,7 @@ plugins/shotwell-publishing-extras/resource.c: plugins/shotwell-publishing-extra
 
 plugins_shotwell_publishing_extras_shotwell_publishing_extras_la_VALAFLAGS = \
        $(COMMON_VALAFLAGS) \
+       @PUBLISHER_VALAFLAGS@ \
        --pkg gtk+-3.0 \
        --pkg libsoup-2.4 \
        --pkg gexiv2 \
diff --git a/publish.am b/publish.am
index 6e4b412..799765a 100644
--- a/publish.am
+++ b/publish.am
@@ -44,6 +44,7 @@ plugins/shotwell-publishing/resource.c: $(PUBLISHING_RESOURCE_DEPS) $(PUBLISHING
 
 plugins_shotwell_publishing_shotwell_publishing_la_VALAFLAGS = \
        $(COMMON_VALAFLAGS) \
+       @PUBLISHER_VALAFLAGS@ \
        --pkg gtk+-3.0 \
        --pkg libsoup-2.4 \
        --pkg gexiv2 \


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