Example #1
0
func (spell *GtkSpellChecker) SetLanguage(language string) *glib.Error {
	lang := C.CString(language)
	defer C.free(unsafe.Pointer(lang))

	var gerror *C.GError
	if C.gtk_spell_checker_set_language(spell.Spell, C.to_gcharptr(lang), &gerror) == 0 {
		return glib.ErrorFromNative(unsafe.Pointer(gerror))
	}
	return nil
}
Example #2
0
func PixbufFromFile(path string) (pixbuf *GdkPixbuf, err **glib.Error) {
	var error *C.GError
	ptr := C.CString(path)
	defer C.free_string(ptr)
	pixbuf = &GdkPixbuf{C.gdk_pixbuf_new_from_file(ptr, &error)}
	if err != nil && error != nil {
		*err = glib.ErrorFromNative(unsafe.Pointer(error))
	}
	return
}
Example #3
0
func (spell *GtkSpell) SetLanguage(language string) *glib.Error {
	lang := C.CString(language)
	defer C.free(unsafe.Pointer(lang))

	var gerror *C.GError
	C.gtkspell_set_language(spell.Spell, C.to_gcharptr(lang), &gerror)
	if gerror != nil {
		return glib.ErrorFromNative(unsafe.Pointer(gerror))
	}
	return nil
}
Example #4
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
}
Example #5
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
}