Parsing of custom resources: CTK+ 3 Reference Manual

## Parsing of custom resources

As a consequence of the RC format going away, calling `ctk_rc_parse()` or `ctk_rc_parse_string()` won't have any effect on a widgets appearance. The way to replace these calls is using a custom CtkStyleProvider, either for an individual widget through `ctk_style_context_add_provider()` or for all widgets on a screen through `ctk_style_context_add_provider_for_screen()`. Typically, the provider will be a CtkCssProvider, which parse CSS information from a file or from a string.

Example 49. Using a custom CtkStyleProvider

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    CtkStyleContext *context;
    CtkCssProvider *provider;

    context = ctk_widget_get_style_context (widget);
    provider = ctk_css_provider_new ();
    ctk_css_provider_load_from_data (CTK_CSS_PROVIDER (provider),
                                     ".frame1 {\n"
                                     "   border-image: url('gradient1.png') 10 10 10 10 stretch;\n"
                                     "}\n", -1, NULL);
    ctk_style_context_add_provider (context,
                                    CTK_STYLE_PROVIDER (provider),
                                    CTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
    g_object_unref (provider);

Notice that you can also get style information from custom resources by implementing the CtkStyleProvider interface yourself. This is an advanced feature that should be rarely used.