[tracker/miner-web: 13/33] libtracker-miner: Move the MinerWeb API to async functions



commit 24c466528e319ea2acf13b7a88e87dfcbee06908
Author: Adrien Bustany <madcat mymadcat com>
Date:   Mon Nov 23 11:45:47 2009 -0300

    libtracker-miner: Move the MinerWeb API to async functions

 src/libtracker-miner/tracker-miner-web.c    |   30 ++++++++++---
 src/libtracker-miner/tracker-miner-web.h    |   62 +++++++++++++++++++-------
 src/libtracker-miner/tracker-miner-web.vala |   34 ---------------
 3 files changed, 68 insertions(+), 58 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-miner-web.c b/src/libtracker-miner/tracker-miner-web.c
index c76a5e2..b385984 100644
--- a/src/libtracker-miner/tracker-miner-web.c
+++ b/src/libtracker-miner/tracker-miner-web.c
@@ -216,19 +216,35 @@ tracker_miner_web_dbus_dissociate (TrackerMinerWeb        *miner,
 }
 
 void
-tracker_miner_web_authenticate (TrackerMinerWeb   *miner,
-                                GError           **error)
+tracker_miner_web_authenticate (TrackerMinerWeb     *miner,
+                                GCancellable        *cancellable,
+                                GAsyncReadyCallback *callback,
+                                gpointer             user_data)
 {
 	g_assert (TRACKER_IS_MINER_WEB (miner));
-	TRACKER_MINER_WEB_GET_CLASS (miner)->authenticate (miner, error);
+	TRACKER_MINER_WEB_GET_CLASS (miner)->authenticate (miner, cancellable, callback, user_data);
 }
 
-GHashTable*
-tracker_miner_web_get_association_data (TrackerMinerWeb   *miner,
-                                        GError           **error)
+TrackerMinerWebAssociationStatus
+tracker_miner_web_authenticate_finish (TrackerMinerWeb  *miner,
+                                       GAsyncResult     *result,
+                                       GError          **error)
 {
 	g_assert (TRACKER_IS_MINER_WEB (miner));
-	return TRACKER_MINER_WEB_GET_CLASS (miner)->get_association_data (miner, error);
+
+	GSimpleAsyncResult *r = G_SIMPLE_ASYNC_RESULT (result);
+
+	g_simple_async_result_propagate_error (r, error);
+}
+
+void
+tracker_miner_web_get_association_data (TrackerMinerWeb     *miner,
+                                        GCancellable        *cancellable,
+                                        GAsyncReadyCallback *callback,
+                                        gpointer             user_data)
+{
+	g_assert (TRACKER_IS_MINER_WEB (miner));
+	return TRACKER_MINER_WEB_GET_CLASS (miner)->get_association_data (miner, cancellable, callback, user_data);
 }
 
 void
diff --git a/src/libtracker-miner/tracker-miner-web.h b/src/libtracker-miner/tracker-miner-web.h
index b21d477..59b658a 100644
--- a/src/libtracker-miner/tracker-miner-web.h
+++ b/src/libtracker-miner/tracker-miner-web.h
@@ -109,29 +109,57 @@ typedef struct {
         TrackerMinerClass parent_class;
 
         /* vmethods */
-        void        (* authenticate)         (TrackerMinerWeb   *miner,
-		                                      GError           **error);
-		GHashTable* (* get_association_data) (TrackerMinerWeb   *miner,
-		                                      GError           **error);
+        void        (* authenticate)         (TrackerMinerWeb     *miner,
+		                                      GCancellable        *cancellable,
+		                                      GAsyncReadyCallback *callback,
+		                                      gpointer             user_data);
+		GHashTable* (* get_association_data) (TrackerMinerWeb     *miner,
+		                                      GCancellable        *cancellable,
+		                                      GAsyncReadyCallback *callback
+		                                      gpointer            user_data);
 		void        (* associate)            (TrackerMinerWeb   *miner,
 		                                      const GHashTable  *association_data,
-		                                      GError           **error);
+		                                      GCancellable        *cancellable,
+		                                      GAsyncReadyCallback *callback
+		                                      gpointer            user_data);
 		void        (* dissociate)           (TrackerMinerWeb   *miner,
-		                                      GError           **error);
+		                                      GCancellable        *cancellable,
+		                                      GAsyncReadyCallback *callback
+		                                      gpointer            user_data);
 } TrackerMinerWebClass;
 
-GType       tracker_miner_web_get_type             (void) G_GNUC_CONST;
-GQuark      tracker_miner_web_error_quark          (void);
+GType                            tracker_miner_web_get_type                    (void) G_GNUC_CONST;
+GQuark                           tracker_miner_web_error_quark                 (void);
 
-void        tracker_miner_web_authenticate         (TrackerMinerWeb   *miner,
-                                                    GError           **error);
-GHashTable* tracker_miner_web_get_association_data (TrackerMinerWeb   *miner,
-                                                    GError           **error);
-void        tracker_miner_web_associate            (TrackerMinerWeb   *miner,
-                                                    const GHashTable  *association_data,
-                                                    GError           **error);
-void        tracker_miner_web_dissociate           (TrackerMinerWeb   *miner,
-                                                    GError           **error);
+void                             tracker_miner_web_authenticate                (TrackerMinerWeb     *miner,
+                                                                                GCancellable        *cancellable,
+                                                                                GAsyncReadyCallback *callback,
+                                                                                gpointer             user_data);
+TrackerMinerWebAssociationStatus tracker_miner_web_authenticate_finish         (TrackerMinerWeb     *miner,
+                                                                                GAsyncResult        *result,
+                                                                                GError             **error);
+void                             tracker_miner_web_get_association_data        (TrackerMinerWeb     *miner,
+                                                                                GCancellable        *cancellable,
+                                                                                GAsyncReadyCallback *callback,
+                                                                                gpointer             user_data);
+GHashTable*                      tracker_miner_web_get_association_data_finish (TrackerMinerWeb     *miner,
+                                                                                GAsyncResult        *result,
+                                                                                GError             **error);
+void                             tracker_miner_web_associate                   (TrackerMinerWeb     *miner,
+                                                                                const GHashTable    *association_data,
+                                                                                GCancellable        *cancellable,
+                                                                                GAsyncReadyCallback *callback,
+                                                                                gpointer             user_data);
+void                             tracker_miner_web_associate_finish            (TrackerMinerWeb     *miner,
+                                                                                GAsyncResult        *result,
+                                                                                GError             **error);
+void                             tracker_miner_web_dissociate                  (TrackerMinerWeb   *miner,
+                                                                                GCancellable        *cancellable,
+                                                                                GAsyncReadyCallback *callback,
+                                                                                gpointer             user_data);
+void                             tracker_miner_web_dissociate_finish           (TrackerMinerWeb   *miner,
+                                                                                GAsyncResult        *result,
+                                                                                GError             **error);
 
 G_END_DECLS
 



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