Пример #1
0
Файл: icon.go Проект: sqp/godock
// TODO: may have to move.
func (o *dockIcon) SubDockIcons() []Icon {
	if o.Ptr == nil || o.Ptr.pSubDock == nil {
		return nil
	}
	clist := glib.WrapList(uintptr(unsafe.Pointer(o.Ptr.pSubDock.icons)))
	return goListIcons(clist)
}
Пример #2
0
// GetWindows is a wrapper around gtk_application_get_windows().
// Returned list is wrapped to return *gtk.Window elements.
func (v *Application) GetWindows() *glib.List {
	glist := C.gtk_application_get_windows(v.native())
	list := glib.WrapList(uintptr(unsafe.Pointer(glist)))
	list.DataWrapper(func(ptr unsafe.Pointer) interface{} {
		return wrapWindow(wrapObject(ptr))
	})
	runtime.SetFinalizer(list, func(l *glib.List) {
		l.Free()
	})
	return list
}
Пример #3
0
// ListDevices() is a wrapper around gdk_device_manager_list_devices().
func (v *DeviceManager) ListDevices(tp DeviceType) *glib.List {
	clist := C.gdk_device_manager_list_devices(v.native(), C.GdkDeviceType(tp))
	if clist == nil {
		return nil
	}
	glist := glib.WrapList(uintptr(unsafe.Pointer(clist)))
	glist.DataWrapper(func(ptr unsafe.Pointer) interface{} {
		return &Device{&glib.Object{glib.ToGObject(ptr)}}
	})
	runtime.SetFinalizer(glist, func(glist *glib.List) {
		glist.Free()
	})
	return glist
}
Пример #4
0
// MenuItems returns the list of extra commands for the class, by packs of 3
// strings: Name, Command, Icon.
//
func (class Info) MenuItems() (ret [][]string) {
	cClass := (*C.gchar)(C.CString(class.String()))
	defer C.free(unsafe.Pointer((*C.char)(cClass)))
	c := C.cairo_dock_get_class_menu_items(cClass) // do not free.
	list := glib.WrapList(uintptr(unsafe.Pointer(c)))
	for i := list.Length(); i > uint(0); i-- {

		chars := (*[3]*C.gchar)(list.Data().(unsafe.Pointer))
		ret = append(ret, []string{
			C.GoString((*C.char)(chars[0])),
			C.GoString((*C.char)(chars[1])),
			C.GoString((*C.char)(chars[2])),
		})

		list = list.Next()
	}
	return ret
}
Пример #5
0
func (v *DragContext) ListTargets() *glib.List {
	c := C.gdk_drag_context_list_targets(v.native())
	return glib.WrapList(uintptr(unsafe.Pointer(c)))
}