Managing Redrawing

As you already saw in the previous section; you trigger updates by calling cc_item_dirty. Once a view requests the item to be redrawn, it triggers the CcSimpleItem::render signal.

static void
render_item (CcItem* item,
             CcView* view,
             cairo_t* cr,
             gpointer user_data)
{
        /* render the item to the canvas */
        cairo_rectangle (cr, 0.0, 0.0, 100.0, 100.0);
        cairo_set_source_rgba (cr, 1.0, 1.0, 1.0);
        cairo_fill (cr);
}

…
        g_signal_connect (custom_item, "render",
                          G_CALLBACK (render_item), NULL);
…