func startGui(width, height int, title string, port int) { C.gtk_init(nil, nil) //gtk.Init(nil) window := C.window window = C.gtk_window_new(C.GTK_WINDOW_TOPLEVEL) C.gtk_window_set_title(C.to_GtkWindow(window), C.to_gcharptr(C.CString(title))) C.connect_destroy(window) vbox := C.gtk_hbox_new(0, 1) C.webview = C._new_webkit() C.gtk_container_add(C.to_GtkContainer(vbox), C.webview) C.loadUri(C.webview, C.to_gcharptr(C.CString(fmt.Sprintf("http://127.0.0.1:%d", port)))) C.gtk_container_add(C.to_GtkContainer(window), vbox) C.gtk_widget_set_size_request(window, C.gint(width), C.gint(height)) C.gtk_widget_show(vbox) C.gtk_widget_show(window) //Window.ShowAll() C.gtk_widget_show(C.webview) /* This only matters if proxy is stupid! proxy := os.Getenv("HTTP_PROXY") if len(proxy) > 0 { ptr := C.CString(uri) C.proxyshit(ptr) C.free(ptr) } */ C.gtk_main() //gtk.GtkMain() }
// Create new window func NewWindow(wtype GtkWindowType, properties map[string]interface{}) (w *Window) { w = &Window{} o := C.gtk_window_new(C.GtkWindowType(wtype)) w.Container = NewContainer(unsafe.Pointer(o)) w.object = C.to_GtkWindow(unsafe.Pointer(o)) return w }
// Conversion function for gobject registration map func newWindowFromNative(obj unsafe.Pointer) interface{} { var window Window window.object = C.to_GtkWindow(obj) window.Container = NewContainer(unsafe.Pointer(window.object)) return &window }