gnome-music.in 1006 Bytes
Newer Older
Vadim Rutkovsky's avatar
Vadim Rutkovsky committed
1
#!/usr/bin/env python3
Guillaume Quintard's avatar
Guillaume Quintard committed
2

3
import sys, signal
4
from gi.repository import Gio, Gtk
Guillaume Quintard's avatar
Guillaume Quintard committed
5 6 7 8
sys.path.insert(1, '@pythondir@')

from gnomemusic.application import Application

9 10 11 12 13 14 15 16 17 18
def install_excepthook():
    """ Make sure we exit when an unhandled exception occurs. """
    old_hook = sys.excepthook
    def new_hook(etype, evalue, etb):
        old_hook(etype, evalue, etb)
        while Gtk.main_level():
            Gtk.main_quit()
        sys.exit()
    sys.excepthook = new_hook

Guillaume Quintard's avatar
Guillaume Quintard committed
19
if __name__ == "__main__":
20 21
    install_excepthook()

22
    # We use our own libgd.so, so let gi.repository find it
Vadim Rutkovsky's avatar
Vadim Rutkovsky committed
23
    from gi.repository import GIRepository
24 25
    GIRepository.Repository.prepend_search_path('@libdir@/gnome-music')
    GIRepository.Repository.prepend_library_path('@libdir@/gnome-music')
Vadim Rutkovsky's avatar
Vadim Rutkovsky committed
26

27 28 29
    resource = Gio.resource_load("data/gnome-music.gresource")
    Gio.Resource._register(resource)

30
    app = Application()
Vadim Rutkovsky's avatar
Vadim Rutkovsky committed
31
    signal.signal(signal.SIGINT, signal.SIG_DFL)
32 33
    exit_status = app.run(sys.argv)
    sys.exit(exit_status)