#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
#   Simple desktop item edit
#   Copyright (C) 2012  Gerasev Kirill
#
#   This library is free software; you can redistribute it and/or
#   modify it under the terms of the GNU Library General Public
#   License as published by the Free Software Foundation; either
#   version 2 of the License, or (at your option) any later version.
#
#   This library is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#   Library General Public License for more details.
#
#   You should have received a copy of the GNU Library General Public
#   License along with this library; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

import sys,os,gettext,locale
sys.path.insert(1, '/usr/lib/python2.7/site-packages')
import ldie

DATA_PATH="/usr/share/light-desktop-item-edit"

gettext.bindtextdomain("light-desktop-item-edit", os.path.dirname(DATA_PATH)+"/locale")
gettext.textdomain("light-desktop-item-edit")
locale.bind_textdomain_codeset("light-desktop-item-edit",'UTF-8')
_ = gettext.gettext


def print_version():
    print _("Version") + " 0.3"
    print _("Homepage: ") + "https://github.com/gerasev-kirill/light-desktop-item-edit"
    print _("Autor: ")+ "Gerasev Kirill"

def print_help():
    print _("Usage:")
    print "  light-desktop-item-edit "+ _("[FILE...] - Edit .desktop and .directory files")+"\n"
    print _("Options:")
    print "  --version\t"+_("print version of program")
    print "  --help\t"+_("print this help")
    
    
argv=sys.argv[1:]


if len(argv)>0:
    if argv[0]=="--help" or argv[0]=="-h":
        print_help()
    elif argv[0]=="--version" or argv[0]=="-v":
        print_version()
    else:
        if os.path.splitext(argv[0])[1]==".directory":
            app=ldie.DirMainWindow(DATA_PATH, argv[0],"light-desktop-item-edit" )
        elif os.path.splitext(argv[0])[1]==".desktop":
            app=ldie.DesktopMainWindow(DATA_PATH, argv[0],"light-desktop-item-edit")
        else:
            print _("Invalid option or file. Try ")+"--help"
else:
    print_help()
