Esempio n. 1
0
func New(textview *gtk.GtkTextView, language string) (*GtkSpell, *glib.Error) {
	var lang *C.char
	if len(language) > 0 {
		lang = C.CString(language)
		defer C.free(unsafe.Pointer(lang))
	}

	var gerror *C.GError
	v := C.gtkspell_new_attach(C.to_GtkTextView(unsafe.Pointer(textview.Widget)), C.to_gcharptr(lang), &gerror)
	if gerror != nil {
		return nil, glib.ErrorFromNative(unsafe.Pointer(gerror))
	}
	return &GtkSpell{v}, nil
}
Esempio n. 2
0
func New(textview *gtk.GtkTextView, language string) (*GtkSpellChecker, *glib.Error) {
	var lang *C.char
	if len(language) > 0 {
		lang = C.CString(language)
		defer C.free(unsafe.Pointer(lang))
	}

	var gerror *C.GError
	v := C.gtk_spell_checker_new()
	if C.gtk_spell_checker_set_language(v, (*C.gchar)(unsafe.Pointer(lang)), &gerror) == 0 {
		return nil, glib.ErrorFromNative(unsafe.Pointer(gerror))
	}
	C.gtk_spell_checker_attach(v, C.to_GtkTextView(unsafe.Pointer(textview.Widget)))
	return &GtkSpellChecker{v}, nil
}