Beispiel #1
0
func (v *SourceLanguageManager) SetSearchPath(paths []string) {
	cpaths := C.make_strings(C.int(len(paths) + 1))
	for i, path := range paths {
		ptr := C.CString(path)
		defer cfree(ptr)
		C.set_string(cpaths, C.int(i), gstring(ptr))
	}
	C.set_string(cpaths, C.int(len(paths)), nil)
	C.gtk_source_language_manager_set_search_path(v.GSourceLanguageManager, cpaths)
	C.destroy_strings(cpaths)
}
Beispiel #2
0
// SetDocumenters is a wrapper around gtk_about_dialog_set_documenters().
func (v *AboutDialog) SetDocumenters(documenters []string) {
	cdocumenters := C.make_strings(C.int(len(documenters) + 1))
	for i, doc := range documenters {
		cstr := C.CString(doc)
		defer C.free(unsafe.Pointer(cstr))
		C.set_string(cdocumenters, C.int(i), (*C.gchar)(cstr))
	}

	C.set_string(cdocumenters, C.int(len(documenters)), nil)
	C.gtk_about_dialog_set_documenters(v.native(), cdocumenters)
	C.destroy_strings(cdocumenters)
}
Beispiel #3
0
// SetArtists is a wrapper around gtk_about_dialog_set_artists().
func (v *AboutDialog) SetArtists(artists []string) {
	cartists := C.make_strings(C.int(len(artists) + 1))
	for i, artist := range artists {
		cstr := C.CString(artist)
		defer C.free(unsafe.Pointer(cstr))
		C.set_string(cartists, C.int(i), (*C.gchar)(cstr))
	}

	C.set_string(cartists, C.int(len(artists)), nil)
	C.gtk_about_dialog_set_artists(v.native(), cartists)
	C.destroy_strings(cartists)
}
Beispiel #4
0
func (t Terminal) Fork(args []string) {
	argv := C.make_strings(C.int(len(args) + 1))
	defer C.free(unsafe.Pointer(argv))
	for i, arg := range args {
		ptr := C.CString(arg)
		defer C.free(unsafe.Pointer(ptr))
		C.set_string(argv, C.int(i), ptr)
	}
	C.set_string(argv, C.int(len(args)), nil)
	C.vte_terminal_fork_command_full(C.toVTerminal(t.Widget), C.VTE_PTY_DEFAULT,
		nil, argv, nil, C.G_SPAWN_SEARCH_PATH, nil, nil, nil, nil)
}
Beispiel #5
0
// Run is a wrapper around g_application_run().
func (v *Application) Run(args []string) int {
	cargs := C.make_strings(C.int(len(args)))
	defer C.destroy_strings(cargs)

	for i, arg := range args {
		cstr := C.CString(arg)
		defer C.free(unsafe.Pointer(cstr))
		C.set_string(cargs, C.int(i), (*C.char)(cstr))
	}

	C.set_string(cargs, C.int(len(args)), nil)

	return int(C.g_application_run(v.native(), C.int(len(args)), cargs))
}
Beispiel #6
0
// AddCreditSection is a wrapper around gtk_about_dialog_add_credit_section().
func (v *AboutDialog) AddCreditSection(sectionName string, people []string) {
	cname := (*C.gchar)(C.CString(sectionName))
	defer C.free(unsafe.Pointer(cname))

	cpeople := C.make_strings(C.int(len(people)) + 1)
	defer C.destroy_strings(cpeople)
	for i, p := range people {
		cp := (*C.gchar)(C.CString(p))
		defer C.free(unsafe.Pointer(cp))
		C.set_string(cpeople, C.int(i), cp)
	}
	C.set_string(cpeople, C.int(len(people)), nil)

	C.gtk_about_dialog_add_credit_section(v.native(), cname, cpeople)
}
// SetAccelsForAction is a wrapper around gtk_application_set_accels_for_action().
func (v *Application) SetAccelsForAction(act string, accels []string) {
	cstr1 := (*C.gchar)(C.CString(act))
	defer C.free(unsafe.Pointer(cstr1))

	caccels := C.make_strings(C.int(len(accels) + 1))
	defer C.destroy_strings(caccels)

	for i, accel := range accels {
		cstr := C.CString(accel)
		defer C.free(unsafe.Pointer(cstr))
		C.set_string(caccels, C.int(i), (*C.gchar)(cstr))
	}

	C.set_string(caccels, C.int(len(accels)), nil)

	C.gtk_application_set_accels_for_action(v.native(), cstr1, caccels)
}