/usr/lib/hamster-applet/hamster-windows-service is in hamster-applet 2.91.3+git20120514.b9fec3e1-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | #!/usr/bin/python
# nicked off hamster-service
import gobject
import dbus, dbus.service
import glib
from dbus.mainloop.glib import DBusGMainLoop
DBusGMainLoop(set_as_default=True)
loop = gobject.MainLoop()
if "org.gnome.Hamster.WindowServer" in dbus.SessionBus().list_names():
print "Found hamster-window-service already running, exiting"
quit()
# maintain just one instance. this code feels hackish again
class WindowServer(dbus.service.Object):
__dbus_object_path__ = "/org/gnome/Hamster/WindowServer"
def __init__(self, loop):
self.app = True
self.mainloop = loop
self.bus = dbus.SessionBus()
bus_name = dbus.service.BusName("org.gnome.Hamster.WindowServer", bus=self.bus)
dbus.service.Object.__init__(self, bus_name, self.__dbus_object_path__)
@dbus.service.method("org.gnome.Hamster")
def Quit(self):
"""Shutdown the service"""
self.mainloop.quit()
@dbus.service.method("org.gnome.Hamster.WindowServer")
def edit(self, id=None): dialogs.edit.show(self.app, fact_id = id)
@dbus.service.method("org.gnome.Hamster.WindowServer")
def overview(self): dialogs.overview.show(self.app)
@dbus.service.method("org.gnome.Hamster.WindowServer")
def about(self): dialogs.about.show(self.app)
@dbus.service.method("org.gnome.Hamster.WindowServer")
def statistics(self): dialogs.stats.show(self.app)
@dbus.service.method("org.gnome.Hamster.WindowServer")
def preferences(self): dialogs.prefs.show(self.app)
if __name__ == '__main__':
from hamster.lib import i18n
i18n.setup_i18n()
glib.set_prgname(unicode(_("hamster-windows-service")).encode("utf-8"))
from hamster.configuration import runtime, dialogs, conf, load_ui_file
window_server = WindowServer(loop)
print "hamster-window-service up"
loop.run()
|