[grilo-plugins] tracker: Use new register_keys vfunc
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] tracker: Use new register_keys vfunc
- Date: Tue, 27 Jan 2015 17:34:11 +0000 (UTC)
commit c92fb6de55e8da7bc5599b05339293099536d7aa
Author: Bastien Nocera <hadess hadess net>
Date: Tue Dec 2 12:18:31 2014 +0100
tracker: Use new register_keys vfunc
https://bugzilla.gnome.org/show_bug.cgi?id=740943
src/tracker/grl-tracker-source-api.c | 13 ------------
src/tracker/grl-tracker-utils.c | 26 ------------------------
src/tracker/grl-tracker.c | 36 +++++++++++++++++++++++++++++++--
3 files changed, 33 insertions(+), 42 deletions(-)
---
diff --git a/src/tracker/grl-tracker-source-api.c b/src/tracker/grl-tracker-source-api.c
index fbc69a3..3287f18 100644
--- a/src/tracker/grl-tracker-source-api.c
+++ b/src/tracker/grl-tracker-source-api.c
@@ -1199,22 +1199,9 @@ grl_tracker_source_init_requests (void)
{
GrlRegistry *registry = grl_registry_get_default ();
- /* Check if "tracker-category" is registered; if not, the register it */
grl_metadata_key_tracker_category =
grl_registry_lookup_metadata_key (registry, "tracker-category");
- if (grl_metadata_key_tracker_category == GRL_METADATA_KEY_INVALID) {
- grl_metadata_key_tracker_category =
- grl_registry_register_metadata_key (grl_registry_get_default (),
- g_param_spec_string ("tracker-category",
- "Tracker category",
- "Category a media belongs to",
- NULL,
- G_PARAM_STATIC_STRINGS |
- G_PARAM_READWRITE),
- NULL);
- }
-
grl_tracker_operations = g_hash_table_new (g_direct_hash, g_direct_equal);
GRL_LOG_DOMAIN_INIT (tracker_source_request_log_domain,
diff --git a/src/tracker/grl-tracker-utils.c b/src/tracker/grl-tracker-utils.c
index 0d69428..3b24eb9 100644
--- a/src/tracker/grl-tracker-utils.c
+++ b/src/tracker/grl-tracker-utils.c
@@ -174,38 +174,12 @@ grl_tracker_setup_key_mappings (void)
{
GrlRegistry *registry = grl_registry_get_default ();
- /* Check if "tracker-urn" is registered; if not, then register it */
grl_metadata_key_tracker_urn =
grl_registry_lookup_metadata_key (registry, "tracker-urn");
- if (grl_metadata_key_tracker_urn == GRL_METADATA_KEY_INVALID) {
- grl_metadata_key_tracker_urn =
- grl_registry_register_metadata_key (grl_registry_get_default (),
- g_param_spec_string ("tracker-urn",
- "Tracker URN",
- "Universal resource number in Tracker's
store",
- NULL,
- G_PARAM_STATIC_STRINGS |
- G_PARAM_READWRITE),
- NULL);
- }
-
- /* Check if "gibest-hash" is registered; if not, then register it */
grl_metadata_key_gibest_hash =
grl_registry_lookup_metadata_key (registry, "gibest-hash");
- if (grl_metadata_key_gibest_hash == GRL_METADATA_KEY_INVALID) {
- grl_metadata_key_gibest_hash =
- grl_registry_register_metadata_key (grl_registry_get_default (),
- g_param_spec_string ("gibest-hash",
- "Gibest hash",
- "Gibest hash of the video file",
- NULL,
- G_PARAM_STATIC_STRINGS |
- G_PARAM_READWRITE),
- NULL);
- }
-
grl_to_sparql_mapping = g_hash_table_new (g_direct_hash, g_direct_equal);
sparql_to_grl_mapping = g_hash_table_new (g_str_hash, g_str_equal);
diff --git a/src/tracker/grl-tracker.c b/src/tracker/grl-tracker.c
index 1c392c3..e3a1a7b 100644
--- a/src/tracker/grl-tracker.c
+++ b/src/tracker/grl-tracker.c
@@ -265,7 +265,37 @@ grl_tracker_plugin_deinit (GrlPlugin *plugin)
g_clear_object (&grl_tracker_plugin_init_cancel);
}
+static void
+grl_tracker_plugin_register_keys (GrlRegistry *registry,
+ GrlPlugin *plugin)
+{
+ grl_registry_register_metadata_key (grl_registry_get_default (),
+ g_param_spec_string ("tracker-category",
+ "Tracker category",
+ "Category a media belongs to",
+ NULL,
+ G_PARAM_STATIC_STRINGS |
+ G_PARAM_READWRITE),
+ NULL);
+ grl_registry_register_metadata_key (grl_registry_get_default (),
+ g_param_spec_string ("gibest-hash",
+ "Gibest hash",
+ "Gibest hash of the video file",
+ NULL,
+ G_PARAM_STATIC_STRINGS |
+ G_PARAM_READWRITE),
+ NULL);
+ grl_registry_register_metadata_key (grl_registry_get_default (),
+ g_param_spec_string ("tracker-urn",
+ "Tracker URN",
+ "Universal resource number in Tracker's store",
+ NULL,
+ G_PARAM_STATIC_STRINGS |
+ G_PARAM_READWRITE),
+ NULL);
+}
-GRL_PLUGIN_REGISTER (grl_tracker_plugin_init,
- grl_tracker_plugin_deinit,
- GRL_TRACKER_PLUGIN_ID);
+GRL_PLUGIN_REGISTER_FULL (grl_tracker_plugin_init,
+ grl_tracker_plugin_deinit,
+ grl_tracker_plugin_register_keys,
+ GRL_TRACKER_PLUGIN_ID);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]