#!/usr/bin/env python
# FreeSpeak - a GUI frontend to online translator engines
# bin/freespeak
#
## Copyright (C) 2005, 2006, 2007, 2008, 2009  Luca Bruno <lethalman88@gmail.com>
##
## This file is part of FreeSpeak.
##
## FreeSpeak is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##    
## FreeSpeak 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 General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.

"""
Script to start a FreeSpeak application
"""

import time
from optparse import OptionParser
import gtk.gdk
from freespeak import defs

def main ():
    """
    Start the application.
    Take care of command line arguments, the Application singleton
    and the GDK startup notification.
    """

    trigger_timestamp = int (time.time ())
    version = """FreeSpeak version %s
Copyright (C) 2005, 2006, 2007, 2008, 2009  Luca Bruno <lethalman88@gmail.com>

FreeSpeak comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of FreeSpeak under the terms of the
GNU General Public License. For more information, see the file named
COPYING.""" % defs.VERSION

    parser = OptionParser(usage='%prog',
                          version=version)
    options, args = parser.parse_args()
    
    from freespeak import application
    application.Application.setup_l10n ()
    appinstance = application.get_instance ()
    
    appinstance.start (options.__dict__, args, trigger_timestamp)
    if appinstance.is_running ():
        gtk.gdk.notify_startup_complete ()

main ()
