[tracker/miner-flickr: 8/8] tracker-miner-flickr: Port to new TrackerMinerWeb API



commit 9831dabb314605e0d07c8c7b8840a81b22c3c9a4
Author: Adrien Bustany <abustany gnome org>
Date:   Thu Mar 18 16:03:20 2010 -0300

    tracker-miner-flickr: Port to new TrackerMinerWeb API

 src/tracker-miner-flickr/tracker-miner-flickr.vala |   37 +++++++++-----------
 1 files changed, 17 insertions(+), 20 deletions(-)
---
diff --git a/src/tracker-miner-flickr/tracker-miner-flickr.vala b/src/tracker-miner-flickr/tracker-miner-flickr.vala
index b0541d6..5bdb94d 100644
--- a/src/tracker-miner-flickr/tracker-miner-flickr.vala
+++ b/src/tracker-miner-flickr/tracker-miner-flickr.vala
@@ -77,7 +77,7 @@ public class MinerFlickr : Tracker.MinerWeb {
 
 	construct {
 		set ("name", MINER_NAME);
-		set ("association", MinerWebAssociationType.UNASSOCIATED);
+		set ("associated", false);
 
 		rest = new Rest.Proxy (FLICKR_REST_URL, false);
 
@@ -87,29 +87,26 @@ public class MinerFlickr : Tracker.MinerWeb {
 	}
 
 	public void shutdown () {
-		set ("association", MinerWebAssociationType.UNASSOCIATED);
+		set ("associated", false);
 	}
 
 	private void association_status_changed (Object source, ParamSpec pspec) {
-		MinerWebAssociationType status;
+		bool associated;
 
-		get ("association", out status);
+		get ("associated", out associated);
 
-		switch (status) {
-			case MinerWebAssociationType.ASSOCIATED:
-				if (pull_timeout_handle != 0)
-					return;
+		if (associated) {
+			if (pull_timeout_handle != 0)
+				return;
 
-				message ("Miner is now associated. Initiating periodic pull.");
-				pull_timeout_handle = Timeout.add_seconds (PULL_INTERVAL, pull_timeout_cb);
-				Idle.add ( () => { pull_timeout_cb (); return false; });
-				break;
-			case MinerWebAssociationType.UNASSOCIATED:
-				if (pull_timeout_handle == 0)
-					return;
+			message ("Miner is now associated. Initiating periodic pull.");
+			pull_timeout_handle = Timeout.add_seconds (PULL_INTERVAL, pull_timeout_cb);
+			Idle.add ( () => { pull_timeout_cb (); return false; });
+		} else {
+			if (pull_timeout_handle == 0)
+				return;
 
-				Source.remove (pull_timeout_handle);
-				break;
+			Source.remove (pull_timeout_handle);
 		}
 	}
 
@@ -500,7 +497,7 @@ public class MinerFlickr : Tracker.MinerWeb {
 
 		password_provider = PasswordProvider.get ();
 
-		set ("association", MinerWebAssociationType.UNASSOCIATED);
+		set ("associated", false);
 
 		try {
 			auth_token = password_provider.get_password (MINER_NAME, null);
@@ -528,7 +525,7 @@ public class MinerFlickr : Tracker.MinerWeb {
 		user_id = user_node.get_attr ("nsid");
 
 		message ("Authentication successful");
-		set ("association", MinerWebAssociationType.ASSOCIATED);
+		set ("associated", true);
 	}
 
 	public override void dissociate () throws MinerWebError {
@@ -545,7 +542,7 @@ public class MinerFlickr : Tracker.MinerWeb {
 			return;
 		}
 
-		set ("association", MinerWebAssociationType.UNASSOCIATED);
+		set ("associated", false);
 	}
 
 	private static bool in_loop = false;



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