[tracker] libtracker-data: Drop unused volume handling functions



commit c78df695f8c18845712d496215405df2058bc871
Author: Jürg Billeter <j bitron ch>
Date:   Thu Mar 18 10:28:37 2010 +0100

    libtracker-data: Drop unused volume handling functions

 src/libtracker-data/tracker-data-update.c |  213 -----------------------------
 src/libtracker-data/tracker-data-update.h |    7 -
 2 files changed, 0 insertions(+), 220 deletions(-)
---
diff --git a/src/libtracker-data/tracker-data-update.c b/src/libtracker-data/tracker-data-update.c
index e7acb3f..cf023f9 100644
--- a/src/libtracker-data/tracker-data-update.c
+++ b/src/libtracker-data/tracker-data-update.c
@@ -1800,219 +1800,6 @@ tracker_data_insert_statement_with_string (const gchar            *graph,
 	}
 }
 
-static void
-db_set_volume_available (const gchar *uri,
-                         gboolean     available)
-{
-	TrackerDBInterface *iface;
-	TrackerDBStatement *stmt;
-
-	iface = tracker_db_manager_get_db_interface ();
-
-	stmt = tracker_db_interface_create_statement (iface, "UPDATE \"rdfs:Resource\" SET Available = ? WHERE ID IN (SELECT ID FROM \"nie:DataObject\" WHERE \"nie:dataSource\" IN (SELECT ID FROM Resource WHERE Uri = ?))");
-	tracker_db_statement_bind_int (stmt, 0, available ? 1 : 0);
-	tracker_db_statement_bind_text (stmt, 1, uri);
-	tracker_db_statement_execute (stmt, NULL);
-	g_object_unref (stmt);
-}
-
-void
-tracker_data_update_enable_volume (const gchar *udi,
-                                   const gchar *mount_path)
-{
-	gchar              *removable_device_urn;
-	gchar *delete_q;
-	gchar *set_q;
-	gchar *mount_path_uri;
-	GFile *mount_path_file;
-	GError *error = NULL;
-
-	g_return_if_fail (udi != NULL);
-	g_return_if_fail (mount_path != NULL);
-
-	removable_device_urn = g_strdup_printf (TRACKER_DATASOURCE_URN_PREFIX "%s", udi);
-
-	db_set_volume_available (removable_device_urn, TRUE);
-
-	mount_path_file = g_file_new_for_path (mount_path);
-	mount_path_uri = g_file_get_uri (mount_path_file);
-
-	delete_q = g_strdup_printf ("DELETE FROM <%s> { <%s> tracker:mountPoint ?d } WHERE { <%s> tracker:mountPoint ?d }",
-	                            removable_device_urn, removable_device_urn, removable_device_urn);
-	set_q = g_strdup_printf ("INSERT INTO <%s> { <%s> a tracker:Volume; tracker:mountPoint <%s> }",
-	                         removable_device_urn, removable_device_urn, mount_path_uri);
-
-	tracker_data_update_sparql (delete_q, &error);
-
-	if (error) {
-		g_critical ("%s", error->message);
-		g_error_free (error);
-		error = NULL;
-	}
-
-	tracker_data_update_sparql (set_q, &error);
-
-	if (error) {
-		g_critical ("%s", error->message);
-		g_error_free (error);
-	}
-
-	g_free (set_q);
-	g_free (delete_q);
-
-	delete_q = g_strdup_printf ("DELETE FROM <%s> { <%s> tracker:isMounted ?d } WHERE { <%s> tracker:isMounted ?d }",
-	                            removable_device_urn, removable_device_urn, removable_device_urn);
-	set_q = g_strdup_printf ("INSERT INTO <%s> { <%s> a tracker:Volume; tracker:isMounted true }",
-	                         removable_device_urn, removable_device_urn);
-
-	tracker_data_update_sparql (delete_q, &error);
-
-	if (error) {
-		g_critical ("%s", error->message);
-		g_error_free (error);
-		error = NULL;
-	}
-
-	tracker_data_update_sparql (set_q, &error);
-
-	if (error) {
-		g_critical ("%s", error->message);
-		g_error_free (error);
-	}
-
-	g_free (set_q);
-	g_free (delete_q);
-
-	g_free (mount_path_uri);
-	g_object_unref (mount_path_file);
-	g_free (removable_device_urn);
-}
-
-void
-tracker_data_update_reset_volume (const gchar *uri)
-{
-	time_t mnow;
-	gchar *now_as_string;
-	gchar *delete_q;
-	gchar *set_q;
-	GError *error = NULL;
-
-	mnow = time (NULL);
-	now_as_string = tracker_date_to_string (mnow);
-	delete_q = g_strdup_printf ("DELETE FROM <%s> { <%s> tracker:unmountDate ?d } WHERE { <%s> tracker:unmountDate ?d }",
-	                            uri, uri, uri);
-	set_q = g_strdup_printf ("INSERT INTO <%s> { <%s> a tracker:Volume; tracker:unmountDate \"%s\" }",
-	                         uri, uri, now_as_string);
-
-	tracker_data_update_sparql (delete_q, &error);
-
-	if (error) {
-		g_critical ("%s", error->message);
-		g_error_free (error);
-		error = NULL;
-	}
-
-	tracker_data_update_sparql (set_q, &error);
-
-	if (error) {
-		g_critical ("%s", error->message);
-		g_error_free (error);
-	}
-
-	g_free (now_as_string);
-	g_free (set_q);
-	g_free (delete_q);
-}
-
-void
-tracker_data_update_disable_volume (const gchar *udi)
-{
-	gchar *removable_device_urn;
-	gchar *delete_q;
-	gchar *set_q;
-	GError *error = NULL;
-
-	g_return_if_fail (udi != NULL);
-
-	removable_device_urn = g_strdup_printf (TRACKER_DATASOURCE_URN_PREFIX "%s", udi);
-
-	db_set_volume_available (removable_device_urn, FALSE);
-
-	tracker_data_update_reset_volume (removable_device_urn);
-
-	delete_q = g_strdup_printf ("DELETE FROM <%s> { <%s> tracker:isMounted ?d } WHERE { <%s> tracker:isMounted ?d }",
-	                            removable_device_urn, removable_device_urn, removable_device_urn);
-	set_q = g_strdup_printf ("INSERT INTO <%s> { <%s> a tracker:Volume; tracker:isMounted false }",
-	                         removable_device_urn, removable_device_urn);
-
-	tracker_data_update_sparql (delete_q, &error);
-
-	if (error) {
-		g_critical ("%s", error->message);
-		g_error_free (error);
-		error = NULL;
-	}
-
-	tracker_data_update_sparql (set_q, &error);
-
-	if (error) {
-		g_critical ("%s", error->message);
-		g_error_free (error);
-	}
-
-	g_free (set_q);
-	g_free (delete_q);
-
-	g_free (removable_device_urn);
-}
-
-void
-tracker_data_update_disable_all_volumes (void)
-{
-	TrackerDBInterface *iface;
-	TrackerDBStatement *stmt;
-	gchar *delete_q, *set_q;
-	GError *error = NULL;
-
-	iface = tracker_db_manager_get_db_interface ();
-
-	stmt = tracker_db_interface_create_statement (iface,
-	                                              "UPDATE \"rdfs:Resource\" SET Available = 0 "
-	                                              "WHERE ID IN ("
-	                                              "SELECT ID FROM \"nie:DataObject\" "
-	                                              "WHERE \"nie:dataSource\" IN ("
-	                                              "SELECT ID FROM Resource WHERE Uri != ?"
-	                                              ")"
-	                                              ")");
-	tracker_db_statement_bind_text (stmt, 0, TRACKER_NON_REMOVABLE_MEDIA_DATASOURCE_URN);
-	tracker_db_statement_execute (stmt, NULL);
-	g_object_unref (stmt);
-
-	/* The INTO and FROM uris are not really right, but it should be harmless:
-	 * we just want graph to be != NULL in tracker-store/tracker-writeback.c */
-
-	delete_q = g_strdup_printf ("DELETE FROM <"TRACKER_NON_REMOVABLE_MEDIA_DATASOURCE_URN"> { ?o tracker:isMounted ?d } WHERE { ?o tracker:isMounted ?d  FILTER (?o != <"TRACKER_NON_REMOVABLE_MEDIA_DATASOURCE_URN"> ) }");
-	set_q = g_strdup_printf ("INSERT INTO <"TRACKER_NON_REMOVABLE_MEDIA_DATASOURCE_URN"> { ?o a tracker:Volume; tracker:isMounted false } WHERE { ?o a tracker:Volume FILTER (?o != <"TRACKER_NON_REMOVABLE_MEDIA_DATASOURCE_URN"> ) }");
-
-	tracker_data_update_sparql (delete_q, &error);
-
-	if (error) {
-		g_critical ("%s", error->message);
-		g_error_free (error);
-		error = NULL;
-	}
-
-	tracker_data_update_sparql (set_q, &error);
-
-	if (error) {
-		g_critical ("%s", error->message);
-		g_error_free (error);
-	}
-
-	g_free (set_q);
-	g_free (delete_q);
-}
-
 void
 tracker_data_begin_db_transaction (void)
 {
diff --git a/src/libtracker-data/tracker-data-update.h b/src/libtracker-data/tracker-data-update.h
index 57b5276..40dba01 100644
--- a/src/libtracker-data/tracker-data-update.h
+++ b/src/libtracker-data/tracker-data-update.h
@@ -95,13 +95,6 @@ void     tracker_data_sync                          (void);
 void     tracker_data_replay_journal                (GHashTable                *classes,
                                                      GHashTable                *properties);
 
-/* Volume handling */
-void     tracker_data_update_enable_volume          (const gchar               *udi,
-                                                     const gchar               *mount_path);
-void     tracker_data_update_disable_volume         (const gchar               *udi);
-void     tracker_data_update_disable_all_volumes    (void);
-void     tracker_data_update_reset_volume           (const gchar               *uri);
-
 /* Calling back */
 void     tracker_data_add_insert_statement_callback   (TrackerStatementCallback   callback,
                                                        gpointer                   user_data);



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