[tracker] Bug NB#118578 - Getting metadata with mafw_playlist_get_items_md fails.



commit 3cdeab36b9b86539251355b7c56da5b3db54209d
Author: Philip Van Hoof <philip codeminded be>
Date:   Fri Jun 12 12:01:37 2009 +0200

    Bug NB#118578 - Getting metadata with mafw_playlist_get_items_md fails.
    
    Make volumes initialization completely sync without running the main loop,
    so it doesn't process petitions before the DBus interfaces are properly
    set up.

 src/trackerd/tracker-main.c |  103 +++++++++++++++++++++++++++---------------
 1 files changed, 66 insertions(+), 37 deletions(-)
---
diff --git a/src/trackerd/tracker-main.c b/src/trackerd/tracker-main.c
index 7ff7e62..e5647e5 100644
--- a/src/trackerd/tracker-main.c
+++ b/src/trackerd/tracker-main.c
@@ -354,30 +354,16 @@ mount_point_update_free (MountPointUpdate *mpu)
 }
 
 static void
-mount_point_set_cb (DBusGProxy *proxy, 
-		    GError     *error, 
-		    gpointer    user_data)
+mount_point_set (MountPointUpdate *mpu)
 {
 	TrackerMainPrivate *private;
-	MountPointUpdate *mpu;
 
-	mpu = user_data;
-
-	if (error) {
-		g_critical ("Couldn't set mount point state for:'%s' in database, %s", 
-			    mpu->udi,
-			    error->message);
-		g_error_free (error);
-		g_free (user_data);
-		return;
-	}
-
-	g_message ("Indexer now knows about UDI state:");
-	g_message ("  %s", mpu->udi);
+	g_message ("Indexer has now set the state for the volume with UDI:");
+	g_message (" %s", mpu->udi);
 
 	/* Merging: tracker-0.6 appears to have code here that we don't
 	 *
-	 * if (!private->mount_points_up ...
+	 * About "mount_points_up"
 	 */
 
 	private = g_static_private_get (&private_key);
@@ -402,6 +388,28 @@ mount_point_set_cb (DBusGProxy *proxy,
 								mpu->mount_point);
 		}
 	}
+}
+
+static void
+mount_point_set_cb (DBusGProxy *proxy,
+		    GError *error,
+		    gpointer user_data)
+{
+	MountPointUpdate *mpu;
+
+	mpu = user_data;
+
+	if (error) {
+		g_critical ("Indexer couldn't set volume state for:'%s' in database, %s",
+			    mpu->udi,
+			    error ? error->message : "no error given");
+
+		g_error_free (error);
+
+		tracker_shutdown ();
+	} else {
+		mount_point_set (mpu);
+	}
 
 	mount_point_update_free (mpu);
 }
@@ -827,26 +835,37 @@ backup_restore_on_crawling_finished (TrackerProcessor *processor)
 #ifdef HAVE_HAL
 
 static void
-set_up_mount_points_cb (DBusGProxy *proxy, 
-			GError     *error,
-			gpointer    user_data)
+set_up_mount_points (TrackerStorage *hal)
 {
-	TrackerStorage *hal;
+	TrackerMainPrivate *private;
+	GError *error = NULL;
 	GList *roots, *l;
 
+	private = g_static_private_get (&private_key);
+
+	/* Merging: This has something to do with "mount_points_to_set", which apparently
+	 * we  don't have here in master apparently (but which tracker-0.6 uses)
+	 *
+	 * tracker_status_set_is_paused_for_dbus (TRUE); */
+
+	g_message ("Indexer is being notified to disable all volumes");
+	org_freedesktop_Tracker_Indexer_volume_disable_all (tracker_dbus_indexer_get_proxy (), &error);
+
 	if (error) {
-		g_critical ("Couldn't disable all volumes, %s", 
+		g_critical ("Indexer couldn't disable all volumes, %s",
 			    error->message);
 		g_error_free (error);
+		tracker_shutdown ();
 		return;
 	}
 
-	g_message ("Indexer is being notified about ALL UDIs");
+	g_message ("   Done");
 
-	hal = user_data;
 	roots = tracker_storage_get_removable_device_udis (hal);
 	
-	for (l = roots; l; l = l->next) {
+	l = roots;
+
+	while (l && !private->shutdown) {
 		MountPointUpdate *mpu;
 
 		mpu = mount_point_update_new (l->data,
@@ -856,26 +875,36 @@ set_up_mount_points_cb (DBusGProxy *proxy,
 
 		g_message (" %s", mpu->udi);
 
-		org_freedesktop_Tracker_Indexer_volume_update_state_async (tracker_dbus_indexer_get_proxy (), 
+		org_freedesktop_Tracker_Indexer_volume_update_state (tracker_dbus_indexer_get_proxy (),
 									   mpu->udi,
 									   mpu->mount_point,
 									   mpu->was_added,
-									   mount_point_set_cb,
-									   mpu);
+									   &error);
+		if (error) {
+			g_critical ("Indexer couldn't set volume state for:'%s' in database, %s",
+				    mpu->udi,
+				    error->message);
+
+			g_error_free (error);
+
+			tracker_shutdown ();
+			break;
+		} else {
+			mount_point_set (mpu);
+		}
+
+		mount_point_update_free (mpu);
+		l = l->next;
 	}
 
 	g_list_free (roots);
-}
 
-static void
-set_up_mount_points (TrackerStorage *hal)
-{
-	g_message ("Indexer is being notified to disable all volumes");
-	org_freedesktop_Tracker_Indexer_volume_disable_all_async (tracker_dbus_indexer_get_proxy (), 
-								  set_up_mount_points_cb,
-								  hal);
+	/* Merging: tracker-0.6 appears to have code here that we don't have
+	 *
+	 * About "mount_points_up" */
 }
 
+
 #endif /* HAVE_HAL */
 
 static gboolean



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