# -*- coding: utf-8 -*-
### BEGIN LICENSE
# Copyright (C) 2009 Jono Bacon <jono@ubuntu.com>
# Copyright (C) 2010 Michael Budde <mbudde@gmail.com>
#
#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/>.
### END LICENSE

import os
import gtk

from lernid.lernidconfig import *


class AboutLernidDialog(gtk.AboutDialog):
    __gtype_name__ = "AboutLernidDialog"

    def __init__(self):
        """__init__ - This function is typically not called directly.
        Creation of a AboutLernidDialog requires redeading the associated ui
        file and parsing the ui definition extrenally,
        and then calling AboutLernidDialog.finish_initializing().

        Use the convenience function NewAboutLernidDialog to create
        NewAboutLernidDialog objects.

        """
        gtk.AboutDialog.__init__(self)

    def finish_initializing(self, builder):
        """finish_initalizing should be called after parsing the ui definition
        and creating a AboutLernidDialog object with it in order to finish
        initializing the start of the new AboutLernidDialog instance.

        """
        #get a reference to the builder and set up the signals
        self.builder = builder
        self.builder.connect_signals(self)

        self.set_comments(_(DESCRIPTION))
        self.set_version(VERSION)
        self.set_website(WEBSITE)
        self.set_authors(CONTRIBUTORS)
        self.set_artists(ARTISTS)
        self.set_license(LICENSE)

        #code for other initialization actions should be added here

def NewAboutLernidDialog():
    """NewAboutLernidDialog - returns a fully instantiated
    AboutLernidDialog object. Use this function rather than
    creating a AboutLernidDialog instance directly.

    """

    #look for the ui file that describes the ui
    ui_filename = get_data_path('ui', 'AboutLernidDialog.ui')
    builder = gtk.Builder()
    builder.add_from_file(ui_filename)
    dialog = builder.get_object("about_lernid_dialog")
    dialog.finish_initializing(builder)
    return dialog

if __name__ == "__main__":
    dialog = NewAboutLernidDialog()
    dialog.show()
    gtk.main()

