[grilo] core: merge GrlMediaBox into GrlMedia



commit 7241222a3988177f584291711cc316722280a38d
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date:   Tue Dec 15 17:35:21 2015 +0100

    core: merge GrlMediaBox into GrlMedia
    
    Get rid of GrlMediaBox and use instead GrlMedia.
    
    Also, all references to "box" are converted to "container", as container is a
    more suitable name than boxes.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=755551

 bindings/vala/grilo-0.3.vapi    |   18 ++---
 examples/browsing-pls.c         |    6 +-
 examples/browsing.c             |    6 +-
 examples/searching.c            |    4 +-
 libs/pls/grl-pls.c              |   23 +++---
 src/Makefile.am                 |    2 -
 src/data/grl-media-box.c        |  144 ---------------------------------------
 src/data/grl-media-box.h        |   95 -------------------------
 src/data/grl-media.c            |   72 +++++++++++++++++++
 src/data/grl-media.h            |    9 +++
 src/grilo.c                     |    3 -
 src/grilo.h                     |    1 -
 src/grl-source.c                |   34 +++++-----
 src/grl-source.h                |    7 +-
 tools/grilo-launch/grl-launch.c |    8 +-
 tools/grilo-test-ui/main.c      |   14 ++--
 16 files changed, 139 insertions(+), 307 deletions(-)
