# Path: sunflower/plugin_base/monitor.py
# class MonitorSignals:
# 	CHANGED = 0  # file changed
# 	CHANGES_DONE = 1  # a hint that this was probably the last change in a set
# 	DELETED = 2  # file was deleted
# 	CREATED = 3  # file was created
# 	ATTRIBUTE_CHANGED = 4  # attribute was changed
# 	PRE_UNMOUNT = 5  # location will soon be unmounted
# 	UNMOUNTED = 6  # location was unmounted
# 	MOVED = 7  # file was moved
# 	EMBLEM_CHANGED = 8  # list of emblems has changed
# 	DIRECTORY_SIZE_CHANGED = 9  # calculated directory size has changed
# 	DIRECTORY_SIZE_STOPPED = 10  # directory size calculation has finished


import os
from random import choice
from gi.repository import Gtk, Gdk, Gio
from sunflower.plugin_base.monitor import MonitorSignals
		# groups = self._application.accelerator_manager.get_groups()
		# for group_name in groups:
		# 	group = self._application.accelerator_manager._get_group_by_name(group_name)
		# 	group.activate(self._application)

		# remove references to help clear memory
		self._provider = None
		self._selected_path = None

	def __handle_emblem_toggle(self, widget, emblem=None):
		"""Handle toggling emblem for current path."""
		manager = self._application.emblem_manager
		path, item_name = os.path.split(self._selected_path)

		update_method = (
					self._application.emblem_manager.remove_emblem,
					self._application.emblem_manager.add_emblem
				)[widget.get_active()]
		update_method(path, item_name, emblem)

		# notify monitor of our change
		parent = self._provider.get_parent()
		parent_path = self._provider.get_path()

		if parent_path == self._provider.get_root_path(parent_path):
			item_path = self._selected_path[len(parent_path):]
		else:
			item_path = self._selected_path[len(parent_path) + 1:]

		queue = parent.get_monitor().get_queue()

# Path: sunflower/plugin_base/monitor.py
# class MonitorSignals:
# 	CHANGED = 0  # file changed
# 	CHANGES_DONE = 1  # a hint that this was probably the last change in a set
# 	DELETED = 2  # file was deleted
# 	CREATED = 3  # file was created
# 	ATTRIBUTE_CHANGED = 4  # attribute was changed
# 	PRE_UNMOUNT = 5  # location will soon be unmounted
# 	UNMOUNTED = 6  # location was unmounted
# 	MOVED = 7  # file was moved
# 	EMBLEM_CHANGED = 8  # list of emblems has changed
# 	DIRECTORY_SIZE_CHANGED = 9  # calculated directory size has changed
# 	DIRECTORY_SIZE_STOPPED = 10  # directory size calculation has finished


# Path: sunflower/widgets/popup_menu.py
import os
from random import choice
from gi.repository import Gtk, Gdk, Gio
from sunflower.plugin_base.monitor import MonitorSignals

		# groups = self._application.accelerator_manager.get_groups()
		# for group_name in groups:
		# 	group = self._application.accelerator_manager._get_group_by_name(group_name)
		# 	group.activate(self._application)

		# remove references to help clear memory
		self._provider = None
		self._selected_path = None

	def __handle_emblem_toggle(self, widget, emblem=None):
		"""Handle toggling emblem for current path."""
		manager = self._application.emblem_manager
		path, item_name = os.path.split(self._selected_path)

		update_method = (
					self._application.emblem_manager.remove_emblem,
					self._application.emblem_manager.add_emblem
				)[widget.get_active()]
		update_method(path, item_name, emblem)

		# notify monitor of our change
		parent = self._provider.get_parent()
		parent_path = self._provider.get_path()

		if parent_path == self._provider.get_root_path(parent_path):
			item_path = self._selected_path[len(parent_path):]
		else:
			item_path = self._selected_path[len(parent_path) + 1:]

		queue = parent.get_monitor().get_queue()

		queue.put((MonitorSignals.EMBLEM_CHANGED, item_path, None))