Example #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
}
Example #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
}
Example #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
}
Example #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
}
Example #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
}
// 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
}
Example #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

}
Example #8
0
// 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
}
Example #9
0
// 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
}
Example #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
}
Example #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
}
Example #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
}