# Path: sunflower/gui/input_dialog.py
# class PasswordDialog(InputDialog):
# 	"""Dialog used for safe entry of passwords. Contains two fields."""
# 
# 	def __init__(self, application):
# 		InputDialog.__init__(self, application)
# 
# 		# create user interface
# 		vbox = Gtk.VBox(False, 0)
# 
# 		self._label_description = Gtk.Label()
# 		self._label_description.set_alignment(0, 0)
# 		self._label_description.set_line_wrap(True)
# 		self._label_description.connect('size-allocate', self._adjust_label)
# 
# 		self._label.set_text(_('Password:'))
# 
# 		label_confirm = Gtk.Label(label=_('Confirm:'))
# 		label_confirm.set_alignment(0, 0.5)
# 		self._entry_confirm = Gtk.Entry()
# 
# 		self._entry.set_property('caps-lock-warning', True)
# 		self._entry_confirm.set_property('caps-lock-warning', True)
# 		self._entry.set_visibility(False)
# 		self._entry_confirm.set_visibility(False)
# 
# 		# configure interface
# 		self._container.set_spacing(5)
# 
# 		# pack user interface
# 		vbox.pack_start(label_confirm, False, False, 0)
# 		vbox.pack_start(self._entry_confirm, False, False, 0)
# 
# 		self._container.pack_start(vbox, False, False, 0)
# 		self._container.pack_start(self._label_description, False, False, 0)
# 
# 		self._container.reorder_child(self._label_description, 0)
# 
# 		# show all elements
# 		vbox.show_all()
# 		self._label_description.show()
# 
# 	def _adjust_label(self, widget, data=None):
# 		"""Adjust label size"""
# 		widget.set_size_request(data.width-1, -1)
# 
# 	def set_label(self, text):
# 		"""Set label text"""
# 		self._label_description.set_text(text)
# 
# 	def get_response(self):
# 		"""Return value and self-destruct
# 
# 		This method returns tuple with response code password
# 		and confirmation string.
# 
# 		"""
# 		code = self._dialog.run()
# 		password = self._entry.get_text()
# 		confirmation = self._entry_confirm.get_text()
# 
# 		self._dialog.destroy()
# 
# 		return code, password, confirmation


import time
from gi.repository import Gtk
from sunflower.gui.input_dialog import PasswordDialog
								).format(entry_name)
							)
		dialog.set_default_response(Gtk.ResponseType.YES)
		response = dialog.run()
		dialog.destroy()

		if response == Gtk.ResponseType.YES:
			self._application.keyring_manager.remove_entry(entry_name)
			self.__populate_list()

		return True

	def __edit_selected(self, widget, data=None):
		"""Edit selected entry in keyring"""
		selection = self._list.get_selection()
		item_list, selected_iter = selection.get_selected()

		# show error if no entry is selected
		if selected_iter is None:
			dialog = Gtk.MessageDialog(
									self._window,
									Gtk.DialogFlags.DESTROY_WITH_PARENT,
									Gtk.MessageType.WARNING,
									Gtk.ButtonsType.OK,
									_('Please select an entry to change!')
								)
			dialog.run()
			dialog.destroy()
			return True


# Path: sunflower/gui/input_dialog.py
# class PasswordDialog(InputDialog):
# 	"""Dialog used for safe entry of passwords. Contains two fields."""
# 
# 	def __init__(self, application):
# 		InputDialog.__init__(self, application)
# 
# 		# create user interface
# 		vbox = Gtk.VBox(False, 0)
# 
# 		self._label_description = Gtk.Label()
# 		self._label_description.set_alignment(0, 0)
# 		self._label_description.set_line_wrap(True)
# 		self._label_description.connect('size-allocate', self._adjust_label)
# 
# 		self._label.set_text(_('Password:'))
# 
# 		label_confirm = Gtk.Label(label=_('Confirm:'))
# 		label_confirm.set_alignment(0, 0.5)
# 		self._entry_confirm = Gtk.Entry()
# 
# 		self._entry.set_property('caps-lock-warning', True)
# 		self._entry_confirm.set_property('caps-lock-warning', True)
# 		self._entry.set_visibility(False)
# 		self._entry_confirm.set_visibility(False)
# 
# 		# configure interface
# 		self._container.set_spacing(5)
# 
# 		# pack user interface
# 		vbox.pack_start(label_confirm, False, False, 0)
# 		vbox.pack_start(self._entry_confirm, False, False, 0)
# 
# 		self._container.pack_start(vbox, False, False, 0)
# 		self._container.pack_start(self._label_description, False, False, 0)
# 
# 		self._container.reorder_child(self._label_description, 0)
# 
# 		# show all elements
# 		vbox.show_all()
# 		self._label_description.show()
# 
# 	def _adjust_label(self, widget, data=None):
# 		"""Adjust label size"""
# 		widget.set_size_request(data.width-1, -1)
# 
# 	def set_label(self, text):
# 		"""Set label text"""
# 		self._label_description.set_text(text)
# 
# 	def get_response(self):
# 		"""Return value and self-destruct
# 
# 		This method returns tuple with response code password
# 		and confirmation string.
# 
# 		"""
# 		code = self._dialog.run()
# 		password = self._entry.get_text()
# 		confirmation = self._entry_confirm.get_text()
# 
# 		self._dialog.destroy()
# 
# 		return code, password, confirmation


# Path: sunflower/gui/keyring_manager_window.py
import time
from gi.repository import Gtk
from sunflower.gui.input_dialog import PasswordDialog

								).format(entry_name)
							)
		dialog.set_default_response(Gtk.ResponseType.YES)
		response = dialog.run()
		dialog.destroy()

		if response == Gtk.ResponseType.YES:
			self._application.keyring_manager.remove_entry(entry_name)
			self.__populate_list()

		return True

	def __edit_selected(self, widget, data=None):
		"""Edit selected entry in keyring"""
		selection = self._list.get_selection()
		item_list, selected_iter = selection.get_selected()

		# show error if no entry is selected
		if selected_iter is None:
			dialog = Gtk.MessageDialog(
									self._window,
									Gtk.DialogFlags.DESTROY_WITH_PARENT,
									Gtk.MessageType.WARNING,
									Gtk.ButtonsType.OK,
									_('Please select an entry to change!')
								)
			dialog.run()
			dialog.destroy()
			return True


		dialog = PasswordDialog(self._window)