[shotwell/wip/pluggable-auth: 13/16] wip: Make pluggables depend on authenticator availability



commit 788a2e5e00d3a904b59dfd17ad148e794117e2f8
Author: Jens Georg <mail jensge org>
Date:   Thu Feb 9 22:17:45 2017 +0100

    wip: Make pluggables depend on authenticator availability
    
    Signed-off-by: Jens Georg <mail jensge org>

 .../shotwell/GoogleAuthenticator.vala              |    3 --
 .../shotwell/ShotwellAuthenticatorFactory.vala     |   12 +++++-----
 .../shotwell-publishing/shotwell-publishing.vala   |   22 ++++++++++++++++---
 src/plugins/PublishingInterfaces.vala              |    3 +-
 4 files changed, 25 insertions(+), 15 deletions(-)
---
diff --git a/plugins/authenticator/shotwell/GoogleAuthenticator.vala 
b/plugins/authenticator/shotwell/GoogleAuthenticator.vala
index e92455e..c263200 100644
--- a/plugins/authenticator/shotwell/GoogleAuthenticator.vala
+++ b/plugins/authenticator/shotwell/GoogleAuthenticator.vala
@@ -118,9 +118,6 @@ namespace Publishing.Authenticator.Shotwell.Google {
             return this.params;
         }
 
-        public void invalidate_persistent_session() {
-        }
-
         public void logout() {
         }
 
diff --git a/plugins/authenticator/shotwell/ShotwellAuthenticatorFactory.vala 
b/plugins/authenticator/shotwell/ShotwellAuthenticatorFactory.vala
index b059b78..68df5e5 100644
--- a/plugins/authenticator/shotwell/ShotwellAuthenticatorFactory.vala
+++ b/plugins/authenticator/shotwell/ShotwellAuthenticatorFactory.vala
@@ -10,12 +10,12 @@ namespace Publishing.Authenticator {
             return Factory.instance;
         }
 
-        public GLib.List<string> get_available_authenticators() {
-            var list = new GLib.List<string>();
-            list.append("flickr");
-            list.append("facebook");
-            list.append("picasa");
-            list.append("youtube");
+        public Gee.List<string> get_available_authenticators() {
+            var list = new Gee.ArrayList<string>();
+            list.add("flickr");
+            list.add("facebook");
+            list.add("picasa");
+            list.add("youtube");
 
             return list;
         }
diff --git a/plugins/shotwell-publishing/shotwell-publishing.vala 
b/plugins/shotwell-publishing/shotwell-publishing.vala
index bbd5ddb..f4b3353 100644
--- a/plugins/shotwell-publishing/shotwell-publishing.vala
+++ b/plugins/shotwell-publishing/shotwell-publishing.vala
@@ -14,11 +14,25 @@ private class ShotwellPublishingCoreServices : Object, Spit.Module {
     // module file directory
     public ShotwellPublishingCoreServices(GLib.File module_file) {
         GLib.File resource_directory = module_file.get_parent();
+        var factory = Publishing.Authenticator.Factory.get_instance();
+        var authenicators = factory.get_available_authenticators();
         
-        pluggables += new FacebookService(resource_directory);
-        pluggables += new PicasaService(resource_directory);
-        pluggables += new FlickrService(resource_directory);
-        pluggables += new YouTubeService(resource_directory);
+        if (authenicators.contains("facebook")) {
+            pluggables += new FacebookService(resource_directory);
+        }
+
+        if (authenicators.contains("picasa")) {
+            pluggables += new PicasaService(resource_directory);
+        }
+
+        if (authenicators.contains("flickr")) {
+            pluggables += new FlickrService(resource_directory);
+        }
+
+        if (authenicators.contains("youtube")) {
+            pluggables += new YouTubeService(resource_directory);
+        }
+
         pluggables += new PiwigoService(resource_directory);
     }
     
diff --git a/src/plugins/PublishingInterfaces.vala b/src/plugins/PublishingInterfaces.vala
index 3015452..1eed3de 100644
--- a/src/plugins/PublishingInterfaces.vala
+++ b/src/plugins/PublishingInterfaces.vala
@@ -613,7 +613,6 @@ public interface Authenticator : Object {
     public signal void authentication_failed();
 
     public abstract void authenticate();
-    public abstract void invalidate_persistent_session();
     public abstract bool can_logout();
     public abstract void logout();
 
@@ -625,7 +624,7 @@ public interface AuthenticatorFactory : Object {
     // static get_instance() method. Unfortunately this is not expressable in
     // Vala.
 
-    public abstract GLib.List<string> get_available_authenticators();
+    public abstract Gee.List<string> get_available_authenticators();
     public abstract Authenticator? create(string provider,
             Spit.Publishing.PluginHost host);
 }


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