qubes-core-agent-linux/misc/xdg.py
Marek Marczykowski-Górecki 0d1023d496
qubes-desktop-run: don't crash on Debian wheezy (glib < 2.36)
Gio.DesktopAppInfo.get_boolean was introduced in glib 2.36. Instead of
crashing simply do not support DBusActivatable there. There is no such
application in default Debian wheezy template anyway.

(cherry picked from commit 0b7ade11b8)
2015-09-28 00:38:59 +02:00

21 lines
585 B
Python
Executable File

#!/usr/bin/python
from gi.repository import Gio
import sys
import dbus
def launch(desktop, *files):
launcher = Gio.DesktopAppInfo.new_from_filename(desktop)
if hasattr(launcher, 'get_boolean'):
activatable = launcher.get_boolean('DBusActivatable')
if activatable:
bus = dbus.SessionBus()
service_id = launcher.get_id()
# cut the .desktop suffix
service_id = service_id[:-8]
bus.start_service_by_name(service_id)
launcher.launch(files, None)
if __name__ == "__main__":
launch(*sys.argv[1:])