コード例 #1
0
/* The caller is responsible for freeing @error. */
static void
resolve_data_finish_operation (ResolveData   *data,
                               const gchar   *op_name,
                               const GError  *error)
{
  g_assert (data->n_pending_operations >= 1);
  data->n_pending_operations--;

  GRL_DEBUG ("Finishing operation %s; %u operations still pending.",
             op_name, data->n_pending_operations);

  if (!data->has_invoked_callback &&
      (data->n_pending_operations == 0 || error != NULL)) {
    GrlSourceResolveSpec *rs = data->rs;

    /* All sub-operations have finished (or one has errored), so the callback
     * can be invoked. */
    data->has_invoked_callback = TRUE;
    rs->callback (data->source, rs->operation_id, rs->media,
                  rs->user_data, error);
  }

  /* All sub-operations have finished, so we can free the closure. */
  if (data->n_pending_operations == 0) {
    g_assert (data->has_invoked_callback);

    g_object_unref (data->source);
    g_slice_free (ResolveData, data);
  }
}
コード例 #2
0
ファイル: grl-vimeo.c プロジェクト: GNOME/grilo-plugins
static void
video_get_play_url_cb (const gchar *url, gpointer user_data)
{
  GrlSourceResolveSpec *rs = (GrlSourceResolveSpec *) user_data;

  if (url) {
    grl_media_set_url (rs->media, url);
  }

  rs->callback (rs->source, rs->operation_id, rs->media, rs->user_data, NULL);
}