Writing Css inside Javascript



Hi,

Did anyone have a working code which loads css using
Gtk.CssProvider.load_from_data()? Following code is not working,

const Gtk = imports.gi.Gtk;
var css = "GtkWindow { background-color: red }";
var window = new Gtk.Window({title: "test"});
var styleContext = window.get_style_context();
var cssProvider = new Gtk.CssProvider();

window.set_default_size(400, 400);
window.connect("destroy", Gtk.main_quit);
styleContext.add_provider(cssProvider,
	Gtk.GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
cssProvider.load_from_data(css, -1, null);

window.show_all();
Gtk.main();


What kind of name I should use instead of 'GtkWindow' in javascript?
Even Gtk.Window is not working. These same steps works perfectly If I
write it in C instead of JavaScript.

Thanks,
Mohan R



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