Exemple #1
0
static void
download_preview_cb(GObject* source,
                    GAsyncResult* res,
                    gpointer udata)
{
    GError* error = NULL;

    GdkPixbuf* pic = g_task_propagate_pointer(G_TASK(res), &error);

    if (error)
    {
        g_error_free(error);
        return;
    }
    GtChannel* self = GT_CHANNEL(udata);
    GtChannelPrivate* priv = gt_channel_get_instance_private(self);

    if (pic)
    {
        g_clear_object(&priv->preview);
        priv->preview_timestamp = utils_timestamp_now();
        priv->preview = pic;
        utils_pixbuf_scale_simple(&priv->preview,
                                  320, 180,
                                  GDK_INTERP_BILINEAR);
        g_object_notify_by_pspec(G_OBJECT(self), props[PROP_PREVIEW]);
    }

    priv->updating = FALSE;
    g_object_notify_by_pspec(G_OBJECT(self), props[PROP_UPDATING]);
}
Exemple #2
0
static void
set_property(GObject*      obj,
             guint         prop,
             const GValue* val,
             GParamSpec*   pspec)
{
    GtGame* self = GT_GAME(obj);
    GtGamePrivate* priv = gt_game_get_instance_private(self);

    switch (prop)
    {
        case PROP_ID:
            priv->id = g_value_get_int64(val);
            break;
        case PROP_NAME:
            if (priv->name)
                g_free(priv->name);
            priv->name = g_value_dup_string(val);
            if (!priv->name)
                priv->name = "Untitled broadcast";
            break;
        case PROP_PREVIEW:
            if (priv->preview)
                g_object_unref(priv->preview);
            priv->preview = g_value_ref_sink_object(val);
            utils_pixbuf_scale_simple(&priv->preview,
                                      200, 270,
                                      GDK_INTERP_BILINEAR);
            break;
        case PROP_LOGO:
            if (priv->logo)
                g_object_unref(priv->logo);
            priv->logo = g_value_dup_object(val);
            break;
        case PROP_VIEWERS:
            priv->viewers = g_value_get_int64(val);
            break;
        case PROP_CHANNELS:
            priv->channels = g_value_get_int64(val);
            break;
        default:
            G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, prop, pspec);
    }
}
Exemple #3
0
static inline void
set_banner(GtChannel* self, GdkPixbuf* banner, gboolean save, gboolean set_preview)
{
    GtChannelPrivate* priv = gt_channel_get_instance_private(self);

    g_clear_object(&priv->video_banner);
    priv->video_banner = banner;

    if (save)
        gdk_pixbuf_save(priv->video_banner, priv->cache_filename,
                        "jpeg", NULL, NULL);

    utils_pixbuf_scale_simple(&priv->video_banner,
                              320, 180,
                              GDK_INTERP_BILINEAR);

    if (set_preview)
    {
        priv->preview = priv->video_banner;
        g_object_notify_by_pspec(G_OBJECT(self), props[PROP_PREVIEW]);
    }
}