appmenus: add missing appicons_cleanup function

Commit f05f214f "appmenus: update icons only when changed" introduced
usage of vm.appicons_cleanup, but that function wasn't implemented. That
caused not generating appmenus at all after template update (old
appmenus was removed, but script crashes before adding the new one).
This commit is contained in:
Marek Marczykowski-Górecki 2015-05-02 23:49:40 +02:00
parent b40008a06d
commit 50eb23d60e

View File

@ -168,6 +168,18 @@ def QubesVm_appicons_remove(self):
os.unlink(os.path.join(self.appmenus_icons_dir, icon))
def QubesVm_appicons_cleanup(self):
srcdir = self.appmenus_template_icons_dir
if srcdir is None:
return
if not os.path.exists(srcdir):
return
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))
def QubesVm_pre_rename(self, new_name):
self.appmenus_remove()
@ -326,6 +338,7 @@ QubesVm.appmenus_remove = QubesVm_appmenus_remove
QubesVm.appmenus_recreate = QubesVm_appmenus_recreate
QubesVm.appmenus_update = QubesVm_appmenus_update
QubesVm.appicons_create = QubesVm_appicons_create
QubesVm.appicons_cleanup = QubesVm_appicons_cleanup
QubesVm.appicons_remove = QubesVm_appicons_remove
# hooks for existing methods