try:
        locale.setlocale (locale.LC_ALL, "")
    except:
        pass

    ppdippstr.init ()
    Gdk.threads_init ()
    from dbus.glib import DBusGMainLoop
    DBusGMainLoop (set_as_default=True)

    client_demo = False
    if len (sys.argv) > 1:
        for opt in sys.argv[1:]:
            if opt == "--debug":
                set_debugging (True)
                cupshelpers.set_debugprint_fn (debugprint)
            elif opt == "--client":
                client_demo = True

    if client_demo:
        _client_demo ()
        sys.exit (0)

    debugprint ("Service running...")
    g_killtimer = killtimer.KillTimer (killfunc=Gtk.main_quit)
    cp = ConfigPrinting ()
    Gdk.threads_enter ()
    Gtk.main ()
    Gdk.threads_leave ()
    cp.destroy ()
    try:
        locale.setlocale(locale.LC_ALL, "")
    except:
        pass

    ppdippstr.init()
    Gdk.threads_init()
    from dbus.glib import DBusGMainLoop
    DBusGMainLoop(set_as_default=True)

    client_demo = False
    if len(sys.argv) > 1:
        for opt in sys.argv[1:]:
            if opt == "--debug":
                set_debugging(True)
                cupshelpers.set_debugprint_fn(debugprint)
            elif opt == "--client":
                client_demo = True

    if client_demo:
        _client_demo()
        sys.exit(0)

    debugprint("Service running...")
    g_killtimer = killtimer.KillTimer(killfunc=Gtk.main_quit)
    cp = ConfigPrinting()
    Gdk.threads_enter()
    Gtk.main()
    Gdk.threads_leave()
    cp.destroy()