---
diff --git a/bindings/vala/grilo-0.3.vapi b/bindings/vala/grilo-0.3.vapi
index 87fb236..6bcd1bd 100644
--- a/bindings/vala/grilo-0.3.vapi
+++ b/bindings/vala/grilo-0.3.vapi
@@ -119,6 +119,8 @@ namespace Grl {
                public void add_url_data (string url, string mime, int bitrate, float framerate, int width, 
int height);
                [CCode (cname = "grl_media_audio_new", has_construct_function = false)]
                public Media.audio_new ();
+               [CCode (cname = "grl_media_container_new", has_construct_function = false)]
+               public Media.container_new ();
                public unowned string get_album ();
                public unowned string get_artist ();
                public unowned string get_artist_nth (uint index);
@@ -127,6 +129,7 @@ namespace Grl {
                public int get_bitrate ();
                public unowned string get_camera_model ();
                public unowned string get_certificate ();
+               public int get_childcount ();
                public unowned GLib.DateTime get_creation_date ();
                public unowned string get_description ();
                public unowned string get_director ();
@@ -194,6 +197,7 @@ namespace Grl {
                [CCode (cname = "grl_media_image_new", has_construct_function = false)]
                public Media.image_new ();
                public bool is_audio ();
+               public bool is_container ();
                public bool is_image ();
                public bool is_video ();
                public string serialize ();
@@ -203,6 +207,7 @@ namespace Grl {
                public void set_bitrate (int bitrate);
                public void set_camera_model (string camera_model);
                public void set_certificate (string certificate);
+               public void set_childcount (int childcount);
                public void set_creation_date (GLib.DateTime creation_date);
                public void set_description (string description);
                public void set_director (string director);
@@ -258,13 +263,6 @@ namespace Grl {
                [NoAccessorMethod]
                public Grl.MediaType media_type { get; set construct; }
        }
-       [CCode (cheader_filename = "grilo.h", type_id = "grl_media_box_get_type ()")]
-       public class MediaBox : Grl.Media {
-               [CCode (has_construct_function = false, type = "GrlMedia*")]
-               public MediaBox ();
-               public int get_childcount ();
-               public void set_childcount (int childcount);
-       }
        [CCode (cheader_filename = "grilo.h", type_id = "grl_operation_options_get_type ()")]
        public class OperationOptions : GLib.Object {
                [CCode (has_construct_function = false)]
@@ -405,7 +403,7 @@ namespace Grl {
                [CCode (cname = "grl_source_search")]
                public uint do_search (string text, GLib.List<Grl.KeyID> keys, Grl.OperationOptions options, 
Grl.SourceResultCb callback);
                [CCode (cname = "grl_source_store")]
-               public void do_store (Grl.MediaBox? parent, Grl.Media media, Grl.WriteFlags flags, 
Grl.SourceStoreCb callback);
+               public void do_store (Grl.Media? parent, Grl.Media media, Grl.WriteFlags flags, 
Grl.SourceStoreCb callback);
                [CCode (cname = "grl_source_store_metadata")]
                public void do_store_metadata (Grl.Media media, GLib.List<Grl.KeyID>? keys, Grl.WriteFlags 
flags, Grl.SourceStoreCb callback);
                public uint get_auto_split_threshold ();
@@ -449,7 +447,7 @@ namespace Grl {
                [NoWrapper]
                public virtual void store_metadata (Grl.SourceStoreMetadataSpec sms);
                public GLib.List<weak Grl.KeyID> store_metadata_sync (Grl.Media media, GLib.List<Grl.KeyID>? 
keys, Grl.WriteFlags flags) throws GLib.Error;
-               public void store_sync (Grl.MediaBox? parent, Grl.Media media, Grl.WriteFlags flags) throws 
GLib.Error;
+               public void store_sync (Grl.Media? parent, Grl.Media media, Grl.WriteFlags flags) throws 
GLib.Error;
                public virtual unowned GLib.List<Grl.KeyID> supported_keys ();
                [NoWrapper]
                public virtual Grl.SupportedOps supported_operations ();
@@ -675,7 +673,7 @@ namespace Grl {
        [CCode (cheader_filename = "grilo.h", has_type_id = false)]
        public struct SourceStoreSpec {
                public weak Grl.Source source;
-               public weak Grl.MediaBox parent;
+               public weak Grl.Media parent;
                public weak Grl.Media media;
                [CCode (delegate_target_cname = "user_data")]
                public weak Grl.SourceStoreCb callback;
diff --git a/examples/browsing-pls.c b/examples/browsing-pls.c
index 4e82ce5..da5d31a 100644
--- a/examples/browsing-pls.c
+++ b/examples/browsing-pls.c
@@ -39,9 +39,9 @@ element_browser (gpointer data,
 
   const gchar *title = grl_media_get_title (media);
 
-  /* If the media is a container (box), that means we will browse it again */
-  if (GRL_IS_MEDIA_BOX (media)) {
-    guint childcount = grl_media_box_get_childcount (GRL_MEDIA_BOX (media));
+  /* If the media is a container, that means we will browse it again */
+  if (grl_media_is_container (media)) {
+    guint childcount = grl_media_get_childcount (media);
     g_debug ("\t Got '%s' (container with %d elements)", title, childcount);
 
     source_browser (source, media);
diff --git a/examples/browsing.c b/examples/browsing.c
index 293b927..9e49fc2 100644
--- a/examples/browsing.c
+++ b/examples/browsing.c
@@ -40,11 +40,11 @@ browse_cb (GrlSource *source,
     /* Get the metadata we are interested in */
     const gchar *title = grl_media_get_title (media);
 
-    /* If the media is a container (box) that means we could
+    /* If the media is a container that means we could
        browse it again (that is, we could use it as the second parameter
        of the grl_media_source_browse method) */
-    if (GRL_IS_MEDIA_BOX (media)) {
-      guint childcount = grl_media_box_get_childcount (GRL_MEDIA_BOX (media));
+    if (grl_media_is_container (media)) {
+      guint childcount = grl_media_get_childcount (media);
       g_debug ("\t Got '%s' (container with %d elements)", title, childcount);
     } else {
       guint seconds = grl_media_get_duration (media);
diff --git a/examples/searching.c b/examples/searching.c
index 71f35db..9f20c1f 100644
--- a/examples/searching.c
+++ b/examples/searching.c
@@ -24,8 +24,8 @@ search_cb (GrlSource *source,
 
   if (media) {
     const gchar *title = grl_media_get_title (media);
-    if (GRL_IS_MEDIA_BOX (media)) {
-      guint childcount = grl_media_box_get_childcount (GRL_MEDIA_BOX (media));
+    if (grl_media_is_container (media)) {
+      guint childcount = grl_media_get_childcount (media);
       g_debug ("\t Got '%s' (container with %d elements)", title, childcount);
     } else {
       guint seconds = grl_media_get_duration (media);
diff --git a/libs/pls/grl-pls.c b/libs/pls/grl-pls.c
index c5aba90..ba7d849 100644
--- a/libs/pls/grl-pls.c
+++ b/libs/pls/grl-pls.c
@@ -709,9 +709,8 @@ grl_pls_playlist_parse_cb (GObject *object,
   grl_pls_entries_array_free (priv->entries);
   priv->entries = NULL;
 
-  if (GRL_IS_MEDIA_BOX (bs->container)) {
-    GrlMediaBox *box = GRL_MEDIA_BOX (bs->container);
-    grl_media_box_set_childcount (box, valid_entries->len);
+  if (grl_media_is_container (bs->container)) {
+    grl_media_set_childcount (bs->container, valid_entries->len);
   }
 
   grl_pls_browse_report_results (bs);
@@ -1142,7 +1141,7 @@ set_container_childcount (GFile               *file,
      and no files), otherwise we just say we do not know the actual
      childcount */
   if (grl_operation_options_get_resolution_flags (options) & GRL_RESOLVE_FAST_ONLY) {
-    grl_media_box_set_childcount (GRL_MEDIA_BOX (media),
+    grl_media_set_childcount (media,
                                   GRL_METADATA_KEY_CHILDCOUNT_UNKNOWN);
     return;
   }
@@ -1172,7 +1171,7 @@ set_container_childcount (GFile               *file,
 
   g_object_unref (e);
 
-  grl_media_box_set_childcount (GRL_MEDIA_BOX (media), count);
+  grl_media_set_childcount (media, count);
 }
 
 static void
@@ -1277,9 +1276,9 @@ grl_pls_file_to_media (GrlMedia            *content,
 
     if (!media) {
       if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY) {
-        media = GRL_MEDIA (grl_media_box_new ());
+        media = GRL_MEDIA (grl_media_container_new ());
       } else if (handle_pls && grl_pls_mime_is_playlist (mime)) {
-        media = GRL_MEDIA (grl_media_box_new ());
+        media = GRL_MEDIA (grl_media_container_new ());
         is_pls = TRUE;
       } else if (mime_is_video (mime)) {
         media = grl_media_video_new ();
@@ -1293,17 +1292,17 @@ grl_pls_file_to_media (GrlMedia            *content,
       set_media_id_from_file (media, file);
     } else {
       if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY &&
-          !GRL_IS_MEDIA_BOX (media)) {
+          !grl_media_is_container (media)) {
         char *uri;
 
         uri = g_file_get_uri (file);
-        GRL_DEBUG ("URI '%s' is a directory but the passed media item is not GrlMediaBox type", uri);
+        GRL_DEBUG ("URI '%s' is a directory but the passed media item is not GrlMedia container type", uri);
         g_free (uri);
         return NULL;
       }
     }
 
-    if (!GRL_IS_MEDIA_BOX (media)) {
+    if (!grl_media_is_container (media)) {
       grl_media_set_mime (media, mime);
     }
 
@@ -1314,7 +1313,7 @@ grl_pls_file_to_media (GrlMedia            *content,
     str = g_strdup (g_file_info_get_display_name (info));
 
     /* Remove file extension */
-    if (!GRL_IS_MEDIA_BOX (media) || is_pls) {
+    if (!grl_media_is_container (media) || is_pls) {
       extension = g_strrstr (str, ".");
       if (extension) {
         *extension = '\0';
@@ -1364,7 +1363,7 @@ grl_pls_file_to_media (GrlMedia            *content,
   g_free (str);
 
   /* Childcount */
-  if (GRL_IS_MEDIA_BOX (media) && !is_pls)
+  if (grl_media_is_container (media) && !is_pls)
     set_container_childcount (file, media, options);
 
   return media;
diff --git a/src/Makefile.am b/src/Makefile.am
index 7f63ab0..36934e4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -72,7 +72,6 @@ data_c_sources =              \
        data/grl-data.c         \
        data/grl-related-keys.c \
        data/grl-media.c        \
-       data/grl-media-box.c    \
        data/grl-config.c
 
 lib GRL_NAME@_la_SOURCES += $(data_c_sources)
@@ -101,7 +100,6 @@ data_h_headers =            \
        data/grl-data.h         \
        data/grl-related-keys.h \
        data/grl-media.h        \
-       data/grl-media-box.h    \
        data/grl-config.h
 
 lib GRL_NAME@inc_HEADERS += $(data_h_headers)
diff --git a/src/data/grl-media.c b/src/data/grl-media.c
index a31238c..76273a9 100644
--- a/src/data/grl-media.c
+++ b/src/data/grl-media.c
@@ -209,6 +209,21 @@ grl_media_image_new (void)
                        NULL);
 }
 
+/**
+ * grl_media_container_new:
+ *
+ * Creates a new media container object.
+ *
+ * Returns: a newly-allocated media container.
+ **/
+GrlMedia *
+grl_media_container_new (void)
+{
+  return g_object_new (GRL_TYPE_MEDIA,
+                       "media-type", GRL_MEDIA_TYPE_CONTAINER,
+                       NULL);
+}
+
 gboolean
 grl_media_is_audio (GrlMedia *media)
 {
@@ -233,6 +248,14 @@ grl_media_is_image (GrlMedia *media)
   return (media->priv->media_type == GRL_MEDIA_TYPE_IMAGE);
 }
 
+gboolean
+grl_media_is_container (GrlMedia *media)
+{
+  g_return_val_if_fail (GRL_IS_MEDIA (media), FALSE);
+
+  return (media->priv->media_type == GRL_MEDIA_TYPE_CONTAINER);
+}
+
 /**
  * grl_media_set_rating:
  * @media: a media
@@ -1940,6 +1963,28 @@ grl_media_set_orientation (GrlMedia *media,
 }
 
 /**
+ * grl_media_set_childcount:
+ * @media: the media container instance
+ * @childcount: number of children
+ *
+ * Sets the number of children of this container. Use
+ * #GRL_METADATA_KEY_CHILDCOUNT_UNKNOWN if it is unknown.
+ */
+void
+grl_media_set_childcount (GrlMedia *media,
+                          gint childcount)
+{
+  g_return_if_fail (GRL_IS_MEDIA (media));
+  g_return_if_fail (grl_media_is_container (media));
+
+  if (childcount != GRL_METADATA_KEY_CHILDCOUNT_UNKNOWN) {
+    grl_data_set_int (GRL_DATA (media),
+                      GRL_METADATA_KEY_CHILDCOUNT,
+                      childcount);
+  }
+}
+
+/**
  * grl_media_get_id:
  * @media: the media object
  *
@@ -3298,3 +3343,30 @@ grl_media_get_orientation (GrlMedia *media)
   return grl_data_get_int (GRL_DATA (media),
                            GRL_METADATA_KEY_ORIENTATION);
 }
+
+/**
+ * grl_media_get_childcount:
+ * @media: the media container instance
+ *
+ * Number of children of this container.
+ *
+ * Returns: number of children, or #GRL_METADATA_KEY_CHILDCOUNT_UNKNOWN if
+ * unknown.
+ */
+gint
+grl_media_get_childcount (GrlMedia *media)
+{
+  const GValue *value;
+
+  g_return_val_if_fail (GRL_IS_MEDIA (media), GRL_METADATA_KEY_CHILDCOUNT_UNKNOWN);
+  g_return_val_if_fail (grl_media_is_container (media), GRL_METADATA_KEY_CHILDCOUNT_UNKNOWN);
+
+  value = grl_data_get (GRL_DATA (media),
+                        GRL_METADATA_KEY_CHILDCOUNT);
+
+  if (value) {
+    return g_value_get_int (value);
+  } else {
+    return GRL_METADATA_KEY_CHILDCOUNT_UNKNOWN;
+  }
+}
diff --git a/src/data/grl-media.h b/src/data/grl-media.h
index a782424..a0a6455 100644
--- a/src/data/grl-media.h
+++ b/src/data/grl-media.h
@@ -225,6 +225,8 @@ void grl_media_set_iso_speed (GrlMedia *media, gfloat iso_speed);
 
 void grl_media_set_orientation (GrlMedia *media, gint orientation);
 
+void grl_media_set_childcount (GrlMedia *media, gint childcount);
+
 void grl_media_add_url_data (GrlMedia *media, const gchar *url, const gchar *mime, gint bitrate, gfloat 
framerate, gint width, gint height);
 
 void grl_media_add_author (GrlMedia *media, const gchar *author);
@@ -402,6 +404,8 @@ gfloat grl_media_get_iso_speed (GrlMedia *media);
 
 gint grl_media_get_orientation (GrlMedia *media);
 
+gint grl_media_get_childcount (GrlMedia *media);
+
 GType grl_media_get_type (void) G_GNUC_CONST;
 
 GrlMedia *grl_media_new (void);
@@ -412,6 +416,8 @@ GrlMedia *grl_media_video_new (void);
 
 GrlMedia *grl_media_image_new (void);
 
+GrlMedia *grl_media_container_new (void);
+
 gboolean
 grl_media_is_audio (GrlMedia *media);
 
@@ -421,6 +427,9 @@ grl_media_is_video (GrlMedia *media);
 gboolean
 grl_media_is_image (GrlMedia *media);
 
+gboolean
+grl_media_is_container (GrlMedia *media);
+
 gchar *grl_media_serialize (GrlMedia *media);
 
 gchar *grl_media_serialize_extended (GrlMedia *media,
diff --git a/src/grilo.c b/src/grilo.c
index a39661b..32f7322 100644
--- a/src/grilo.c
+++ b/src/grilo.c
@@ -108,9 +108,6 @@ post_parse_hook_cb (GOptionContext  *context,
   registry = grl_registry_get_default ();
   grl_metadata_key_setup_system_keys (registry);
 
-  /* Register GrlMedia in glib typesystem */
-  g_type_class_ref (GRL_TYPE_MEDIA_BOX);
-
   /* Set default plugin directories */
   if (!plugin_path) {
     plugin_path = g_getenv (GRL_PLUGIN_PATH_VAR);
diff --git a/src/grilo.h b/src/grilo.h
index 2f0db62..86680b8 100644
--- a/src/grilo.h
+++ b/src/grilo.h
@@ -34,7 +34,6 @@
 #include <grl-metadata-key.h>
 #include <grl-data.h>
 #include <grl-media.h>
-#include <grl-media-box.h>
 #include <grl-config.h>
 #include <grl-related-keys.h>
 #include <grl-source.h>
diff --git a/src/grl-source.c b/src/grl-source.c
index ea120d2..8471c96 100644
--- a/src/grl-source.c
+++ b/src/grl-source.c
@@ -483,24 +483,24 @@ grl_source_class_init (GrlSourceClass *source_class)
    * GrlSource::content-changed:
    * @source: source that has changed
    * @changed_medias: (element-type GrlMedia): a #GPtrArray with the medias
-   * that changed or a common ancestor of them of type #GrlMediaBox.
+   * that changed or a common ancestor of them of type #GrlMedia.
    * @change_type: the kind of change that ocurred
    * @location_unknown: @TRUE if the change happened in @media itself or in one
-   * of its direct children (when @media is a #GrlMediaBox). @FALSE otherwise
+   * of its direct children (when @media is a #GrlMedia). @FALSE otherwise
    *
    * Signals that the content in the source has changed. @changed_medias is the
    * list of elements that have changed. Usually these medias are of type
-   * #GrlMediaBox, meaning that the content of that box has changed.
+   * #GrlMedia container, meaning that the content of that container has changed.
    *
    * If @location_unknown is @TRUE it means the source cannot establish where the
-   * change happened: could be either in the box, in any child, or in any other
-   * descendant of the box in the hierarchy.
+   * change happened: could be either in the container, in any child, or in any other
+   * descendant of the container in the hierarchy.
    *
    * Both @change_type and @location_unknown are applied to all elements in the
    * list.
    *
    * For the cases where the source can only signal that a change happened, but
-   * not where, it would use a list with the the root box (@NULL id) and set
+   * not where, it would use a list with the the root container (@NULL id) and set
    * location_unknown as @TRUE.
    *
    * Since: 0.2.0
@@ -2287,12 +2287,12 @@ warn_if_no_id (GrlMedia *media,
 {
   const char *id;
 
-  if (media == NULL || !GRL_IS_MEDIA_BOX (media))
+  if (media == NULL || !grl_media_is_container (media))
     return;
 
   id = grl_media_get_id (media);
   if (id == NULL || *id == '\0')
-    GRL_WARNING ("Media box is not browsable, has no ID: %s (source: %s)",
+    GRL_WARNING ("Media container is not browsable, has no ID: %s (source: %s)",
                  grl_media_get_title (media),
                  grl_source_get_id (source));
 }
@@ -3261,7 +3261,7 @@ grl_source_resolve (GrlSource *source,
 
   if (!media) {
     /* Special case, NULL media ==> root container */
-    media = grl_media_box_new ();
+    media = grl_media_container_new ();
     grl_media_set_id (media, NULL);
     grl_media_set_source (media, grl_source_get_id (source));
   } else if (!grl_media_get_source (media)) {
@@ -3764,7 +3764,7 @@ grl_source_browse (GrlSource *source,
 
   if (!container) {
     /* Special case: NULL container ==> NULL id */
-    bs->container = grl_media_box_new ();
+    bs->container = grl_media_container_new ();
     grl_media_set_source (bs->container,
                           grl_source_get_id (source));
   } else {
@@ -4276,7 +4276,7 @@ grl_source_remove_sync (GrlSource *source,
 
 static gboolean
 grl_source_store_impl (GrlSource *source,
-                       GrlMediaBox *parent,
+                       GrlMedia *parent,
                        GrlMedia *media,
                        GrlWriteFlags flags,
                        GrlSourceStoreCb callback,
@@ -4289,7 +4289,7 @@ grl_source_store_impl (GrlSource *source,
   GRL_DEBUG (__FUNCTION__);
 
   g_return_val_if_fail (GRL_IS_SOURCE (source), FALSE);
-  g_return_val_if_fail (!parent || GRL_IS_MEDIA_BOX (parent), FALSE);
+  g_return_val_if_fail (!parent || grl_media_is_container (parent), FALSE);
   g_return_val_if_fail (GRL_IS_MEDIA (media), FALSE);
 
   g_return_val_if_fail ((!parent &&
@@ -4335,7 +4335,7 @@ grl_source_store_impl (GrlSource *source,
  */
 void
 grl_source_store (GrlSource *source,
-                  GrlMediaBox *parent,
+                  GrlMedia *parent,
                   GrlMedia *media,
                   GrlWriteFlags flags,
                   GrlSourceStoreCb callback,
@@ -4347,7 +4347,7 @@ grl_source_store (GrlSource *source,
 /**
  * grl_source_store_sync:
  * @source: a source
- * @parent: (allow-none): a #GrlMediaBox to store the data transfer objects
+ * @parent: (allow-none): a #GrlMedia container to store the data transfer objects
  * @media: a #GrlMedia data transfer object
  * @flags: flags to configure specific behaviour of the operation
  * @error: a #GError, or @NULL
@@ -4360,7 +4360,7 @@ grl_source_store (GrlSource *source,
  */
 void
 grl_source_store_sync (GrlSource *source,
-                       GrlMediaBox *parent,
+                       GrlMedia *parent,
                        GrlMedia *media,
                        GrlWriteFlags flags,
                        GError **error)
@@ -4614,7 +4614,7 @@ void grl_source_notify_change_list (GrlSource *source,
 /**
  * grl_source_notify_change:
  * @source: a source
- * @media: (allow-none): the media which has changed, or @NULL to use the root box.
+ * @media: (allow-none): the media which has changed, or @NULL to use the root container.
  * @change_type: the type of change
  * @location_unknown: if change has happened in @media or any descendant
  *
@@ -4641,7 +4641,7 @@ void grl_source_notify_change (GrlSource *source,
   g_return_if_fail (GRL_IS_SOURCE (source));
 
   if (!media) {
-    media = grl_media_box_new ();
+    media = grl_media_container_new ();
   } else {
     g_object_ref (media);
   }
diff --git a/src/grl-source.h b/src/grl-source.h
index a9b0523..f8e9ccb 100644
--- a/src/grl-source.h
+++ b/src/grl-source.h
@@ -29,7 +29,6 @@
 
 #include <grl-metadata-key.h>
 #include <grl-media.h>
-#include <grl-media-box.h>
 #include <grl-definitions.h>
 #include <grl-plugin.h>
 #include <grl-operation-options.h>
@@ -379,7 +378,7 @@ typedef struct {
  */
 typedef struct {
   GrlSource *source;
-  GrlMediaBox *parent;
+  GrlMedia *parent;
   GrlMedia *media;
   GrlSourceStoreCb callback;
   gpointer user_data;
@@ -599,14 +598,14 @@ void grl_source_remove_sync (GrlSource *source,
                              GError **error);
 
 void grl_source_store (GrlSource *source,
-                       GrlMediaBox *parent,
+                       GrlMedia *parent,
                        GrlMedia *media,
                        GrlWriteFlags flags,
                        GrlSourceStoreCb callback,
                        gpointer user_data);
 
 void grl_source_store_sync (GrlSource *source,
-                            GrlMediaBox *parent,
+                            GrlMedia *parent,
                             GrlMedia *media,
                             GrlWriteFlags flags,
                             GError **error);
diff --git a/tools/grilo-launch/grl-launch.c b/tools/grilo-launch/grl-launch.c
index e4e51f3..825a65b 100644
--- a/tools/grilo-launch/grl-launch.c
+++ b/tools/grilo-launch/grl-launch.c
@@ -450,8 +450,8 @@ run_browse (gchar **browse_params)
   }
 
   get_source_and_media (browse_params[0], &source, &media);
-  if (media && !GRL_IS_MEDIA_BOX (media)) {
-    g_print ("%s is not a media box\n", browse_params[0]);
+  if (media && !grl_media_is_container (media)) {
+    g_print ("%s is not a media container\n", browse_params[0]);
     return quit (FALSE);
   }
 
@@ -819,8 +819,8 @@ main (int argc, char *argv[])
   g_option_context_add_main_entries (context, entries, NULL);
   g_option_context_add_group (context, grl_init_get_option_group ());
   g_option_context_set_summary (context,
-                                "\tbrowse <source>|<media box>\n"
-                                "\tmay_resolve <key> <source>|<media box> [<source>]\n"
+                                "\tbrowse <source>|<media container>\n"
+                                "\tmay_resolve <key> <source>|<media container> [<source>]\n"
                                 "\tquery <expression> <source>\n"
                                 "\tresolve <source>|<media> [<source>]\n"
                                 "\tsearch <term> <source>\n"
diff --git a/tools/grilo-test-ui/main.c b/tools/grilo-test-ui/main.c
index 4b62153..33bfc68 100644
--- a/tools/grilo-test-ui/main.c
+++ b/tools/grilo-test-ui/main.c
@@ -341,7 +341,7 @@ create_query_combo_model (void)
 static GIcon *
 get_icon_for_media (GrlMedia *media)
 {
-  if (GRL_IS_MEDIA_BOX (media)) {
+  if (grl_media_is_container (media)) {
     return g_themed_icon_new ("folder");
   } else if (grl_media_is_video (media)) {
     return g_themed_icon_new ("gnome-mime-video");
@@ -683,9 +683,9 @@ browse_search_query_cb (GrlSource *source,
   if (media) {
     icon = get_icon_for_media (media);
     name = grl_media_get_title (media);
-    if (GRL_IS_MEDIA_BOX (media)) {
+    if (grl_media_is_container (media)) {
       gint childcount =
-        grl_media_box_get_childcount (GRL_MEDIA_BOX (media));
+        grl_media_get_childcount (media);
       type = OBJECT_TYPE_CONTAINER;
       if (childcount != GRL_METADATA_KEY_CHILDCOUNT_UNKNOWN) {
        name = g_strdup_printf ("%s (%d)", name, childcount);
@@ -1048,7 +1048,7 @@ browser_row_selected_cb (GtkTreeView *tree_view,
       (grl_source_supported_operations (GRL_SOURCE (source)) &
        GRL_OP_STORE)) {
     gtk_widget_set_sensitive (view->store_btn, TRUE);
-  } else if (content && GRL_IS_MEDIA_BOX (content) &&
+  } else if (content && grl_media_is_container (content) &&
             grl_source_supported_operations (GRL_SOURCE (source)) &
             GRL_OP_STORE_PARENT) {
     gtk_widget_set_sensitive (view->store_btn, TRUE);
@@ -1199,7 +1199,7 @@ store_btn_clicked_cb (GtkButton *btn, gpointer user_data)
     GrlMedia *media;
     const gchar *url = gtk_entry_get_text (GTK_ENTRY (e2));
     if (!url || !url[0]) {
-      media = grl_media_box_new ();
+      media = grl_media_container_new ();
     } else {
       media = grl_media_new ();
       grl_media_set_url (media, url);
@@ -1207,7 +1207,7 @@ store_btn_clicked_cb (GtkButton *btn, gpointer user_data)
     grl_media_set_title (media, gtk_entry_get_text (GTK_ENTRY (e1)));
     grl_media_set_description (media,
                                     gtk_entry_get_text (GTK_ENTRY (e3)));
-    grl_source_store (source, GRL_MEDIA_BOX (container),
+    grl_source_store (source, container,
                       media, GRL_WRITE_FULL, store_cb, NULL);
   }
 
@@ -2207,7 +2207,7 @@ content_changed_cb (GrlSource *source,
   for (i = 0; i < changed_medias->len; i++) {
     media = g_ptr_array_index (changed_medias, i);
     media_id = grl_media_get_id (media);
-    if (GRL_IS_MEDIA_BOX (media)) {
+    if (grl_media_is_container (media)) {
       message =
         g_strdup_printf ("%s: container '%s' has %s%s",
                          grl_source_get_name (source),


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