tracker r2592 - in branches/turtle: . src/libtracker-common src/libtracker-data src/tracker-indexer
- From: pvanhoof svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r2592 - in branches/turtle: . src/libtracker-common src/libtracker-data src/tracker-indexer
- Date: Thu, 27 Nov 2008 13:21:28 +0000 (UTC)
Author: pvanhoof
Date: Thu Nov 27 13:21:28 2008
New Revision: 2592
URL: http://svn.gnome.org/viewvc/tracker?rev=2592&view=rev
Log:
2008-11-27 Philip Van Hoof <philip codeminded be>
* src/tracker-indexer/tracker-indexer.c
* src/libtracker-data/tracker-data-update.c
* src/libtracker-common/tracker-hal.c
* src/libtracker-common/tracker-hal.h: Calling the (stub) functions
added in previous commit at the right moments (at item_remove and
item_add_or_update)
Modified:
branches/turtle/ChangeLog
branches/turtle/src/libtracker-common/tracker-hal.c
branches/turtle/src/libtracker-common/tracker-hal.h
branches/turtle/src/libtracker-data/tracker-data-update.c
branches/turtle/src/tracker-indexer/tracker-indexer.c
Modified: branches/turtle/src/libtracker-common/tracker-hal.c
==============================================================================
--- branches/turtle/src/libtracker-common/tracker-hal.c (original)
+++ branches/turtle/src/libtracker-common/tracker-hal.c Thu Nov 27 13:21:28 2008
@@ -1134,6 +1134,60 @@
return gr.roots;
}
+gboolean
+tracker_hal_path_is_on_removable_device (TrackerHal *hal,
+ const gchar *path,
+ gchar **mount_point,
+ gboolean *available)
+{
+ TrackerHalPriv *priv;
+ GHashTableIter iter;
+ gboolean found = FALSE;
+ gpointer key, value;
+
+ g_return_val_if_fail (TRACKER_IS_HAL (hal), FALSE);
+
+ priv = GET_PRIV (hal);
+
+ g_hash_table_iter_init (&iter, priv->removable_devices);
+
+ while (g_hash_table_iter_next (&iter, &key, &value)) {
+ LibHalVolume *volume;
+ const gchar *udi;
+ const gchar *mp;
+ gboolean is_mounted;
+
+ udi = (const gchar*) key;
+
+ volume = libhal_volume_from_udi (priv->context, udi);
+
+ if (!volume) {
+ g_message ("HAL device with udi:'%s' has no volume, "
+ "should we delete?",
+ udi);
+ continue;
+ }
+
+ mp = libhal_volume_get_mount_point (volume);
+
+ if (g_strrstr (path, mp)) {
+ found = TRUE;
+
+ if (mount_point)
+ *mount_point = g_strdup (mp);
+
+ if (available)
+ *available = libhal_volume_is_mounted (volume);
+ break;
+ }
+
+ libhal_volume_free (volume);
+ }
+
+ return found;
+}
+
+
/**
* tracker_hal_get_removable_device_udis:
* @hal: A #TrackerHal
Modified: branches/turtle/src/libtracker-common/tracker-hal.h
==============================================================================
--- branches/turtle/src/libtracker-common/tracker-hal.h (original)
+++ branches/turtle/src/libtracker-common/tracker-hal.h Thu Nov 27 13:21:28 2008
@@ -66,6 +66,10 @@
const gchar *udi);
gboolean tracker_hal_udi_get_is_mounted (TrackerHal *hal,
const gchar *udi);
+gboolean tracker_hal_path_is_on_removable_device (TrackerHal *hal,
+ const gchar *path,
+ gchar **mount_point,
+ gboolean *available);
#endif /* HAVE_HAL */
Modified: branches/turtle/src/libtracker-data/tracker-data-update.c
==============================================================================
--- branches/turtle/src/libtracker-data/tracker-data-update.c (original)
+++ branches/turtle/src/libtracker-data/tracker-data-update.c Thu Nov 27 13:21:28 2008
@@ -577,9 +577,13 @@
tracker_data_delete_service (const gchar *path,
const gchar *rdf_type)
{
- TrackerService *service = tracker_ontology_get_service_by_name (rdf_type);
- const gchar *service_type = tracker_service_get_name (service);
- guint32 service_id = tracker_data_query_file_id (service_type, path);
+ TrackerService *service;
+ const gchar *service_type;
+ guint32 service_id;
+
+ service = tracker_ontology_get_service_by_name (rdf_type);
+ service_type = tracker_service_get_name (service);
+ service_id = tracker_data_query_file_id (service_type, path);
/* When merging from the decomposed branch to trunk then this function
* wont exist in the decomposed branch. Create it based on this one. */
Modified: branches/turtle/src/tracker-indexer/tracker-indexer.c
==============================================================================
--- branches/turtle/src/tracker-indexer/tracker-indexer.c (original)
+++ branches/turtle/src/tracker-indexer/tracker-indexer.c Thu Nov 27 13:21:28 2008
@@ -1358,6 +1358,8 @@
TrackerService *service;
gchar *text;
guint32 id;
+ gchar *mount_point = NULL;
+ gchar *service_path;
service = get_service_for_file (info->module_file, info->module);
@@ -1395,6 +1397,28 @@
index_metadata (indexer, id, service, metadata);
+ /* TODO: URI branch path -> uri */
+
+ service_path = g_build_path (G_DIR_SEPARATOR_S,
+ dirname,
+ basename,
+ NULL);
+
+ if (tracker_hal_path_is_on_removable_device (indexer->private->hal,
+ service_path,
+ &mount_point,
+ NULL)) {
+
+ tracker_removable_device_add_metadata (indexer,
+ mount_point,
+ service_path,
+ metadata);
+ }
+
+ g_free (mount_point);
+ mount_point = NULL;
+ g_free (service_path);
+
/* Take the old text -> the new one, calculate
* difference and add the words.
*/
@@ -1428,6 +1452,28 @@
index_metadata (indexer, id, service, metadata);
+ /* TODO: URI branch path -> uri */
+
+ service_path = g_build_path (G_DIR_SEPARATOR_S,
+ dirname,
+ basename,
+ NULL);
+
+ if (tracker_hal_path_is_on_removable_device (indexer->private->hal,
+ service_path,
+ &mount_point,
+ NULL)) {
+
+ tracker_removable_device_add_metadata (indexer,
+ mount_point,
+ service_path,
+ metadata);
+ }
+
+ g_free (mount_point);
+ mount_point = NULL;
+ g_free (service_path);
+
text = tracker_module_file_get_text (info->module_file);
if (text) {
@@ -1542,6 +1588,7 @@
gchar *service_path;
const gchar *service_type;
guint service_id, service_type_id;
+ gchar *mount_point = NULL;
service_type = tracker_module_config_get_index_service (info->module->name);
@@ -1613,6 +1660,9 @@
g_free (metadata);
/* Delete service */
+
+ /* TODO: URI branch path -> uri */
+
service_path = g_build_path (G_DIR_SEPARATOR_S,
dirname,
basename,
@@ -1622,6 +1672,17 @@
tracker_data_update_delete_service_recursively (service, service_path);
tracker_data_update_delete_all_metadata (service, service_id);
+ if (tracker_hal_path_is_on_removable_device (indexer->private->hal,
+ service_path,
+ &mount_point,
+ NULL)) {
+
+ tracker_removable_device_add_removal (indexer, mount_point,
+ service_path);
+ }
+
+ g_free (mount_point);
+
tracker_data_update_decrement_stats (indexer->private->common, service);
g_free (service_path);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]