Exemple #1
0
// Value release the index reference and returns the list content.
// You just have to assert to a map[string]*ExpectedType
//
func (im *itemMap) Value() interface{} {
	defer im.Release()
	switch im.typ {
	case itemMapTypeAnimation:
		C.list_animation(gldi.CIntPointer(im.ID))

		ret := make(map[string]*gldi.Animation)
		for name, mod := range im.list {
			ret[name] = mod.(*gldi.Animation)
		}
		return ret
	// return im.Value().(map[string]*gldi.Animation)

	case itemMapTypeCairoDeskletDecoration:
		C.list_desklet_decoration(gldi.CIntPointer(im.ID))

		ret := make(map[string]*gldi.CairoDeskletDecoration)
		for name, mod := range im.list {
			ret[name] = mod.(*gldi.CairoDeskletDecoration)
		}
		return ret

	case itemMapTypeCairoDockRenderer:
		C.list_dock_renderer(gldi.CIntPointer(im.ID))

		ret := make(map[string]*gldi.CairoDockRenderer)
		for name, mod := range im.list {
			ret[name] = mod.(*gldi.CairoDockRenderer)
		}
		return ret

	case itemMapTypeDialogDecorator:
		C.list_dialog_decorator(gldi.CIntPointer(im.ID))

		ret := make(map[string]*gldi.DialogDecorator)
		for name, mod := range im.list {
			ret[name] = mod.(*gldi.DialogDecorator)
		}
		return ret

	case itemMapTypeModule:
		C.list_dock_module(gldi.CIntPointer(im.ID))

		ret := make(map[string]*gldi.Module)
		for name, mod := range im.list {
			ret[name] = mod.(*gldi.Module)
		}
		return ret
	}
	return nil
}
Exemple #2
0
// Value release the index reference and returns the list content.
// You just have to assert to a []*ExpectedType
//
func (il *itemList) Value() interface{} {
	defer il.Release()

	switch il.typ {
	case itemListTypeDesklet:
		C.list_desklets(gldi.CIntPointer(il.ID))

		var ret []*gldi.Desklet
		for _, mod := range il.list {
			ret = append(ret, mod.(*gldi.Desklet))
		}
		return ret

	case itemListTypeShortkey:
		C.list_shortkey(gldi.CIntPointer(il.ID))

		var ret []cdglobal.Shortkeyer
		for _, mod := range il.list {
			ret = append(ret, mod.(cdglobal.Shortkeyer))
		}
		return ret
	}
	return nil
}