default_guivm: fire property-set on default_guivm
This commit is contained in:
parent
78d0d2cabb
commit
728766d191
@ -5,6 +5,7 @@
|
|||||||
# Copyright (C) 2013-2016 Marek Marczykowski-Górecki
|
# Copyright (C) 2013-2016 Marek Marczykowski-Górecki
|
||||||
# <marmarek@invisiblethingslab.com>
|
# <marmarek@invisiblethingslab.com>
|
||||||
# Copyright (C) 2014-2018 Wojtek Porczyk <woju@invisiblethingslab.com>
|
# Copyright (C) 2014-2018 Wojtek Porczyk <woju@invisiblethingslab.com>
|
||||||
|
# Copyright (C) 2019 Frédéric Pierret <frederic.pierret@qubes-os.org>
|
||||||
#
|
#
|
||||||
# This library is free software; you can redistribute it and/or
|
# This library is free software; you can redistribute it and/or
|
||||||
# modify it under the terms of the GNU Lesser General Public
|
# modify it under the terms of the GNU Lesser General Public
|
||||||
@ -34,6 +35,12 @@ class GUI(qubes.ext.Extension):
|
|||||||
if vm.features.get('gui-seamless', False)
|
if vm.features.get('gui-seamless', False)
|
||||||
else 'FULLSCREEN'))
|
else 'FULLSCREEN'))
|
||||||
|
|
||||||
|
# property-del <=> property-reset-to-default
|
||||||
|
@qubes.ext.handler('property-del:guivm')
|
||||||
|
def on_property_del(self, subject, event, name, oldvalue=None):
|
||||||
|
newvalue = getattr(subject, 'guivm', None)
|
||||||
|
self.on_property_set(subject, event, name, newvalue, oldvalue)
|
||||||
|
|
||||||
@qubes.ext.handler('property-set:guivm')
|
@qubes.ext.handler('property-set:guivm')
|
||||||
def on_property_set(self, subject, event, name, newvalue, oldvalue=None):
|
def on_property_set(self, subject, event, name, newvalue, oldvalue=None):
|
||||||
# pylint: disable=unused-argument,no-self-use
|
# pylint: disable=unused-argument,no-self-use
|
||||||
@ -45,6 +52,7 @@ class GUI(qubes.ext.Extension):
|
|||||||
if 'guivm-' in tag:
|
if 'guivm-' in tag:
|
||||||
subject.tags.remove(tag)
|
subject.tags.remove(tag)
|
||||||
|
|
||||||
|
if newvalue:
|
||||||
guivm = 'guivm-' + newvalue.name
|
guivm = 'guivm-' + newvalue.name
|
||||||
subject.tags.add(guivm)
|
subject.tags.add(guivm)
|
||||||
|
|
||||||
@ -76,3 +84,12 @@ class GUI(qubes.ext.Extension):
|
|||||||
if vm.features.get('service.guivm-gui-agent', None):
|
if vm.features.get('service.guivm-gui-agent', None):
|
||||||
vm.untrusted_qdb.write('/guivm-windows-prefix',
|
vm.untrusted_qdb.write('/guivm-windows-prefix',
|
||||||
guivm_windows_prefix)
|
guivm_windows_prefix)
|
||||||
|
|
||||||
|
@qubes.ext.handler('property-set:default_guivm', system=True)
|
||||||
|
def on_property_set_default_guivm(self, app, event, name, newvalue,
|
||||||
|
oldvalue=None):
|
||||||
|
for vm in app.domains:
|
||||||
|
if hasattr(vm, 'guivm') and vm.property_is_default('guivm'):
|
||||||
|
vm.fire_event('property-set:guivm',
|
||||||
|
name='guivm', newvalue=newvalue,
|
||||||
|
oldvalue=oldvalue)
|
||||||
|
Loading…
Reference in New Issue
Block a user