# Bryan Schumaker (10/30/2010)

import ocarina
from ocarina import window
gdk       = ocarina.gdk
libsaria  = ocarina.libsaria
get_attrs = libsaria.sources.get_attrs
invite    = libsaria.event.invite

__NAME__ = "Window Manager Tweaks"


def tweak_icon(file):
	if file == None:
		file = "images/ocarina.png"
	gdk.threads_enter()
	window.set_icon(file)
	gdk.threads_leave()

def tweak_title(filepath):
	if filepath != None:
		title = get_attrs("title")
	else:
		title = ocarina.__vers__
	window.set_title(title)

def start():
	invite("POSTLOAD", tweak_title)
	invite("POSTGETART", tweak_icon)

def stop():
	pass

def check_version():
	if libsaria.__major__ != 4:
		return False
	if libsaria.__minor__ == 4:
		return True
	return False
