#!/usr/bin/env python

import findrox; findrox.version(1,9,8)
import rox
import os, sys

__builtins__._ = rox.i18n.translation(os.path.join(rox.app_dir, 'Messages'))

if len(sys.argv) == 2:
	if sys.argv[1] == '--backdrop':
		import actions
		actions.choose_backdrop()
		sys.exit(0)
	elif os.path.exists(sys.argv[1]):
		import fixed
		fixed.set_as_wallpaper(sys.argv[1])
		sys.exit(0)

from rox import g, choices, confirm, report_exception

old_autostart = choices.load('ROX-Session', 'AutoStart/Wallpaper')
if old_autostart and os.path.islink(old_autostart):
	if confirm(_('You have a link to an old version of Wallpaper '
		   'set to be loaded by ROX-Session. This is no '
		   'longer needed -- delete it?'), g.STOCK_DELETE):
		try:
			os.unlink(old_autostart)
		except:
			report_exception()

import main

win = main.Window()
win.show()
rox.mainloop()
