Parcourir la source

Merge remote-tracking branch 'origin/pr/355'

* origin/pr/355:
  Removed unused vm.icon_path property
Marek Marczykowski-Górecki il y a 4 ans
Parent
commit
6adf56f4ba

+ 0 - 6
qubes/tests/integ/backupcompatibility.py

@@ -184,16 +184,12 @@ class TC_00_BackupCompatibility(
         os.mkdir(self.fullpath("appvms/test-work"))
         self.create_whitelisted_appmenus(self.fullpath(
             "appvms/test-work/whitelisted-appmenus.list"))
-        os.symlink("/usr/share/qubes/icons/green.png",
-                   self.fullpath("appvms/test-work/icon.png"))
         self.create_private_img(self.fullpath("appvms/test-work/private.img"))
 
         # StandaloneVM
         os.mkdir(self.fullpath("appvms/test-standalonevm"))
         self.create_whitelisted_appmenus(self.fullpath(
             "appvms/test-standalonevm/whitelisted-appmenus.list"))
-        os.symlink("/usr/share/qubes/icons/blue.png",
-                   self.fullpath("appvms/test-standalonevm/icon.png"))
         self.create_private_img(self.fullpath(
             "appvms/test-standalonevm/private.img"))
         self.create_sparse(
@@ -254,8 +250,6 @@ class TC_00_BackupCompatibility(
             self.create_whitelisted_appmenus(self.fullpath(
                 "vm-templates/test-template-clone/netvm-whitelisted-appmenus"
                 ".list"))
-        os.symlink("/usr/share/qubes/icons/green.png",
-                   self.fullpath("vm-templates/test-template-clone/icon.png"))
         os.mkdir(
             self.fullpath("vm-templates/test-template-clone/apps.templates"))
         self.create_appmenus(

+ 1 - 3
qubes/tests/vm/dispvm.py

@@ -94,9 +94,7 @@ class TC_00_DispVM(qubes.tests.QubesTestCase):
         self.assertEqual(dispvm.auto_cleanup, True)
         mock_makedirs.assert_called_once_with(
             '/var/lib/qubes/appvms/' + dispvm.name, mode=0o775, exist_ok=True)
-        mock_symlink.assert_called_once_with(
-            '/usr/share/icons/hicolor/128x128/devices/appvm-red.png',
-            '/var/lib/qubes/appvms/{}/icon.png'.format(dispvm.name))
+        mock_symlink.assert_not_called()
 
     def test_001_from_appvm_reject_not_allowed(self):
         with self.assertRaises(qubes.exc.QubesException):

+ 0 - 4
qubes/vm/adminvm.py

@@ -213,10 +213,6 @@ class AdminVM(qubes.vm.BaseVM):
         '''
         raise qubes.exc.QubesVMError(self, 'Cannot kill Dom0 fake domain!')
 
-    @property
-    def icon_path(self):
-        pass
-
     @property
     def untrusted_qdb(self):
         '''QubesDB handle for this domain.'''

+ 0 - 39
qubes/vm/qubesvm.py

@@ -808,10 +808,6 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
             self.dir_path_prefix,
             self.name)
 
-    @property
-    def icon_path(self):
-        return os.path.join(self.dir_path, 'icon.png')
-
     @property
     def conf_file(self):
         return os.path.join(self.dir_path, 'libvirt.xml')
@@ -954,17 +950,6 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
     @qubes.events.handler('property-set:label')
     def on_property_set_label(self, event, name, newvalue, oldvalue=None):
         # pylint: disable=unused-argument
-        if self.icon_path:
-            try:
-                os.remove(self.icon_path)
-            except OSError:
-                pass
-            if hasattr(os, "symlink"):
-                os.symlink(newvalue.icon_path, self.icon_path)
-                subprocess.call(['sudo', 'xdg-icon-resource', 'forceupdate'])
-            else:
-                shutil.copy(newvalue.icon_path, self.icon_path)
-
         # icon is calculated based on label
         self.fire_event('property-reset:icon', name='icon')
 
@@ -1690,15 +1675,6 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
                                    'creation'.format(self.dir_path))
             raise
 
-        if os.path.exists(self.icon_path):
-            os.unlink(self.icon_path)
-        self.log.info('Creating icon symlink: {} -> {}'.format(
-            self.icon_path, self.label.icon_path))
-        if hasattr(os, "symlink"):
-            os.symlink(self.label.icon_path, self.icon_path)
-        else:
-            shutil.copy(self.label.icon_path, self.icon_path)
-
         # fire hooks
         yield from self.fire_event_async('domain-create-on-disk')
 
@@ -1757,21 +1733,6 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
         self.storage.verify()
         assert self.volumes != {}
 
-        if src.icon_path is not None \
-                and os.path.exists(src.icon_path) \
-                and self.icon_path is not None:
-            if os.path.islink(src.icon_path):
-                icon_path = os.readlink(src.icon_path)
-                self.log.info(
-                    'Creating icon symlink {} -> {}'.format(
-                        self.icon_path, icon_path))
-                os.symlink(icon_path, self.icon_path)
-            else:
-                self.log.info(
-                    'Copying icon {} -> {}'.format(
-                        src.icon_path, self.icon_path))
-                shutil.copy(src.icon_path, self.icon_path)
-
         # fire hooks
         yield from self.fire_event_async('domain-clone-files', src=src)