Пример #1
0
static gboolean
mex_suggest_timeout_cb (MexSearchPlugin *self)
{
  gchar *uri;
  const gchar *text;
  MexDownloadQueue *dq;

  MexSearchPluginPrivate *priv = self->priv;

  priv->suggest_timeout = 0;

  text = mx_entry_get_text (MX_ENTRY (priv->search_entry));

  dq = mex_download_queue_get_default ();

  if (priv->suggest_id)
    mex_download_queue_cancel (dq, priv->suggest_id);

  uri =
    g_strdup_printf ("http://google.com/complete/search?output=toolbar&q=%s",
                     text);
  priv->suggest_id =
    mex_download_queue_enqueue (dq, uri, mex_suggest_complete_cb, self);

  return FALSE;
}
Пример #2
0
static void
mex_epg_radiotimes_get_events (MexEpgProvider      *provider,
                               MexChannel          *channel,
                               GDateTime           *start_date,
                               GDateTime           *end_date,
                               MexEpgProviderReply  reply,
                               gpointer             user_data)
{
  MexEpgRadiotimes *radiotimes = MEX_EPG_RADIOTIMES (provider);
  MexEpgRadiotimesPrivate *priv = radiotimes->priv;
  const gchar *name, *id;
  MexDownloadQueue *dq;
  gchar *data_url;
  Request *req;

  name = mex_channel_get_name (channel);
  id = g_hash_table_lookup (priv->channel2id, name);
  if (id == NULL)
    reply (provider, channel, NULL, user_data);

  req = g_slice_new (Request);
  req->provider = provider;
  req->channel = channel;
  req->start_date = g_date_time_ref (start_date);
  req->end_date = g_date_time_ref (end_date);
  req->callback = reply;
  req->user_data = user_data;

  dq = mex_download_queue_get_default ();

  data_url = g_strconcat (priv->base_url, "/", id, ".dat", NULL);
  mex_download_queue_enqueue (dq, data_url, on_epg_dat_received, req);
  g_free (data_url);
}
Пример #3
0
static void
_update_thumbnail (MexContentTile *tile)
{
  MexContentTilePrivate *priv = tile->priv;
  MexDownloadQueue *queue;
  const gchar *file;

  queue = mex_download_queue_get_default ();

  /* cancel any download already in progress */
  if (priv->download_id)
    {
      mex_download_queue_cancel (queue, priv->download_id);
      priv->download_id = NULL;
    }

  /* update thumbnail */
  file = mex_content_get_metadata (priv->content,
                                   MEX_CONTENT_METADATA_STILL);

  /* TODO: Display a spinner? */
  if (file)
    priv->download_id =
      mex_download_queue_enqueue (queue, file,
                                  download_queue_completed,
                                  tile);
  else
    priv->thumbnail_loaded = TRUE;
}
Пример #4
0
static void
_update_thumbnail (MexContentTile *tile)
{
  MexContentTilePrivate *priv = tile->priv;
  MexDownloadQueue *queue;
  const gchar *uri;
  GFile *file;

  queue = mex_download_queue_get_default ();

  /* cancel any download already in progress */
  if (priv->download_id)
    {
      mex_download_queue_cancel (queue, priv->download_id);
      priv->download_id = NULL;
    }

  /* update thumbnail */
  uri = mex_content_get_metadata (priv->content,
                                  MEX_CONTENT_METADATA_STILL);
  if (uri)
    {
      file = g_file_new_for_uri (uri);

      /* TODO: Display a spinner? */
      if (file)
        {
          gchar *path = g_file_get_path (file);

          if (path)
            {
              mx_image_set_from_file_at_size (MX_IMAGE (priv->image), path,
                                              priv->thumb_width,
                                              priv->thumb_height,
                                              NULL);
              priv->thumbnail_loaded = TRUE;
              priv->image_set = TRUE;
              clutter_actor_set_size (priv->image,
                                      priv->thumb_width, priv->thumb_height);
              g_free (path);
            }
          else
            {
              priv->download_id =
                mex_download_queue_enqueue (queue, uri,
                                            download_queue_completed,
                                            tile);
            }

          g_object_unref (file);
        }
    }
  else
    priv->thumbnail_loaded = TRUE;
}
Пример #5
0
static void
mex_epg_radiotimes_grab_channel_list (MexEpgRadiotimes *provider)
{
  MexEpgRadiotimesPrivate *priv = provider->priv;
  gchar *channels_dat_url;
  MexDownloadQueue *dq;

  dq = mex_download_queue_get_default ();
  channels_dat_url = g_strconcat (priv->base_url, "/channels.dat", NULL);
  mex_download_queue_enqueue (dq, channels_dat_url,
                              on_channel_dat_received, provider);
  g_free (channels_dat_url);
}