 		imagePopup?.isEnabled = false
 	}
 	
+	// load the images into the popup
+	func adjustImagePopup() {
+		imagePopup?.removeAllItems()
+		guard let images = allImages?.value, images.count > 0 else { return }
+		var currentBatch = images[0].batchId
+		for anImage in images {
+			if anImage.batchId != currentBatch {
+				imagePopup?.menu?.addItem(NSMenuItem.separator())
+				currentBatch = anImage.batchId
+			}
+			let item = NSMenuItem(title: anImage.name, action: #selector(selectImage(_:)), keyEquivalent: "")
+			item.tag = anImage.id
+			item.target = self
+			item.toolTip = anImage.name
+			item.representedObject = anImage
+			imagePopup?.menu?.addItem(item)
+		}
+	}
+	
+	// MARK: - actions
 	@IBAction func navigateClicked(_ sender: AnyObject?) {
 		switch (navigateButton?.selectedSegment)! {
 		case 0:

	fileprivate let emptyObject: Any = 1 as Any
	var selectedImageId: Int { return selectedImage?.id ?? 0 }
	
	override func viewDidLoad() {
		super.viewDidLoad()
		pageController = NSPageController()

	}
}

// MARK: -
//controller shown in the page controller
class ImageViewController: NSViewController {
	var didAddConstraints = false
	var imageLoadDisposable: Disposable?
