#!/usr/bin/python

# ubuntu-sso-login-gui - GUI for registration and login for Ubuntu SSO
#
# Author: Natalia Bidart <natalia.bidart@canonical.com>
#
# Copyright 2010 Canonical Ltd.
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE.  See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program.  If not, see <http://www.gnu.org/licenses/>.
"""Script to run the Ubuntu SSO client GUI."""

import gtk
import sys

from ubuntu_sso.gui import UbuntuSSOClientGUI


APP_NAME = 'Ubuntu'
TC_URI = 'http://one.ubuntu.com/terms'
HELP_TEXT = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. ' \
            'Nam sed lorem nibh. Suspendisse gravida nulla non nunc suscipit' \
            ' pulvinar tempus ut augue.'

main_quit = lambda *args, **kwargs: gtk.main_quit()


if __name__ == '__main__':
    tc_uri=TC_URI
    login_only = False
    xid = 0

    if '--login' in sys.argv:
        login_only = True
        tc_uri = None

    if '--with-parent-window' in sys.argv:
        win = gtk.Window()
        win.set_title(APP_NAME)
        win.set_position(gtk.WIN_POS_CENTER)
        win.set_size_request(800, 600)
        win.show()
        xid = win.window.xid

    UbuntuSSOClientGUI(close_callback=main_quit, app_name=APP_NAME,
                       tc_uri=tc_uri, help_text=HELP_TEXT, window_id=xid,
                       login_only=login_only)
    gtk.main()
