Move .desktop launching code to python moules so it can be reused

This commit is contained in:
Marek Marczykowski-Górecki 2015-08-27 20:08:33 +02:00
parent 93e090469c
commit d710970e4d
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
4 changed files with 33 additions and 15 deletions

View File

@ -8,6 +8,9 @@ SBINDIR ?= /usr/sbin
LIBDIR ?= /usr/lib LIBDIR ?= /usr/lib
SYSLIBDIR ?= /lib SYSLIBDIR ?= /lib
PYTHON = /usr/bin/python2
PYTHON_SITEARCH = `python2 -c 'import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1)'`
# This makefile uses some bash-isms, make uses /bin/sh by default. # This makefile uses some bash-isms, make uses /bin/sh by default.
SHELL = /bin/bash SHELL = /bin/bash
@ -201,6 +204,13 @@ install-common:
install -D -m 0755 misc/qubes-desktop-run $(DESTDIR)/usr/bin/qubes-desktop-run install -D -m 0755 misc/qubes-desktop-run $(DESTDIR)/usr/bin/qubes-desktop-run
mkdir -p $(DESTDIR)/$(PYTHON_SITEARCH)/qubes/
ifeq (1,${DEBIANBUILD})
install -m 0644 misc/xdg.py $(DESTDIR)/$(PYTHON_SITEARCH)/qubes/
else
install -m 0644 misc/xdg.py* $(DESTDIR)/$(PYTHON_SITEARCH)/qubes/
endif
install -d $(DESTDIR)/mnt/removable install -d $(DESTDIR)/mnt/removable
install -D -m 0644 misc/xorg-preload-apps.conf $(DESTDIR)/etc/X11/xorg-preload-apps.conf install -D -m 0644 misc/xorg-preload-apps.conf $(DESTDIR)/etc/X11/xorg-preload-apps.conf

View File

@ -1,19 +1,7 @@
#!/usr/bin/python #!/usr/bin/python
from gi.repository import Gio from qubes.xdg import launch
import sys import sys
import dbus
def main(myname, desktop, *files): if __name__ == '__main__':
launcher = Gio.DesktopAppInfo.new_from_filename(desktop) launch(*sys.argv[1:])
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__":
main(*sys.argv)

19
misc/xdg.py Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/python
from gi.repository import Gio
import sys
import dbus
def launch(desktop, *files):
launcher = Gio.DesktopAppInfo.new_from_filename(desktop)
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:])

View File

@ -416,6 +416,7 @@ rm -f %{name}-%{version}
/usr/lib/qubes/close-window /usr/lib/qubes/close-window
/usr/lib/qubes/qubes-trigger-desktop-file-install /usr/lib/qubes/qubes-trigger-desktop-file-install
/usr/lib/yum-plugins/yum-qubes-hooks.py* /usr/lib/yum-plugins/yum-qubes-hooks.py*
/usr/lib64/python2.7/site-packages/qubes/xdg.py*
/usr/sbin/qubes-firewall /usr/sbin/qubes-firewall
/usr/sbin/qubes-netwatcher /usr/sbin/qubes-netwatcher
/usr/share/qubes/serial.conf /usr/share/qubes/serial.conf