Exemple #1
0
// Returns all the icons in the theme, including inherited and hicolor icons.
func (t GTKTheme) GetAllIcons() []string {
	// Get the list of all icons in this theme.
	out := make([]string, 0)
	list := C.gtk_icon_theme_list_icons(t.theme, nil)
	defer C.g_list_free(list)

	// Convert the list into a slice, freeing used elements as we go.
	for ptr := list; ptr != nil; ptr = ptr.next {
		out = append(out, C.GoString((*C.char)(ptr.data)))
		C.g_free(ptr.data)
	}

	return out
}
Exemple #2
0
func (c *Client) QueryBySubsystem(subsystem string) []Device {
	l := C.g_udev_client_query_by_subsystem(c.p, (*C.gchar)(C.CString(subsystem)))
	result := make([]Device, C.g_list_length(l))
	for i := range result {
		p := (*C.struct__GUdevDevice)(l.data)
		device := Device{
			p: p,
		}
		runtime.SetFinalizer(&device, func(device *Device) {
			C.g_object_unref((C.gpointer)(device.p))
		})
		result[i] = device
		l = l.next
	}
	C.g_list_free(l)

	return result
}
Exemple #3
0
func (v List) Free() {
	C.g_list_free(v.GList)
}
Exemple #4
0
func (self *GList) Free() {
	C.g_list_free(self.object)
}
Exemple #5
0
// Free is a wrapper around g_list_free().
func (v *List) Free() {
	glist := (*C.GList)(unsafe.Pointer(v))
	C.g_list_free(glist)
}