[tracker-miners/wip/carlosg/dbus-api-changes: 10/13] libtracker-miner: Clean up priority classes in TrackerDecorator
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/wip/carlosg/dbus-api-changes: 10/13] libtracker-miner: Clean up priority classes in TrackerDecorator
- Date: Sat, 20 Jun 2020 21:57:42 +0000 (UTC)
commit 1e7dec1fe85b9025586f8fdcd6ad0960b0356ee3
Author: Carlos Garnacho <carlosg gnome org>
Date: Sat Jun 20 20:40:43 2020 +0200
libtracker-miner: Clean up priority classes in TrackerDecorator
This is no longer used, will be replaced with something else.
src/libtracker-miner/tracker-decorator.c | 123 ------------------------
src/libtracker-miner/tracker-decorator.h | 3 -
src/tracker-extract/tracker-extract-decorator.c | 16 ---
3 files changed, 142 deletions(-)
---
diff --git a/src/libtracker-miner/tracker-decorator.c b/src/libtracker-miner/tracker-decorator.c
index 0b218f80f..bcaa31376 100644
--- a/src/libtracker-miner/tracker-decorator.c
+++ b/src/libtracker-miner/tracker-decorator.c
@@ -56,11 +56,6 @@ struct _TrackerDecoratorInfo {
gint ref_count;
};
-struct _ClassInfo {
- gchar *class_name;
- gint priority;
-};
-
struct _SparqlUpdate {
gchar *sparql;
gint id;
@@ -69,7 +64,6 @@ struct _SparqlUpdate {
struct _TrackerDecoratorPrivate {
TrackerNotifier *notifier;
- GArray *classes; /* Array of ClassInfo */
gchar **class_names;
gssize n_remaining_items;
@@ -102,7 +96,6 @@ struct _TrackerDecoratorPrivate {
enum {
PROP_CLASS_NAMES = 1,
PROP_COMMIT_BATCH_SIZE,
- PROP_PRIORITY_RDF_TYPES,
};
enum {
@@ -861,38 +854,6 @@ tracker_decorator_get_property (GObject *object,
}
}
-static void
-decorator_add_class (TrackerDecorator *decorator,
- const gchar *class)
-{
- TrackerDecoratorPrivate *priv = decorator->priv;
- ClassInfo info;
-
- info.class_name = g_strdup (class);
- info.priority = G_PRIORITY_DEFAULT;
- g_array_append_val (priv->classes, info);
-}
-
-static void
-decorator_set_classes (TrackerDecorator *decorator,
- const gchar **classes)
-{
- TrackerDecoratorPrivate *priv = decorator->priv;
- gint i;
-
- g_strfreev (priv->class_names);
- priv->class_names = g_strdupv ((gchar **) classes);
-
- if (priv->classes->len > 0) {
- g_array_remove_range (priv->classes, 0,
- priv->classes->len);
- }
-
- for (i = 0; classes[i]; i++) {
- decorator_add_class (decorator, classes[i]);
- }
-}
-
static void
tracker_decorator_set_property (GObject *object,
guint param_id,
@@ -905,16 +866,9 @@ tracker_decorator_set_property (GObject *object,
priv = decorator->priv;
switch (param_id) {
- case PROP_CLASS_NAMES:
- decorator_set_classes (decorator, g_value_get_boxed (value));
- break;
case PROP_COMMIT_BATCH_SIZE:
priv->batch_size = g_value_get_int (value);
break;
- case PROP_PRIORITY_RDF_TYPES:
- tracker_decorator_set_priority_rdf_types (decorator,
- g_value_get_boxed (value));
- break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
}
@@ -1019,7 +973,6 @@ tracker_decorator_finalize (GObject *object)
g_strfreev (priv->class_names);
g_hash_table_destroy (priv->tasks);
- g_array_unref (priv->classes);
g_array_unref (priv->prepended_ids);
g_clear_pointer (&priv->sparql_buffer, g_array_unref);
g_clear_pointer (&priv->commit_buffer, g_array_unref);
@@ -1103,14 +1056,6 @@ tracker_decorator_class_init (TrackerDecoratorClass *klass)
0, G_MAXINT, DEFAULT_BATCH_SIZE,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (object_class,
- PROP_PRIORITY_RDF_TYPES,
- g_param_spec_boxed ("priority-rdf-types",
- "Priority RDF types",
- "rdf:type that needs to be extracted first",
- G_TYPE_STRV,
- G_PARAM_WRITABLE |
- G_PARAM_STATIC_STRINGS));
/**
* TrackerDecorator::items-available:
* @decorator: the #TrackerDecorator
@@ -1148,20 +1093,12 @@ tracker_decorator_class_init (TrackerDecoratorClass *klass)
G_TYPE_NONE, 0);
}
-static void
-class_info_clear (ClassInfo *info)
-{
- g_free (info->class_name);
-}
-
static void
tracker_decorator_init (TrackerDecorator *decorator)
{
TrackerDecoratorPrivate *priv;
decorator->priv = priv = tracker_decorator_get_instance_private (decorator);
- priv->classes = g_array_new (FALSE, FALSE, sizeof (ClassInfo));
- g_array_set_clear_func (priv->classes, (GDestroyNotify) class_info_clear);
priv->blacklist_items = g_sequence_new (NULL);
priv->prepended_ids = g_array_new (FALSE, FALSE, sizeof (gint));
priv->batch_size = DEFAULT_BATCH_SIZE;
@@ -1354,66 +1291,6 @@ tracker_decorator_next_finish (TrackerDecorator *decorator,
return g_task_propagate_pointer (G_TASK (result), error);
}
-static gint
-class_compare_func (const ClassInfo *a,
- const ClassInfo *b)
-{
- return b->priority - a->priority;
-}
-
-static void
-decorator_set_class_priority (TrackerDecorator *decorator,
- const gchar *class,
- gint priority)
-{
- TrackerDecoratorPrivate *priv = decorator->priv;
- ClassInfo *info;
- gint i;
-
- for (i = 0; i < priv->classes->len; i++) {
- info = &g_array_index (priv->classes, ClassInfo, i);
-
- if (strcmp (info->class_name, class) != 0)
- continue;
-
- info->priority = priority;
- break;
- }
-}
-
-/**
- * tracker_decorator_set_priority_rdf_types:
- * @decorator: a #TrackerDecorator
- * @rdf_types: a string array of rdf types
- *
- * Re-evaluate the priority queues internally to ensure that
- * @rdf_types are handled before all other content. This is useful for
- * applications that need their content available sooner than the
- * standard time it would take to index content.
- *
- * Since: 0.18
- **/
-void
-tracker_decorator_set_priority_rdf_types (TrackerDecorator *decorator,
- const gchar * const *rdf_types)
-{
- TrackerDecoratorPrivate *priv;
- gint i;
-
- g_return_if_fail (TRACKER_DECORATOR (decorator));
- g_return_if_fail (rdf_types != NULL);
-
- priv = decorator->priv;
-
- for (i = 0; rdf_types[i]; i++) {
- decorator_set_class_priority (decorator, rdf_types[i],
- G_PRIORITY_HIGH);
- }
-
- g_array_sort (priv->classes, (GCompareFunc) class_compare_func);
- decorator_rebuild_cache (decorator);
-}
-
/**
* tracker_decorator_info_get_urn:
* @info: a #TrackerDecoratorInfo.
diff --git a/src/libtracker-miner/tracker-decorator.h b/src/libtracker-miner/tracker-decorator.h
index 2ee8dbf26..c497fe906 100644
--- a/src/libtracker-miner/tracker-decorator.h
+++ b/src/libtracker-miner/tracker-decorator.h
@@ -115,9 +115,6 @@ TrackerDecoratorInfo *
GAsyncResult *result,
GError **error);
-void tracker_decorator_set_priority_rdf_types (TrackerDecorator *decorator,
- const gchar * const *rdf_types);
-
GType tracker_decorator_info_get_type (void) G_GNUC_CONST;
TrackerDecoratorInfo *
diff --git a/src/tracker-extract/tracker-extract-decorator.c b/src/tracker-extract/tracker-extract-decorator.c
index 2f754d302..5e050163b 100644
--- a/src/tracker-extract/tracker-extract-decorator.c
+++ b/src/tracker-extract/tracker-extract-decorator.c
@@ -56,21 +56,6 @@ typedef struct {
gchar **rdf_types;
} AppData;
-/* Preferably classes with tracker:notify true, if an
- * extractor module handles new ones, it must be added
- * here.
- */
-static const gchar *supported_classes[] = {
- "nfo:Document",
- "nfo:Audio",
- "nfo:Image",
- "nfo:Video",
- "nfo:FilesystemImage",
- "nmm:Playlist",
- "nfo:SoftwareApplication",
- NULL
-};
-
static GInitableIface *parent_initable_iface;
static void decorator_get_next_file (TrackerDecorator *decorator);
@@ -535,7 +520,6 @@ tracker_extract_decorator_new (TrackerSparqlConnection *connection,
return g_initable_new (TRACKER_TYPE_EXTRACT_DECORATOR,
cancellable, error,
"connection", connection,
- "class-names", supported_classes,
"extractor", extract,
NULL);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]