#! /usr/bin/env python

# Music Applet
# Copyright (C) 2007 Paul Kuliniewicz <paul@kuliniewicz.org>
#
# This program 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, or (at your option)
# any later version.
#
# This program 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 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 02111-1301, USA.

import gettext
import gnomeapplet
import gobject
import locale
import os

import musicapplet.applet
import musicapplet.defs


def applet_factory (applet, iid):
    musicapplet.applet.MusicApplet (applet)
    return True


if __name__ == "__main__":
    gobject.threads_init ()         # in case a plugin needs threads (like MPD's does)
    gettext.bindtextdomain ("music-applet", os.path.join (musicapplet.defs.DATA_DIR, "locale"))
    if (hasattr (gettext, "bind_textdomain_codeset")):
        gettext.bind_textdomain_codeset ("music-applet", "UTF-8")
    gettext.textdomain ("music-applet")

    locale.bindtextdomain ("music-applet", os.path.join (musicapplet.defs.DATA_DIR, "locale"))
    if (hasattr (locale, "bind_textdomain_codeset")):
        locale.bind_textdomain_codeset ("music-applet", "UTF-8")
    locale.textdomain ("music-applet")

    gnomeapplet.bonobo_factory ("OAFIID:GNOME_Music_Applet_Factory",
                                gnomeapplet.Applet.__gtype__,
                                musicapplet.defs.PACKAGE,
                                musicapplet.defs.VERSION,
                                applet_factory)
