[PATCH 3/9] core: Use constructors to create GrlMediaSourceFooSpec



Thus, references counter is properly initialized.
---
 src/grl-media-source.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/grl-media-source.c b/src/grl-media-source.c
index de41ea5..85b9f07 100644
--- a/src/grl-media-source.c
+++ b/src/grl-media-source.c
@@ -1247,7 +1247,7 @@ grl_media_source_browse (GrlMediaSource *source,
   _callback = browse_result_relay_cb;
   _user_data = brc;
 
-  bs = g_new0 (GrlMediaSourceBrowseSpec, 1);
+  bs = grl_media_source_browse_spec_new ();
   bs->source = g_object_ref (source);
   bs->browse_id = browse_id;
   bs->keys = _keys;
@@ -1379,7 +1379,7 @@ grl_media_source_search (GrlMediaSource *source,
   _callback = browse_result_relay_cb;
   _user_data = brc;
 
-  ss = g_new0 (GrlMediaSourceSearchSpec, 1);
+  ss = grl_media_source_search_spec_new ();
   ss->source = g_object_ref (source);
   ss->search_id = search_id;
   ss->text = g_strdup (text);
@@ -1511,7 +1511,7 @@ grl_media_source_query (GrlMediaSource *source,
   _callback = browse_result_relay_cb;
   _user_data = brc;
 
-  qs = g_new0 (GrlMediaSourceQuerySpec, 1);
+  qs = grl_media_source_query_spec_new ();
   qs->source = g_object_ref (source);
   qs->query_id = query_id;
   qs->query = g_strdup (query);
@@ -1810,6 +1810,7 @@ grl_media_source_store (GrlMediaSource *source,
   const gchar *title;
   const gchar *url;
   GError *error = NULL;
+  GrlMediaSourceStoreSpec *ss;
 
   g_return_if_fail (GRL_IS_MEDIA_SOURCE (source));
   g_return_if_fail (!parent || GRL_IS_MEDIA_BOX (parent));
@@ -1838,7 +1839,7 @@ grl_media_source_store (GrlMediaSource *source,
 
   /* If we have the info, ask the plugin to store the media */
   if (!error) {
-    GrlMediaSourceStoreSpec *ss = g_new0 (GrlMediaSourceStoreSpec, 1);
+    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);
@@ -1876,6 +1877,7 @@ grl_media_source_remove (GrlMediaSource *source,
 
   const gchar *id;
   GError *error = NULL;
+  GrlMediaSourceRemoveSpec *rs;
 
   g_return_if_fail (GRL_IS_MEDIA_SOURCE (source));
   g_return_if_fail (GRL_IS_MEDIA (media));
@@ -1892,7 +1894,7 @@ grl_media_source_remove (GrlMediaSource *source,
   }
 
   if (!error) {
-    GrlMediaSourceRemoveSpec *rs = g_new0 (GrlMediaSourceRemoveSpec, 1);
+    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);
-- 
1.7.0.4



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