示例#1
0
func (v *GtkSourceLanguageManager) GetSearchPath() []string {
	var dirs []string
	cdirs := C.gtk_source_language_manager_get_search_path(v.LanguageManager)
	for {
		dirs = append(dirs, C.GoString(C.to_charptr(*cdirs)))
		cdirs = C.next_gcharptr(cdirs)
		if *cdirs == nil {
			break
		}
	}
	return dirs
}
示例#2
0
func (v *GtkSourceLanguageManager) GetLanguageIds() []string {
	var ids []string
	cids := C.gtk_source_language_manager_get_language_ids(v.LanguageManager)
	for {
		ids = append(ids, C.GoString(C.to_charptr(*cids)))
		cids = C.next_gcharptr(cids)
		if *cids == nil {
			break
		}
	}
	return ids
}
示例#3
0
func (v *GtkSourceLanguage) GetStyleIds() []string {
	var ids []string
	cids := C.gtk_source_language_get_globs(v.SourceLanguage)
	for {
		ids = append(ids, C.GoString(C.to_charptr(*cids)))
		cids = C.next_gcharptr(cids)
		if *cids == nil {
			break
		}
	}
	return ids
}
示例#4
0
func (v *GtkSourceLanguage) GetGlobs() []string {
	var globs []string
	cglobs := C.gtk_source_language_get_globs(v.SourceLanguage)
	for {
		globs = append(globs, C.GoString(C.to_charptr(*cglobs)))
		cglobs = C.next_gcharptr(cglobs)
		if *cglobs == nil {
			break
		}
	}
	return globs
}
示例#5
0
func (v *GtkSourceLanguage) GetMimeTypes() []string {
	var types []string
	ctypes := C.gtk_source_language_get_mime_types(v.SourceLanguage)
	for {
		types = append(types, C.GoString(C.to_charptr(*ctypes)))
		ctypes = C.next_gcharptr(ctypes)
		if *ctypes == nil {
			break
		}
	}
	return types
}
示例#6
0
// ListActionDescriptions is a wrapper around gtk_application_list_action_descriptions().
func (v *Application) ListActionDescriptions() []string {
	var descs []string
	c := C.gtk_application_list_action_descriptions(v.native())
	originalc := c
	defer C.g_strfreev(originalc)

	for *c != nil {
		descs = append(descs, C.GoString((*C.char)(*c)))
		c = C.next_gcharptr(c)
	}

	return descs
}
示例#7
0
func toGoStringArray(c **C.gchar) []string {
	var strs []string
	originalc := c
	defer C.g_strfreev(originalc)

	for *c != nil {
		strs = append(strs, C.GoString((*C.char)(*c)))
		c = C.next_gcharptr(c)
	}

	return strs

}
示例#8
0
文件: gvariant.go 项目: gotk3/gotk3
// GetStrv returns a slice of strings from this variant.  It wraps
// g_variant_get_strv, but returns copies of the strings instead.
func (v *Variant) GetStrv() []string {
	gstrv := C.g_variant_get_strv(v.native(), nil)
	// we do not own the memory for these strings, so we must not use strfreev
	// but we must free the actual pointer we receive.
	c := gstrv
	defer C.g_free(C.gpointer(gstrv))
	var strs []string

	for *c != nil {
		strs = append(strs, C.GoString((*C.char)(*c)))
		c = C.next_gcharptr(c)
	}
	return strs
}
示例#9
0
文件: gi.go 项目: bytbox/gogobject
// Convert gchar** null-terminated glib string array to []string, frees "arr"
func _GStringArrayToGoStringSlice(arr **C.gchar) []string {
	var slice []string
	if arr == nil {
		return slice
	}

	iter := arr
	for *iter != nil {
		slice = append(slice, _GStringToGoString(*iter))
		iter = C.next_gcharptr(iter)
	}
	C.g_strfreev(arr)
	return slice
}
示例#10
0
// GetDocumenters is a wrapper around gtk_about_dialog_get_documenters().
func (v *AboutDialog) GetDocumenters() []string {
	var documenters []string
	cdocumenters := C.gtk_about_dialog_get_documenters(v.native())
	if cdocumenters == nil {
		return nil
	}
	for {
		if *cdocumenters == nil {
			break
		}
		documenters = append(documenters, C.GoString((*C.char)(*cdocumenters)))
		cdocumenters = C.next_gcharptr(cdocumenters)
	}
	return documenters
}
示例#11
0
// GetArtists is a wrapper around gtk_about_dialog_get_artists().
func (v *AboutDialog) GetArtists() []string {
	var artists []string
	cartists := C.gtk_about_dialog_get_artists(v.native())
	if cartists == nil {
		return nil
	}
	for {
		if *cartists == nil {
			break
		}
		artists = append(artists, C.GoString((*C.char)(*cartists)))
		cartists = C.next_gcharptr(cartists)
	}
	return artists
}
示例#12
0
// GetAuthors is a wrapper around gtk_about_dialog_get_authors().
func (v *AboutDialog) GetAuthors() []string {
	var authors []string
	cauthors := C.gtk_about_dialog_get_authors(v.native())
	if cauthors == nil {
		return nil
	}
	for {
		if *cauthors == nil {
			break
		}
		authors = append(authors, C.GoString((*C.char)(*cauthors)))
		cauthors = C.next_gcharptr(cauthors)
	}
	return authors
}
// GetActionsForAccel is a wrapper around gtk_application_get_actions_for_accel().
func (v *Application) GetActionsForAccel(acc string) []string {
	cstr1 := (*C.gchar)(C.CString(acc))
	defer C.free(unsafe.Pointer(cstr1))

	var acts []string
	c := C.gtk_application_get_actions_for_accel(v.native(), cstr1)
	originalc := c
	defer C.g_strfreev(originalc)

	for *c != nil {
		acts = append(acts, C.GoString((*C.char)(*c)))
		c = C.next_gcharptr(c)
	}

	return acts
}