[tracker/miner-web: 2/24] PasswordProvider: Rename interface and functions to be "cleaner"



commit d50f05b2d053597c83b73877c9592e0fe0d557a5
Author: Adrien Bustany <madcat mymadcat com>
Date:   Tue Nov 3 13:42:23 2009 -0300

    PasswordProvider: Rename interface and functions to be "cleaner"

 src/libtracker-miner/gnome-password-provider.vala |    2 +-
 src/libtracker-miner/password-provider.vala       |   26 +++++++++-----------
 2 files changed, 13 insertions(+), 15 deletions(-)
---
diff --git a/src/libtracker-miner/gnome-password-provider.vala b/src/libtracker-miner/gnome-password-provider.vala
index b8a4154..fc91e08 100644
--- a/src/libtracker-miner/gnome-password-provider.vala
+++ b/src/libtracker-miner/gnome-password-provider.vala
@@ -1,5 +1,5 @@
 namespace Tracker {
-	class GnomePasswordProvider : Tracker.PasswordProviderIface, GLib.Object {
+	class GnomePasswordProvider : Tracker.PasswordProvider, GLib.Object {
 
 		private const GnomeKeyring.PasswordSchema password_schema = {
 			GnomeKeyring.ItemType.GENERIC_SECRET,
diff --git a/src/libtracker-miner/password-provider.vala b/src/libtracker-miner/password-provider.vala
index 2b6401e..68ff186 100644
--- a/src/libtracker-miner/password-provider.vala
+++ b/src/libtracker-miner/password-provider.vala
@@ -5,29 +5,27 @@ namespace Tracker {
 		NOTFOUND, // No results were found during a call to get
 	}
 
+	private static PasswordProvider _password_provider_instance = null;
+
 	[CCode (cheader_filename = "libtracker-miner/tracker-miner-web.h")]
-	public interface PasswordProviderIface : GLib.Object {
+	public interface PasswordProvider : GLib.Object {
 		public abstract void store (string service, string description, string username, string password) throws PasswordProviderError;
 		public abstract string @get (string service, out string? username) throws PasswordProviderError;
 		public abstract void forget (string service, string username) throws PasswordProviderError;
-	}
-
-	[CCode (cheader_filename = "libtracker-miner/tracker-miner-web.h")]
-	public class PasswordProvider : GLib.Object {
-		private static PasswordProviderIface _instance = null;
 
-		public static unowned PasswordProviderIface instance ()
-		{
-			if (_instance == null) {
+		static PasswordProvider password_provider {
+			get {
+				if (_password_provider_instance == null) {
 #if HAVE_GNOMEKEYRING
-				_instance = new GnomePasswordProvider ();
+					_password_provider_instance = new GnomePasswordProvider ();
 #else
-				critical ("No password storage backend defined at compile time");
+					_password_provider_instance = new DummyPasswordProvider ();
 #endif
-			}
+				}
 
-			assert (_instance != null);
-			return _instance;
+				assert (_password_provider_instance != null);
+				return _password_provider_instance;
+			}
 		}
 	}
 }



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