[grilo-plugins] tracker: adapt to the new GrlKeyID type
- From: Juan A. Suarez Romero <jasuarez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo-plugins] tracker: adapt to the new GrlKeyID type
- Date: Tue, 17 May 2011 08:04:18 +0000 (UTC)
commit bcdef144c61c227dd6dc1d0bceb428c5213b5070
Author: Lionel Landwerlin <lionel g landwerlin linux intel com>
Date: Tue May 17 01:46:21 2011 +0100
tracker: adapt to the new GrlKeyID type
Signed-off-by: Lionel Landwerlin <lionel g landwerlin linux intel com>
src/media/tracker/grl-tracker-media-api.c | 4 +-
src/media/tracker/grl-tracker-metadata.c | 9 ++++---
src/media/tracker/grl-tracker-utils.c | 30 +++++++++++++++++-----------
3 files changed, 25 insertions(+), 18 deletions(-)
---
diff --git a/src/media/tracker/grl-tracker-media-api.c b/src/media/tracker/grl-tracker-media-api.c
index 3aeba2f..c905511 100644
--- a/src/media/tracker/grl-tracker-media-api.c
+++ b/src/media/tracker/grl-tracker-media-api.c
@@ -179,7 +179,7 @@ fill_grilo_media_from_sparql (GrlTrackerMedia *source,
GRL_ODEBUG ("\tSetting media prop (col=%i/var=%s/prop=%s) %s",
column,
sparql_key,
- g_param_spec_get_name (G_PARAM_SPEC (assoc->grl_key)),
+ GRL_METADATA_KEY_GET_NAME (assoc->grl_key),
tracker_sparql_cursor_get_string (cursor, column, NULL));
if (tracker_sparql_cursor_is_bound (cursor, column) == FALSE) {
@@ -195,7 +195,7 @@ fill_grilo_media_from_sparql (GrlTrackerMedia *source,
if (assoc->set_value) {
assoc->set_value (cursor, column, media, assoc->grl_key);
} else {
- switch (G_PARAM_SPEC (assoc->grl_key)->value_type) {
+ switch (GRL_METADATA_KEY_GET_TYPE (assoc->grl_key)) {
case G_TYPE_STRING:
/* Cache the source associated to this result. */
if (assoc->grl_key == GRL_METADATA_KEY_ID) {
diff --git a/src/media/tracker/grl-tracker-metadata.c b/src/media/tracker/grl-tracker-metadata.c
index dc22759..549d3af 100644
--- a/src/media/tracker/grl-tracker-metadata.c
+++ b/src/media/tracker/grl-tracker-metadata.c
@@ -202,7 +202,7 @@ fill_grilo_media_from_sparql (GrlMedia *media,
GRL_ODEBUG ("\tSetting media prop (col=%i/var=%s/prop=%s) %s",
column,
sparql_key,
- g_param_spec_get_name (G_PARAM_SPEC (assoc->grl_key)),
+ GRL_METADATA_KEY_GET_NAME (assoc->grl_key),
tracker_sparql_cursor_get_string (cursor, column, NULL));
if (tracker_sparql_cursor_is_bound (cursor, column) == FALSE) {
@@ -218,7 +218,7 @@ fill_grilo_media_from_sparql (GrlMedia *media,
if (assoc->set_value) {
assoc->set_value (cursor, column, media, assoc->grl_key);
} else {
- switch (G_PARAM_SPEC (assoc->grl_key)->value_type) {
+ switch (GRL_METADATA_KEY_GET_TYPE (assoc->grl_key)) {
case G_TYPE_STRING:
val.str_val = tracker_sparql_cursor_get_string (cursor, column, NULL);
if (val.str_val != NULL)
@@ -303,7 +303,7 @@ grl_tracker_metadata_may_resolve (GrlMetadataSource *source,
GrlKeyID key_id,
GList **missing_keys)
{
- GRL_IDEBUG ("%s: key=%s", __FUNCTION__, g_param_spec_get_name (key_id));
+ GRL_IDEBUG ("%s: key=%s", __FUNCTION__, GRL_METADATA_KEY_GET_NAME (key_id));
if (media && grl_tracker_media_find_source (grl_media_get_source (media)))
return FALSE;
@@ -315,7 +315,8 @@ grl_tracker_metadata_may_resolve (GrlMetadataSource *source,
return TRUE;
if (missing_keys)
- *missing_keys = g_list_append (*missing_keys, GRL_METADATA_KEY_URL);
+ *missing_keys = g_list_append (*missing_keys,
+ GRLKEYID_TO_POINTER (GRL_METADATA_KEY_URL));
return FALSE;
}
diff --git a/src/media/tracker/grl-tracker-utils.c b/src/media/tracker/grl-tracker-utils.c
index a038941..f4285bd 100644
--- a/src/media/tracker/grl-tracker-utils.c
+++ b/src/media/tracker/grl-tracker-utils.c
@@ -78,8 +78,9 @@ insert_key_mapping (GrlKeyID grl_key,
const gchar *sparql_key_flavor)
{
tracker_grl_sparql_t *assoc = g_new0 (tracker_grl_sparql_t, 1);
- GList *assoc_list = g_hash_table_lookup (grl_to_sparql_mapping, grl_key);
- gchar *canon_name = g_strdup (g_param_spec_get_name (grl_key));
+ GList *assoc_list = g_hash_table_lookup (grl_to_sparql_mapping,
+ GRLKEYID_TO_POINTER (grl_key));
+ gchar *canon_name = g_strdup (GRL_METADATA_KEY_GET_NAME (grl_key));
assoc->grl_key = grl_key;
assoc->sparql_key_name = build_flavored_key (canon_name,
@@ -90,12 +91,14 @@ insert_key_mapping (GrlKeyID grl_key,
assoc_list = g_list_append (assoc_list, assoc);
- g_hash_table_insert (grl_to_sparql_mapping, grl_key, assoc_list);
+ g_hash_table_insert (grl_to_sparql_mapping,
+ GRLKEYID_TO_POINTER (grl_key),
+ assoc_list);
g_hash_table_insert (sparql_to_grl_mapping,
(gpointer) assoc->sparql_key_name,
assoc);
g_hash_table_insert (sparql_to_grl_mapping,
- (gpointer) g_param_spec_get_name (G_PARAM_SPEC (grl_key)),
+ (gpointer) GRL_METADATA_KEY_GET_NAME (grl_key),
assoc);
g_free (canon_name);
@@ -304,13 +307,15 @@ grl_tracker_get_mapping_from_sparql (const gchar *key)
static GList *
get_mapping_from_grl (const GrlKeyID key)
{
- return (GList *) g_hash_table_lookup (grl_to_sparql_mapping, key);
+ return (GList *) g_hash_table_lookup (grl_to_sparql_mapping,
+ GRLKEYID_TO_POINTER (key));
}
gboolean
grl_tracker_key_is_supported (const GrlKeyID key)
{
- return g_hash_table_lookup (grl_to_sparql_mapping, key) != NULL;
+ return g_hash_table_lookup (grl_to_sparql_mapping,
+ GRLKEYID_TO_POINTER (key)) != NULL;
}
/**/
@@ -341,7 +346,7 @@ grl_tracker_media_get_select_string (const GList *keys)
assoc->sparql_key_name);
while (key != NULL) {
- assoc_list = get_mapping_from_grl ((GrlKeyID) key->data);
+ assoc_list = get_mapping_from_grl (GPOINTER_TO_UINT (key->data));
while (assoc_list != NULL) {
assoc = (tracker_grl_sparql_t *) assoc_list->data;
if (assoc != NULL) {
@@ -364,7 +369,7 @@ gen_prop_insert_string (GString *gstr,
{
gchar *tmp;
- switch (G_PARAM_SPEC (assoc->grl_key)->value_type) {
+ switch (GRL_METADATA_KEY_GET_TYPE (assoc->grl_key)) {
case G_TYPE_STRING:
tmp = g_strescape (grl_data_get_string (data, assoc->grl_key), NULL);
g_string_append_printf (gstr, "%s \"%s\"",
@@ -399,11 +404,12 @@ grl_tracker_tracker_get_insert_string (GrlMedia *media, const GList *keys)
gchar *ret;
while (key != NULL) {
- assoc_list = get_mapping_from_grl ((GrlKeyID) key->data);
+ assoc_list = get_mapping_from_grl (GRLPOINTER_TO_KEYID (key->data));
while (assoc_list != NULL) {
assoc = (tracker_grl_sparql_t *) assoc_list->data;
if (assoc != NULL) {
- if (grl_data_has_key (GRL_DATA (media), key->data)) {
+ if (grl_data_has_key (GRL_DATA (media),
+ GRLPOINTER_TO_KEYID (key->data))) {
if (first) {
gen_prop_insert_string (gstr, assoc, GRL_DATA (media));
first = FALSE;
@@ -435,7 +441,7 @@ grl_tracker_get_delete_string (const GList *keys)
gint var_n = 0;
while (key != NULL) {
- assoc_list = get_mapping_from_grl ((GrlKeyID) key->data);
+ assoc_list = get_mapping_from_grl (GRLPOINTER_TO_KEYID (key->data));
while (assoc_list != NULL) {
assoc = (tracker_grl_sparql_t *) assoc_list->data;
if (assoc != NULL) {
@@ -472,7 +478,7 @@ grl_tracker_get_delete_conditional_string (const gchar *urn,
gint var_n = 0;
while (key != NULL) {
- assoc_list = get_mapping_from_grl ((GrlKeyID) key->data);
+ assoc_list = get_mapping_from_grl (GRLPOINTER_TO_KEYID (key->data));
while (assoc_list != NULL) {
assoc = (tracker_grl_sparql_t *) assoc_list->data;
if (assoc != NULL) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]