Esempio n. 1
0
const MexGriloOperation *
mex_grilo_feed_get_operation (MexGriloFeed *feed)
{
  MexGriloFeedPrivate *priv;

  g_return_val_if_fail (MEX_IS_GRILO_FEED (feed), NULL);

  priv = feed->priv;

  return priv->op;
}
Esempio n. 2
0
MexProgram *
mex_grilo_program_new (MexGriloFeed *feed, GrlMedia *media)
{
  g_return_val_if_fail (MEX_IS_GRILO_FEED (feed), NULL);
  g_return_val_if_fail (GRL_IS_MEDIA (media), NULL);

  return g_object_new (MEX_TYPE_GRILO_PROGRAM,
                       "feed", feed,
                       "grilo-media", media,
                       NULL);
}
Esempio n. 3
0
void
mex_grilo_feed_set_open_callback (MexGriloFeed       *feed,
                                  MexGriloFeedOpenCb  callback)
{
  MexGriloFeedPrivate *priv;

  g_return_if_fail (MEX_IS_GRILO_FEED (feed));

  priv = feed->priv;

  priv->open_callback = callback;
}
Esempio n. 4
0
void
mex_grilo_feed_open (MexGriloFeed    *feed,
                     MexGriloProgram *program)
{
  MexGriloFeedPrivate *priv;

  g_return_if_fail (MEX_IS_GRILO_FEED (feed));
  g_return_if_fail (MEX_IS_GRILO_PROGRAM (program));

  priv = feed->priv;

  if (priv->open_callback)
    priv->open_callback (program, feed);
}
Esempio n. 5
0
void
mex_grilo_feed_browse (MexGriloFeed *feed,
                       int           offset,
                       int           limit)
{
  MexGriloFeedPrivate *priv;

  g_return_if_fail (MEX_IS_GRILO_FEED (feed));

  priv = feed->priv;

  mex_grilo_feed_init_op (feed);
  mex_model_clear (MEX_MODEL (feed));

  priv->op->type = MEX_GRILO_FEED_OPERATION_BROWSE;
  priv->op->offset = offset;
  priv->op->limit = limit;
  priv->op->count = 0;

  mex_grilo_feed_start_op (feed);
}
Esempio n. 6
0
void
mex_grilo_feed_query (MexGriloFeed *feed,
                      const char   *query,
                      int           offset,
                      int           limit)
{
  MexGriloFeedPrivate *priv;

  g_return_if_fail (MEX_IS_GRILO_FEED (feed));

  priv = feed->priv;

  mex_grilo_feed_init_op (feed);
  mex_model_clear (MEX_MODEL (feed));

  priv->op->type = MEX_GRILO_FEED_OPERATION_QUERY;
  priv->op->offset = offset;
  priv->op->limit = limit;
  priv->op->count = 0;
  priv->op->text = g_strdup (query);

  mex_grilo_feed_start_op (feed);
}
Esempio n. 7
0
gboolean
mex_grilo_feed_get_completed (MexGriloFeed *feed)
{
  g_return_val_if_fail (MEX_IS_GRILO_FEED (feed), FALSE);
  return feed->priv->completed;
}
Esempio n. 8
0
/* When the MexContent set on the queue button is a directory we
 * try to add the children of the directory and mark the directory
 * as queued. When the child items are added to the queue model they
 * are marked as queued via the controller
 */
static void
_add_from_directory (MexQueueButton *q_button, gboolean add)
{
  MexQueueButtonPrivate *priv = q_button->priv;
  MexFeed *feed;
  GrlSource *source;
  GList *metadata_keys;
  GList *query_keys;

  const gchar *filter;
  const gchar *stream_uri;

  /* check if this content is a group */
  if (MEX_IS_GROUP_ITEM (priv->content))
    {
      MexModel *model;

      model = mex_group_item_get_model (MEX_GROUP_ITEM (priv->content));

      _add_remove_recursive (priv->queue_model,
                             g_object_ref (model),
                             add);

      /* _add_remove_recursive will unref feed */

      mex_content_set_metadata (priv->content, MEX_CONTENT_METADATA_QUEUED,
                                (add) ? "yes" : NULL);

      return;
    }


  if (!MEX_IS_GRILO_PROGRAM (priv->content))
    return;

  g_object_get (priv->content, "feed", &feed, NULL);

  if (MEX_IS_GRILO_FEED (feed))
    {
      g_object_get (feed,
                    "grilo-source", &source,
                    "grilo-query-keys", &query_keys,
                    "grilo-metadata-keys", &metadata_keys,
                    NULL);

      stream_uri =
        mex_content_get_metadata (priv->content, MEX_CONTENT_METADATA_STREAM);

      /* tracker filesystem feed */
      if (MEX_IS_GRILO_TRACKER_FEED (feed))
        {
          gchar *orig_filter;
          g_object_get (feed, "tracker-filter", &orig_filter, NULL);

                   filter =
            g_strdup_printf("FILTER(fn:starts-with(nie:url(?urn), '%s'))",
                            stream_uri);

          feed = mex_grilo_tracker_feed_new (source,
                                             query_keys,
                                             metadata_keys,
                                             filter, NULL);

          mex_grilo_feed_query (MEX_GRILO_FEED (feed), orig_filter, 0,
                                G_MAXINT);
          if (orig_filter)
            g_free (orig_filter);
        }
      /* We already know that the content is ia MexGriloProgram
       * box provides the root Grlio media content.
       * filesystem grilo feed
       */
      else
        {
          GrlMedia *box;
          g_object_get (priv->content, "grilo-media", &box, NULL);

          feed = mex_grilo_feed_new (source, query_keys, metadata_keys, box);
          mex_grilo_feed_browse (MEX_GRILO_FEED (feed), 0, G_MAXINT);
          g_object_unref (box);
        }
      /* unref/free the stuff we g_object_get'ed */
      if (source)
        g_object_unref (source);
      if (query_keys)
        g_list_free (query_keys);
      if (metadata_keys)
        g_list_free (metadata_keys);

      /* we don't actually want to add the priv->content into the queue model,
       * only it's children, which is where the QUEUED flag is usually set
       */

      if (add)
        {
          g_signal_connect (feed, "notify::completed",
                            G_CALLBACK (_add_directory_query_complete_cb),
                            q_button);

          mex_content_set_metadata (priv->content, MEX_CONTENT_METADATA_QUEUED,
                                    "yes");
        }
      else
        {
          g_signal_connect (feed, "notify::completed",
                            G_CALLBACK (_remove_directory_query_complete_cb),
                            q_button);

          mex_content_set_metadata (priv->content, MEX_CONTENT_METADATA_QUEUED,
                                    NULL);
        }
    }
  else
    {
      /* We're not working with a grilo feed therefore we can't help :( */
      return;
    }
}