2013-03-16 17:23:22 +00:00
|
|
|
#!/usr/bin/python2
|
|
|
|
#
|
|
|
|
# The Qubes OS Project, http://www.qubes-os.org
|
|
|
|
#
|
|
|
|
# Copyright (C) 2010 Joanna Rutkowska <joanna@invisiblethingslab.com>
|
|
|
|
# Copyright (C) 2013 Marek Marczykowski <marmarek@invisiblethingslab.com>
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
2015-11-22 11:25:10 +00:00
|
|
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
|
|
|
# USA.
|
2013-03-16 17:23:22 +00:00
|
|
|
|
|
|
|
import subprocess
|
|
|
|
import sys
|
2013-11-29 22:52:41 +00:00
|
|
|
import os
|
2013-03-16 17:23:22 +00:00
|
|
|
import os.path
|
|
|
|
import shutil
|
2014-04-16 14:59:47 +00:00
|
|
|
import dbus
|
2013-03-16 17:23:22 +00:00
|
|
|
|
2015-05-02 18:13:28 +00:00
|
|
|
from qubes.qubes import QubesVm, QubesHVm
|
2015-11-17 20:28:24 +00:00
|
|
|
from qubes.qubes import vm_files, system_path
|
2013-03-16 17:23:22 +00:00
|
|
|
|
2015-12-17 22:44:27 +00:00
|
|
|
import qubesimgconverter
|
2013-11-29 22:52:41 +00:00
|
|
|
|
2013-03-16 17:23:22 +00:00
|
|
|
vm_files['appmenus_templates_subdir'] = 'apps.templates'
|
2013-11-29 22:52:41 +00:00
|
|
|
vm_files['appmenus_template_icons_subdir'] = 'apps.tempicons'
|
2015-11-13 01:48:15 +00:00
|
|
|
vm_files['appmenus_subdir'] = 'apps'
|
2013-11-29 22:52:41 +00:00
|
|
|
vm_files['appmenus_icons_subdir'] = 'apps.icons'
|
2013-03-16 17:23:22 +00:00
|
|
|
vm_files['appmenus_template_templates_subdir'] = 'apps-template.templates'
|
|
|
|
vm_files['appmenus_whitelist'] = 'whitelisted-appmenus.list'
|
|
|
|
|
2015-05-02 18:13:28 +00:00
|
|
|
system_path['appmenu_start_hvm_template'] = \
|
|
|
|
'/usr/share/qubes-appmenus/qubes-start.desktop'
|
|
|
|
system_path['appmenu_create_cmd'] = \
|
|
|
|
'/usr/libexec/qubes-appmenus/create-apps-for-appvm.sh'
|
|
|
|
system_path['appmenu_remove_cmd'] = \
|
|
|
|
'/usr/libexec/qubes-appmenus/remove-appvm-appmenus.sh'
|
2013-03-16 17:23:22 +00:00
|
|
|
|
|
|
|
|
2015-11-22 11:25:10 +00:00
|
|
|
def QubesVm_get_appmenus_templates_dir(self):
|
|
|
|
if self.updateable:
|
|
|
|
return self.absolute_path(vm_files["appmenus_templates_subdir"], None)
|
|
|
|
elif self.template is not None:
|
|
|
|
return self.template.appmenus_templates_dir
|
|
|
|
else:
|
|
|
|
return None
|
|
|
|
|
|
|
|
QubesVm.appmenus_templates_dir = property(QubesVm_get_appmenus_templates_dir)
|
|
|
|
|
|
|
|
|
|
|
|
def QubesVm_get_appmenus_template_icons_dir(self):
|
|
|
|
if self.updateable:
|
|
|
|
return self.absolute_path(vm_files["appmenus_template_icons_subdir"],
|
|
|
|
None)
|
|
|
|
elif self.template:
|
|
|
|
return self.template.appmenus_template_icons_dir
|
|
|
|
else:
|
|
|
|
return None
|
|
|
|
|
|
|
|
QubesVm.appmenus_template_icons_dir = \
|
|
|
|
property(QubesVm_get_appmenus_template_icons_dir)
|
|
|
|
|
|
|
|
|
|
|
|
def QubesVm_get_appmenus_dir(self):
|
|
|
|
return self.absolute_path(vm_files["appmenus_subdir"], None)
|
|
|
|
|
|
|
|
QubesVm.appmenus_dir = property(QubesVm_get_appmenus_dir)
|
|
|
|
|
|
|
|
|
|
|
|
def QubesVm_get_appmenus_icons_dir(self):
|
|
|
|
return self.absolute_path(vm_files["appmenus_icons_subdir"], None)
|
|
|
|
|
|
|
|
|
|
|
|
QubesVm.appmenus_icons_dir = property(QubesVm_get_appmenus_icons_dir)
|
2013-03-16 17:23:22 +00:00
|
|
|
|
2015-05-02 18:13:28 +00:00
|
|
|
|
2015-12-05 17:25:29 +00:00
|
|
|
def get_whitelist_names(vm):
|
|
|
|
return (whitelist for whitelist in (
|
|
|
|
vm_files["appmenus_whitelist"],
|
|
|
|
'vm-' + vm_files["appmenus_whitelist"],
|
|
|
|
'netvm-' + vm_files["appmenus_whitelist"])
|
|
|
|
if os.path.exists(os.path.join(vm.dir_path, whitelist)))
|
|
|
|
|
|
|
|
|
2015-05-02 18:13:28 +00:00
|
|
|
def QubesVm_appmenus_create(self, verbose=False, source_template=None):
|
2013-03-16 17:23:22 +00:00
|
|
|
if source_template is None:
|
|
|
|
source_template = self.template
|
|
|
|
|
|
|
|
if self.internal:
|
|
|
|
return
|
2015-09-02 23:18:16 +00:00
|
|
|
if self.is_disposablevm():
|
|
|
|
return
|
2013-03-16 17:23:22 +00:00
|
|
|
|
|
|
|
if self.is_netvm():
|
|
|
|
vmtype = 'servicevms'
|
|
|
|
elif self.is_template():
|
|
|
|
vmtype = 'vm-templates'
|
|
|
|
else:
|
|
|
|
vmtype = 'appvms'
|
|
|
|
|
|
|
|
try:
|
2014-09-18 05:46:00 +00:00
|
|
|
msgoutput = None if verbose else open(os.devnull, 'w')
|
2013-03-16 17:23:22 +00:00
|
|
|
if source_template is not None:
|
2014-09-18 05:46:00 +00:00
|
|
|
subprocess.check_call([system_path["appmenu_create_cmd"],
|
|
|
|
source_template.appmenus_templates_dir,
|
|
|
|
self.name, vmtype, self.label.icon],
|
|
|
|
stdout=msgoutput, stderr=msgoutput)
|
2013-03-16 17:23:22 +00:00
|
|
|
elif self.appmenus_templates_dir is not None:
|
2015-05-02 18:13:28 +00:00
|
|
|
subprocess.check_call([system_path["appmenu_create_cmd"],
|
|
|
|
self.appmenus_templates_dir, self.name,
|
|
|
|
vmtype, self.label.icon],
|
|
|
|
stdout=msgoutput, stderr=msgoutput)
|
2013-03-16 17:23:22 +00:00
|
|
|
else:
|
|
|
|
# Only add apps to menu
|
2015-05-02 18:13:28 +00:00
|
|
|
subprocess.check_call([system_path["appmenu_create_cmd"],
|
|
|
|
"none", self.name, vmtype,
|
|
|
|
self.label.icon],
|
|
|
|
stdout=msgoutput, stderr=msgoutput)
|
2013-03-16 17:23:22 +00:00
|
|
|
except subprocess.CalledProcessError:
|
2015-05-02 18:13:28 +00:00
|
|
|
print >> sys.stderr, "Ooops, there was a problem creating appmenus " \
|
|
|
|
"for {0} VM!".format(self.name)
|
|
|
|
|
2013-03-16 17:23:22 +00:00
|
|
|
|
|
|
|
def QubesVm_appmenus_remove(self):
|
|
|
|
if self.is_netvm():
|
|
|
|
vmtype = 'servicevms'
|
|
|
|
elif self.is_template():
|
|
|
|
vmtype = 'vm-templates'
|
|
|
|
else:
|
|
|
|
vmtype = 'appvms'
|
2015-05-02 18:13:28 +00:00
|
|
|
subprocess.check_call([system_path["appmenu_remove_cmd"], self.name,
|
|
|
|
vmtype], stderr=open(os.devnull, 'w'))
|
|
|
|
|
2015-11-22 11:25:10 +00:00
|
|
|
|
2015-11-13 01:48:15 +00:00
|
|
|
def QubesVm_appmenus_cleanup(self):
|
|
|
|
srcdir = self.appmenus_templates_dir
|
|
|
|
if srcdir is None:
|
|
|
|
return
|
|
|
|
if not os.path.exists(srcdir):
|
|
|
|
return
|
|
|
|
if not os.path.exists(self.appmenus_dir):
|
|
|
|
return
|
|
|
|
|
|
|
|
for appmenu in os.listdir(self.appmenus_dir):
|
|
|
|
if not os.path.exists(os.path.join(srcdir, appmenu)):
|
|
|
|
os.unlink(os.path.join(self.appmenus_dir, appmenu))
|
2013-03-16 17:23:22 +00:00
|
|
|
|
2015-11-22 11:25:10 +00:00
|
|
|
|
2015-12-05 17:25:29 +00:00
|
|
|
def QubesVm_appmenus_replace_entry(self, old_name, new_name):
|
|
|
|
for whitelist in get_whitelist_names(self):
|
|
|
|
whitelist_path = os.path.join(self.dir_path, whitelist)
|
|
|
|
with open(whitelist_path) as f:
|
|
|
|
old_lines = f.readlines()
|
|
|
|
new_lines = [
|
|
|
|
(new_name + '\n' if l == old_name + '\n' else l)
|
|
|
|
for l in old_lines]
|
|
|
|
if new_lines != old_lines:
|
|
|
|
with open(whitelist_path, 'w') as f:
|
|
|
|
f.write(''.join(new_lines))
|
|
|
|
|
|
|
|
|
2016-04-19 21:11:10 +00:00
|
|
|
def QubesVm_appicons_create(self, srcdir=None, force=False):
|
2013-11-29 22:52:41 +00:00
|
|
|
if srcdir is None:
|
|
|
|
srcdir = self.appmenus_template_icons_dir
|
|
|
|
if srcdir is None:
|
|
|
|
return
|
2014-02-13 09:42:30 +00:00
|
|
|
if not os.path.exists(srcdir):
|
|
|
|
return
|
2013-11-29 22:52:41 +00:00
|
|
|
|
2015-09-02 23:18:16 +00:00
|
|
|
if self.internal:
|
|
|
|
return
|
|
|
|
if self.is_disposablevm():
|
|
|
|
return
|
|
|
|
|
2013-11-29 22:52:41 +00:00
|
|
|
whitelist = os.path.join(self.dir_path, vm_files['appmenus_whitelist'])
|
2014-04-14 02:12:00 +00:00
|
|
|
if os.path.exists(whitelist):
|
|
|
|
whitelist = [line.strip() for line in open(whitelist)]
|
|
|
|
else:
|
|
|
|
whitelist = None
|
2013-11-29 22:52:41 +00:00
|
|
|
|
|
|
|
if not os.path.exists(self.appmenus_icons_dir):
|
|
|
|
os.mkdir(self.appmenus_icons_dir)
|
|
|
|
elif not os.path.isdir(self.appmenus_icons_dir):
|
|
|
|
os.unlink(self.appmenus_icons_dir)
|
|
|
|
os.mkdir(self.appmenus_icons_dir)
|
|
|
|
|
|
|
|
for icon in os.listdir(srcdir):
|
|
|
|
desktop = os.path.splitext(icon)[0] + '.desktop'
|
2014-04-14 02:12:00 +00:00
|
|
|
if whitelist and desktop not in whitelist:
|
2013-11-29 22:52:41 +00:00
|
|
|
continue
|
|
|
|
|
2015-04-28 10:45:29 +00:00
|
|
|
src_icon = os.path.join(srcdir, icon)
|
|
|
|
dst_icon = os.path.join(self.appmenus_icons_dir, icon)
|
2016-04-19 21:11:10 +00:00
|
|
|
if not os.path.exists(dst_icon) or force or \
|
2015-05-02 18:13:28 +00:00
|
|
|
os.path.getmtime(src_icon) > os.path.getmtime(dst_icon):
|
2015-12-17 22:44:27 +00:00
|
|
|
qubesimgconverter.tint(src_icon, dst_icon, self.label.color)
|
2013-11-29 22:52:41 +00:00
|
|
|
|
2015-05-02 18:13:28 +00:00
|
|
|
|
2013-11-29 22:52:41 +00:00
|
|
|
def QubesVm_appicons_remove(self):
|
2015-05-02 18:13:28 +00:00
|
|
|
if not os.path.exists(self.appmenus_icons_dir):
|
|
|
|
return
|
2013-11-29 22:52:41 +00:00
|
|
|
for icon in os.listdir(self.appmenus_icons_dir):
|
|
|
|
os.unlink(os.path.join(self.appmenus_icons_dir, icon))
|
|
|
|
|
2015-05-02 18:13:28 +00:00
|
|
|
|
2015-05-02 21:49:40 +00:00
|
|
|
def QubesVm_appicons_cleanup(self):
|
|
|
|
srcdir = self.appmenus_template_icons_dir
|
|
|
|
if srcdir is None:
|
|
|
|
return
|
|
|
|
if not os.path.exists(srcdir):
|
|
|
|
return
|
2015-09-02 23:18:16 +00:00
|
|
|
if not os.path.exists(self.appmenus_icons_dir):
|
|
|
|
return
|
2015-05-02 21:49:40 +00:00
|
|
|
|
|
|
|
for icon in os.listdir(self.appmenus_icons_dir):
|
|
|
|
if not os.path.exists(os.path.join(srcdir, icon)):
|
|
|
|
os.unlink(os.path.join(self.appmenus_icons_dir, icon))
|
|
|
|
|
|
|
|
|
2013-03-16 17:23:22 +00:00
|
|
|
def QubesVm_pre_rename(self, new_name):
|
|
|
|
self.appmenus_remove()
|
|
|
|
|
2015-05-02 18:13:28 +00:00
|
|
|
|
2013-03-16 17:23:22 +00:00
|
|
|
def QubesVm_post_rename(self, old_name):
|
|
|
|
self.appmenus_create()
|
|
|
|
|
2015-05-02 18:13:28 +00:00
|
|
|
|
2013-03-16 17:23:22 +00:00
|
|
|
def QubesVm_create_on_disk(self, verbose, source_template):
|
2013-11-22 02:56:04 +00:00
|
|
|
if isinstance(self, QubesHVm) and source_template is None:
|
2013-03-16 17:23:22 +00:00
|
|
|
if verbose:
|
2015-05-02 18:13:28 +00:00
|
|
|
print >> sys.stderr, "--> Creating appmenus directory: {0}".format(
|
|
|
|
self.appmenus_templates_dir)
|
|
|
|
os.mkdir(self.appmenus_templates_dir)
|
|
|
|
shutil.copy(system_path["appmenu_start_hvm_template"],
|
|
|
|
self.appmenus_templates_dir)
|
2013-03-16 17:23:22 +00:00
|
|
|
|
|
|
|
source_whitelist_filename = 'vm-' + vm_files["appmenus_whitelist"]
|
|
|
|
if self.is_netvm():
|
|
|
|
source_whitelist_filename = 'netvm-' + vm_files["appmenus_whitelist"]
|
2015-05-02 18:13:28 +00:00
|
|
|
if source_template and os.path.exists(
|
|
|
|
os.path.join(source_template.dir_path, source_whitelist_filename)):
|
2013-03-16 17:23:22 +00:00
|
|
|
if verbose:
|
2015-05-02 18:13:28 +00:00
|
|
|
print >> sys.stderr, "--> Creating default whitelisted apps list: {0}". \
|
2013-03-16 17:23:22 +00:00
|
|
|
format(self.dir_path + '/' + vm_files["whitelisted_appmenus"])
|
2015-05-02 18:13:28 +00:00
|
|
|
shutil.copy(
|
|
|
|
os.path.join(source_template.dir_path, source_whitelist_filename),
|
|
|
|
os.path.join(self.dir_path, vm_files["whitelisted_appmenus"]))
|
2013-03-16 17:23:22 +00:00
|
|
|
|
2013-11-25 06:19:20 +00:00
|
|
|
if source_template and self.updateable:
|
2013-03-16 17:23:22 +00:00
|
|
|
if verbose:
|
2015-05-02 18:13:28 +00:00
|
|
|
print >> sys.stderr, "--> Copying the template's appmenus templates dir:\n{0} ==>\n{1}". \
|
|
|
|
format(source_template.appmenus_templates_dir,
|
|
|
|
self.appmenus_templates_dir)
|
2014-09-09 00:13:08 +00:00
|
|
|
if os.path.isdir(source_template.appmenus_templates_dir):
|
2015-05-02 18:13:28 +00:00
|
|
|
shutil.copytree(source_template.appmenus_templates_dir,
|
|
|
|
self.appmenus_templates_dir)
|
2014-09-09 00:13:08 +00:00
|
|
|
else:
|
|
|
|
os.mkdir(self.appmenus_templates_dir)
|
|
|
|
if os.path.isdir(source_template.appmenus_template_icons_dir):
|
2015-05-02 18:13:28 +00:00
|
|
|
shutil.copytree(source_template.appmenus_template_icons_dir,
|
|
|
|
self.appmenus_template_icons_dir)
|
2014-09-09 00:13:08 +00:00
|
|
|
else:
|
|
|
|
os.mkdir(self.appmenus_template_icons_dir)
|
2013-03-16 17:23:22 +00:00
|
|
|
|
|
|
|
# Create appmenus
|
2013-11-29 22:52:41 +00:00
|
|
|
self.appicons_create()
|
2014-09-09 00:13:08 +00:00
|
|
|
self.appmenus_create(verbose=verbose)
|
2013-03-16 17:23:22 +00:00
|
|
|
|
2015-05-02 18:13:28 +00:00
|
|
|
|
2013-03-16 17:23:22 +00:00
|
|
|
def QubesVm_clone_disk_files(self, src_vm, verbose):
|
2015-05-02 18:13:28 +00:00
|
|
|
if src_vm.updateable and src_vm.appmenus_templates_dir is not None and \
|
|
|
|
self.appmenus_templates_dir is not None:
|
2013-03-16 17:23:22 +00:00
|
|
|
if verbose:
|
2015-05-02 18:13:28 +00:00
|
|
|
print >> sys.stderr, "--> Copying the template's appmenus templates dir:\n{0} ==>\n{1}". \
|
|
|
|
format(src_vm.appmenus_templates_dir,
|
|
|
|
self.appmenus_templates_dir)
|
|
|
|
shutil.copytree(src_vm.appmenus_templates_dir,
|
|
|
|
self.appmenus_templates_dir)
|
2013-03-16 17:23:22 +00:00
|
|
|
|
2014-02-22 00:25:18 +00:00
|
|
|
if src_vm.updateable and src_vm.appmenus_template_icons_dir is not None \
|
|
|
|
and self.appmenus_template_icons_dir is not None and \
|
|
|
|
os.path.isdir(src_vm.appmenus_template_icons_dir):
|
|
|
|
if verbose:
|
|
|
|
print >> sys.stderr, "--> Copying the template's appmenus " \
|
2015-05-02 18:13:28 +00:00
|
|
|
"template icons dir:\n{0} ==>\n{1}". \
|
|
|
|
format(src_vm.appmenus_template_icons_dir,
|
|
|
|
self.appmenus_template_icons_dir)
|
|
|
|
shutil.copytree(src_vm.appmenus_template_icons_dir,
|
|
|
|
self.appmenus_template_icons_dir)
|
2014-02-22 00:25:18 +00:00
|
|
|
|
2015-12-05 17:25:29 +00:00
|
|
|
for whitelist in get_whitelist_names(src_vm):
|
|
|
|
if verbose:
|
|
|
|
print >> sys.stderr, "--> Copying whitelisted apps list: {0}". \
|
|
|
|
format(whitelist)
|
|
|
|
shutil.copy(os.path.join(src_vm.dir_path, whitelist),
|
|
|
|
os.path.join(self.dir_path, whitelist))
|
2013-03-16 17:23:22 +00:00
|
|
|
|
|
|
|
# Create appmenus
|
2013-11-29 22:52:41 +00:00
|
|
|
self.appicons_create()
|
2014-09-09 00:13:08 +00:00
|
|
|
self.appmenus_create(verbose=verbose)
|
2013-03-16 17:23:22 +00:00
|
|
|
|
2015-05-02 18:13:28 +00:00
|
|
|
|
2013-03-16 17:23:22 +00:00
|
|
|
def QubesVm_remove_from_disk(self):
|
|
|
|
self.appmenus_remove()
|
|
|
|
|
2015-05-02 18:13:28 +00:00
|
|
|
|
2013-11-29 22:52:41 +00:00
|
|
|
def QubesVm_label_setter(self, _):
|
2016-04-19 21:11:10 +00:00
|
|
|
self.appicons_create(force=True)
|
2013-11-29 22:52:41 +00:00
|
|
|
|
2014-04-16 14:59:47 +00:00
|
|
|
# Apparently desktop environments heavily caches the icons,
|
|
|
|
# see #751 for details
|
2016-07-14 02:32:16 +00:00
|
|
|
if "plasma" in os.environ.get("DESKTOP_SESSION", ""):
|
2014-04-16 14:59:47 +00:00
|
|
|
try:
|
2015-05-02 18:13:28 +00:00
|
|
|
os.unlink(os.path.expandvars(
|
|
|
|
"$HOME/.kde/cache-$HOSTNAME/icon-cache.kcache"))
|
2014-04-16 14:59:47 +00:00
|
|
|
except:
|
|
|
|
pass
|
|
|
|
try:
|
2015-05-02 18:13:28 +00:00
|
|
|
notify_object = dbus.SessionBus().get_object(
|
|
|
|
"org.freedesktop.Notifications",
|
|
|
|
"/org/freedesktop/Notifications")
|
2014-04-16 14:59:47 +00:00
|
|
|
notify_object.Notify(
|
|
|
|
"Qubes", 0, self.label.icon, "Qubes",
|
2015-05-02 18:13:28 +00:00
|
|
|
"You will need to log off and log in again for the VM icons "
|
|
|
|
"to update in the KDE launcher menu",
|
2014-04-16 14:59:47 +00:00
|
|
|
[], [], 10000,
|
|
|
|
dbus_interface="org.freedesktop.Notifications")
|
|
|
|
except:
|
|
|
|
pass
|
2016-07-14 02:32:16 +00:00
|
|
|
elif "xfce" in os.environ.get("DESKTOP_SESSION", ""):
|
2014-04-16 14:59:47 +00:00
|
|
|
self.appmenus_remove()
|
|
|
|
self.appmenus_create()
|
|
|
|
|
2015-05-02 18:13:28 +00:00
|
|
|
|
2013-12-04 02:03:48 +00:00
|
|
|
def QubesVm_appmenus_recreate(self):
|
2015-04-28 10:45:29 +00:00
|
|
|
"""
|
|
|
|
Force recreation of all appmenus and icons. For example when VM label
|
|
|
|
color was changed
|
|
|
|
"""
|
2013-12-04 02:03:48 +00:00
|
|
|
self.appmenus_remove()
|
2015-11-13 01:48:15 +00:00
|
|
|
self.appmenus_cleanup()
|
2014-02-22 00:25:18 +00:00
|
|
|
self.appicons_remove()
|
|
|
|
self.appicons_create()
|
2013-12-04 02:03:48 +00:00
|
|
|
self.appmenus_create()
|
|
|
|
|
2015-05-02 18:13:28 +00:00
|
|
|
|
2015-04-28 10:45:29 +00:00
|
|
|
def QubesVm_appmenus_update(self):
|
|
|
|
"""
|
|
|
|
Similar to appmenus_recreate, but do not touch unchanged files
|
|
|
|
"""
|
|
|
|
self.appmenus_remove()
|
2015-11-13 01:48:15 +00:00
|
|
|
self.appmenus_cleanup()
|
2015-04-28 10:45:29 +00:00
|
|
|
self.appicons_create()
|
|
|
|
self.appicons_cleanup()
|
|
|
|
self.appmenus_create()
|
|
|
|
|
2015-05-02 18:13:28 +00:00
|
|
|
|
2014-05-05 20:26:53 +00:00
|
|
|
def QubesVm_set_attr(self, name, newvalue, oldvalue):
|
2014-05-05 14:37:33 +00:00
|
|
|
if name == 'internal':
|
2014-05-05 20:26:53 +00:00
|
|
|
if newvalue and not oldvalue:
|
2014-05-05 14:37:33 +00:00
|
|
|
self.appmenus_remove()
|
2014-05-05 20:26:53 +00:00
|
|
|
elif not newvalue and oldvalue:
|
2014-05-05 14:37:33 +00:00
|
|
|
self.appmenus_create()
|
|
|
|
|
2015-11-22 11:25:10 +00:00
|
|
|
|
2013-03-16 17:23:22 +00:00
|
|
|
# new methods
|
|
|
|
QubesVm.appmenus_create = QubesVm_appmenus_create
|
|
|
|
QubesVm.appmenus_remove = QubesVm_appmenus_remove
|
2015-11-13 01:48:15 +00:00
|
|
|
QubesVm.appmenus_cleanup = QubesVm_appmenus_cleanup
|
2013-12-04 02:03:48 +00:00
|
|
|
QubesVm.appmenus_recreate = QubesVm_appmenus_recreate
|
2015-04-28 10:45:29 +00:00
|
|
|
QubesVm.appmenus_update = QubesVm_appmenus_update
|
2015-12-05 17:25:29 +00:00
|
|
|
QubesVm.appmenus_replace_entry = QubesVm_appmenus_replace_entry
|
2013-11-29 22:52:41 +00:00
|
|
|
QubesVm.appicons_create = QubesVm_appicons_create
|
2015-05-02 21:49:40 +00:00
|
|
|
QubesVm.appicons_cleanup = QubesVm_appicons_cleanup
|
2013-11-29 22:52:41 +00:00
|
|
|
QubesVm.appicons_remove = QubesVm_appicons_remove
|
2013-03-16 17:23:22 +00:00
|
|
|
|
|
|
|
# hooks for existing methods
|
|
|
|
QubesVm.hooks_pre_rename.append(QubesVm_pre_rename)
|
|
|
|
QubesVm.hooks_post_rename.append(QubesVm_post_rename)
|
|
|
|
QubesVm.hooks_create_on_disk.append(QubesVm_create_on_disk)
|
|
|
|
QubesVm.hooks_clone_disk_files.append(QubesVm_clone_disk_files)
|
|
|
|
QubesVm.hooks_remove_from_disk.append(QubesVm_remove_from_disk)
|
2013-11-29 22:52:41 +00:00
|
|
|
QubesVm.hooks_label_setter.append(QubesVm_label_setter)
|
2014-05-05 14:37:33 +00:00
|
|
|
QubesVm.hooks_set_attr.append(QubesVm_set_attr)
|