Move .desktop launching code to python moules so it can be reused
This commit is contained in:
		
							parent
							
								
									93e090469c
								
							
						
					
					
						commit
						d710970e4d
					
				
							
								
								
									
										10
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								Makefile
									
									
									
									
									
								
							@ -8,6 +8,9 @@ SBINDIR ?= /usr/sbin
 | 
			
		||||
LIBDIR ?= /usr/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.
 | 
			
		||||
SHELL = /bin/bash
 | 
			
		||||
 | 
			
		||||
@ -201,6 +204,13 @@ install-common:
 | 
			
		||||
 | 
			
		||||
	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 -m 0644 misc/xorg-preload-apps.conf $(DESTDIR)/etc/X11/xorg-preload-apps.conf
 | 
			
		||||
 | 
			
		||||
@ -1,19 +1,7 @@
 | 
			
		||||
#!/usr/bin/python
 | 
			
		||||
 | 
			
		||||
from gi.repository import Gio
 | 
			
		||||
from qubes.xdg import launch
 | 
			
		||||
import sys
 | 
			
		||||
import dbus
 | 
			
		||||
 | 
			
		||||
def main(myname, 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__":
 | 
			
		||||
    main(*sys.argv)
 | 
			
		||||
if __name__ == '__main__':
 | 
			
		||||
    launch(*sys.argv[1:])
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										19
									
								
								misc/xdg.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										19
									
								
								misc/xdg.py
									
									
									
									
									
										Executable 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:])
 | 
			
		||||
@ -416,6 +416,7 @@ rm -f %{name}-%{version}
 | 
			
		||||
/usr/lib/qubes/close-window
 | 
			
		||||
/usr/lib/qubes/qubes-trigger-desktop-file-install
 | 
			
		||||
/usr/lib/yum-plugins/yum-qubes-hooks.py*
 | 
			
		||||
/usr/lib64/python2.7/site-packages/qubes/xdg.py*
 | 
			
		||||
/usr/sbin/qubes-firewall
 | 
			
		||||
/usr/sbin/qubes-netwatcher
 | 
			
		||||
/usr/share/qubes/serial.conf
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user