Re: [Vala] How to change the widget color



    var screen = Gdk.Screen.get_default();
    var css_provider = new Gtk.CssProvider();
    string style_path = "Estilo.css";
    css_provider.load_from_path(style_path);
    Gtk.StyleContext.add_provider_for_screen(
        screen, css_provider,
        Gtk.STYLE_PROVIDER_PRIORITY_USER);


If you want you can review the code of my player:
https://github.com/fdanesse/JAMediaSuite/tree/master/JAMedia/vala
Incidentally, I accept tips to improve it, I come from python so surely my
vala code can be substantially improved.

2015-03-11 16:08 GMT-03:00 Erick Pérez Castellanos <erickpc gnome org>:

Hi:

You need to take into account that vala is only a kind-of preprocessor
that converts Vala language into C, so using devhelp and Gtk+ [1]
documentation works perfectly fine.

You need to use GtkCssProvider to do this. gtk_widget_override family
of functions are deprecated.

1. Obtain your widget GtkStyleContext
2. Attach a custom CSS class
3. Load some CSS sinppets with the customization you want using
GtkCssProvider API.

Cheers

[1]: https://developer.gnome.org/gtk3/stable
_______________________________________________
vala-list mailing list
vala-list gnome org
https://mail.gnome.org/mailman/listinfo/vala-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]