44 lines
1.5 KiB
Java
44 lines
1.5 KiB
Java
package io.gitlab.jfronny.inceptum.gtk.control;
|
|
|
|
import ch.bailu.gtk.gtk.*;
|
|
import ch.bailu.gtk.type.*;
|
|
import io.gitlab.jfronny.inceptum.launcher.system.instance.Instance;
|
|
|
|
public class InstanceThumbnail extends Stack {
|
|
private static final Str SPINNER = new Str("spinner");
|
|
private static final Str IMAGE = new Str("image");
|
|
private static final Str GENERIC = new Str("generic");
|
|
|
|
public InstanceThumbnail(CPointer pointer) {
|
|
super(pointer);
|
|
}
|
|
|
|
public InstanceThumbnail() {
|
|
super();
|
|
var spinner = new Spinner();
|
|
var image = new Image();
|
|
var generic = new Image();
|
|
spinner.setName(SPINNER);
|
|
image.setName(IMAGE);
|
|
generic.setName(GENERIC);
|
|
generic.setFromIconName(new Str("media-playback-start-symbolic")); //TODO better default icon
|
|
addNamed(spinner, SPINNER);
|
|
addNamed(image, IMAGE);
|
|
addNamed(generic, GENERIC);
|
|
}
|
|
|
|
public void bind(Instance entry) {
|
|
var spinner = new Spinner(getChildByName(SPINNER).cast());
|
|
var image = new Image(getChildByName(IMAGE).cast()); //TODO
|
|
var generic = new Image(getChildByName(GENERIC).cast());
|
|
//TODO mark instance being played
|
|
if (entry.isSetupLocked()) {
|
|
setVisibleChild(spinner);
|
|
} else if (false) { // if the instance has an image, load the image data and set it as the visible child
|
|
setVisibleChild(image);
|
|
} else {
|
|
setVisibleChild(generic);
|
|
}
|
|
}
|
|
}
|