# -*- coding: utf-8 -*-

from Plugin import Plugin

class MainClass(Plugin):

	def __init__(self, controller, msn):
		Plugin.__init__(self, controller, msn)

		self.description = _('Puts the search bar on the bottom of the main window.')
		self.authors = {'Adolfo González Bláquez': 'code@infinicode.org'}
		self.website = 'http://www.infinicode.org/code/emesene/'
		self.displayName = _('Search on Bottom')
		self.name = 'SearchOnBottom'

		self.mainWindow = controller.mainWindow
		self.search = self.mainWindow.filterEntry
		self.mainVbox = self.mainWindow.vbox
		self.userListVbox = self.mainWindow.vbox.get_children()[3]

		self.enabled = False

	def start(self):
		self.enabled = True
		
		self.mainVbox.remove(self.search)
		self.userListVbox.pack_start(self.search, expand=False)
		self.userListVbox.reorder_child(self.search, 1)

	def stop(self):
		self.enabled = False
		
		self.userListVbox.remove(self.search)
		self.mainVbox.pack_start(self.search, expand=False)
		self.mainVbox.reorder_child(self.search,2)

	def check(self):
		return (True, 'Ok')


