Null-terminated the GtkLayout stylesheet string. This will be handy for consolidating all the GTK+ stylesheet stuff into a single Go-side init function. (Thanks to mischief, nsf, and dsal in irc.badnik.net/#go-nuts for confirming that this is valid.)

This commit is contained in:
Pietro Gagliardi 2014-06-02 13:13:16 -04:00
parent e28dff429d
commit 726f047655
1 changed files with 2 additions and 2 deletions

View File

@ -96,14 +96,14 @@ func gtk_window_get_size(window *C.GtkWidget) (int, int) {
var gtkLayoutCSS = []byte(`GtkLayout { var gtkLayoutCSS = []byte(`GtkLayout {
background-color: transparent; background-color: transparent;
} }
`) ` + "\000")
func makeTransparent(layout *C.GtkWidget) { func makeTransparent(layout *C.GtkWidget) {
var err *C.GError = nil var err *C.GError = nil
provider := C.gtk_css_provider_new() provider := C.gtk_css_provider_new()
added := C.gtk_css_provider_load_from_data(provider, added := C.gtk_css_provider_load_from_data(provider,
(*C.gchar)(unsafe.Pointer(&gtkLayoutCSS[0])), C.gssize(len(gtkLayoutCSS)), &err) (*C.gchar)(unsafe.Pointer(&gtkLayoutCSS[0])), -1, &err)
if added == C.FALSE { if added == C.FALSE {
message := fromgstr(err.message) message := fromgstr(err.message)
panic(fmt.Errorf("error loading transparent background CSS for GtkLayout: %s", message)) panic(fmt.Errorf("error loading transparent background CSS for GtkLayout: %s", message))