scoop:scoop.desktop:0.1.0
src/tasks.scoop
Selected production source · src/tasks.scoop
1
package scoop.desktop3
import scoop.window.RequestStatus5
internal fun publishJumpList(owner: DesktopOwner, tasks: Array<JumpListTask>): RequestStatus {6
@Unsafe7
{8
val native = desktopCreated(nativeTasksCreate(owner.pointer!!), "Jump List")9
try {10
for (task in tasks) {11
val icon =12
when (task.icon) {13
case Some(val value) -> value.path.toOsString().toUtf16()14
case None -> []15
}16
task.title.withUtf8Bytes {17
title,18
titleLength -> @Unsafe19
{20
(task.description ?: "").withUtf8Bytes {21
description,22
descriptionLength -> @Unsafe23
{24
icon.withDataPointer {25
path,26
count -> @Unsafe27
{28
desktopStatus(29
nativeTasksAdd(30
native,31
title,32
titleLength,33
description,34
descriptionLength,35
path,36
count,37
task.icon?.index ?: 038
),39
"Jump List task"40
)41
}42
}43
}44
}45
}46
}47
for (argument in task.arguments)48
argument.withUtf8Bytes {49
text,50
length -> @Unsafe51
{52
desktopStatus(53
nativeTasksArgument(native, text, length),54
"Jump List argument"55
)56
}57
}58
}59
return desktopStatus(nativeTasksCommit(native), "publish Jump List")60
} finally {61
nativeTasksDestroy(native)62
}63
}64
}