[PATCH 9/9] core: Use setters functions to access GrlMediaSourceFooSpec fields



---
 src/grl-media-source.c |   84 ++++++++++++++++++++++++-----------------------
 1 files changed, 43 insertions(+), 41 deletions(-)

diff --git a/src/grl-media-source.c b/src/grl-media-source.c
index 0d811dd..67ce523 100644
--- a/src/grl-media-source.c
+++ b/src/grl-media-source.c
@@ -1381,20 +1381,22 @@ grl_media_source_browse (GrlMediaSource *source,
   _user_data = brc;
 
   bs = grl_media_source_browse_spec_new ();
-  bs->source = g_object_ref (source);
-  bs->browse_id = browse_id;
-  bs->keys = _keys;
-  bs->skip = skip;
-  bs->count = count;
-  bs->flags = flags;
-  bs->callback = _callback;
-  bs->user_data = _user_data;
+  grl_media_source_browse_spec_set_source (bs, source);
+  grl_media_source_browse_spec_set_id (bs, browse_id);
+  grl_media_source_browse_spec_set_keys (bs, _keys);
+  grl_media_source_browse_spec_set_skip (bs, skip);
+  grl_media_source_browse_spec_set_count (bs, count);
+  grl_media_source_browse_spec_set_flags (bs, flags);
+  grl_media_source_browse_spec_set_callback (bs, _callback);
+  grl_media_source_browse_spec_set_data (bs, _user_data);
   if (!container) {
     /* Special case: NULL container ==> NULL id */
-    bs->container = grl_media_box_new ();
-    grl_media_set_id (bs->container, NULL);
+    container = grl_media_box_new ();
+    grl_media_set_id (container, NULL);
+    grl_media_source_browse_spec_set_container (bs, container);
+    g_object_unref (container);
   } else {
-    bs->container = g_object_ref (container);
+    grl_media_source_browse_spec_set_container (bs, container);
   }
 
   /* Save a reference to the operaton spec in the relay-cb's
@@ -1513,15 +1515,15 @@ grl_media_source_search (GrlMediaSource *source,
   _user_data = brc;
 
   ss = grl_media_source_search_spec_new ();
-  ss->source = g_object_ref (source);
-  ss->search_id = search_id;
-  ss->text = g_strdup (text);
-  ss->keys = _keys;
-  ss->skip = skip;
-  ss->count = count;
-  ss->flags = flags;
-  ss->callback = _callback;
-  ss->user_data = _user_data;
+  grl_media_source_search_spec_set_source (ss, source);
+  grl_media_source_search_spec_set_id (ss, search_id);
+  grl_media_source_search_spec_set_text (ss, text);
+  grl_media_source_search_spec_set_keys (ss, _keys);
+  grl_media_source_search_spec_set_skip (ss, skip);
+  grl_media_source_search_spec_set_count (ss, count);
+  grl_media_source_search_spec_set_flags (ss, flags);
+  grl_media_source_search_spec_set_callback (ss, callback);
+  grl_media_source_search_spec_set_data (ss, _user_data);
 
   /* Save a reference to the operaton spec in the relay-cb's
      user_data so that we can free the spec there when we get
@@ -1537,7 +1539,7 @@ grl_media_source_search (GrlMediaSource *source,
     as_ctl->threshold = source->priv->auto_split_threshold;
     as_ctl->chunk_requested = as_ctl->threshold;
     as_ctl->chunk_first = TRUE;
-    ss->count = as_ctl->chunk_requested;
+    grl_media_source_search_spec_set_count (ss, as_ctl->chunk_requested);
     brc->auto_split = as_ctl;
     g_debug ("auto-split: requesting first chunk (skip=%u, count=%u)",
 	     ss->skip, ss->count);
@@ -1645,15 +1647,15 @@ grl_media_source_query (GrlMediaSource *source,
   _user_data = brc;
 
   qs = grl_media_source_query_spec_new ();
-  qs->source = g_object_ref (source);
-  qs->query_id = query_id;
-  qs->query = g_strdup (query);
-  qs->keys = _keys;
-  qs->skip = skip;
-  qs->count = count;
-  qs->flags = flags;
-  qs->callback = _callback;
-  qs->user_data = _user_data;
+  grl_media_source_query_spec_set_source (qs, source);
+  grl_media_source_query_spec_set_id (qs, query_id);
+  grl_media_source_query_spec_set_query (qs, query);
+  grl_media_source_query_spec_set_keys (qs, _keys);
+  grl_media_source_query_spec_set_skip (qs, skip);
+  grl_media_source_query_spec_set_count (qs, count);
+  grl_media_source_query_spec_set_flags (qs, flags);
+  grl_media_source_query_spec_set_callback (qs, _callback);
+  grl_media_source_query_spec_set_data (qs, _user_data);
 
   /* Save a reference to the operaton spec in the relay-cb's
      user_data so that we can free the spec there when we get
@@ -1669,7 +1671,7 @@ grl_media_source_query (GrlMediaSource *source,
     as_ctl->threshold = source->priv->auto_split_threshold;
     as_ctl->chunk_requested = as_ctl->threshold;
     as_ctl->chunk_first = TRUE;
-    qs->count = as_ctl->chunk_requested;
+    grl_media_source_query_spec_set_count (qs, as_ctl->chunk_requested);
     brc->auto_split = as_ctl;
     g_debug ("auto-split: requesting first chunk (skip=%u, count=%u)",
 	     qs->skip, qs->count);
@@ -1973,11 +1975,11 @@ grl_media_source_store (GrlMediaSource *source,
   /* If we have the info, ask the plugin to store the media */
   if (!error) {
     ss = grl_media_source_store_spec_new ();
-    ss->source = g_object_ref (source);
-    ss->parent = parent ? g_object_ref (parent) : NULL;
-    ss->media = g_object_ref (media);
-    ss->callback = callback;
-    ss->user_data = user_data;
+    grl_media_source_store_spec_set_source (ss, source);
+    grl_media_source_store_spec_set_parent (ss, parent);
+    grl_media_source_store_spec_set_media (ss, media);
+    grl_media_source_store_spec_set_callback (ss, callback);
+    grl_media_source_store_spec_set_data (ss, user_data);
 
     g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
 		     store_idle,
@@ -2028,11 +2030,11 @@ grl_media_source_remove (GrlMediaSource *source,
 
   if (!error) {
     rs = grl_media_source_remove_spec_new ();
-    rs->source = g_object_ref (source);
-    rs->media_id = g_strdup (id);
-    rs->media = g_object_ref (media);
-    rs->callback = callback;
-    rs->user_data = user_data;
+    grl_media_source_remove_spec_set_source (rs, source);
+    grl_media_source_remove_spec_set_media_id (rs, id);
+    grl_media_source_remove_spec_set_media (rs, media);
+    grl_media_source_remove_spec_set_callback (rs, callback);
+    grl_media_source_remove_spec_set_data (rs, user_data);
 
     g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
 		     remove_idle,
-- 
1.7.0.4



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