Skip to content

Commit 06d704c

Browse files
committed
Merge remote-tracking branch 'origin/pr/294'
* origin/pr/294: Add preloaded disposable icon to state column Add preloaded disposable tooltip Pull request description: Fixes: QubesOS/qubes-issues#10639 For: QubesOS/qubes-issues#1512
2 parents 1f295d9 + 8a79f41 commit 06d704c

4 files changed

Lines changed: 50 additions & 9 deletions

File tree

icons/scalable/qubes-preloaded.svg

Lines changed: 3 additions & 0 deletions
Loading

qui/decorators.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def __init__(self, vm):
5353

5454
self.updates_available = False
5555
self.outdated = False
56+
self.is_preload = False
5657

5758
self.label = Gtk.Label(xalign=0)
5859
if self.vm:
@@ -63,20 +64,37 @@ def __init__(self, vm):
6364

6465
self.outdated_icon = create_icon("outdated")
6566
self.updateable_icon = create_icon("software-update-available")
67+
self.preload_icon = create_icon("qubes-preloaded")
6668

6769
self.outdated_icon.set_no_show_all(True)
6870
self.updateable_icon.set_no_show_all(True)
71+
self.preload_icon.set_no_show_all(True)
6972

7073
self.updateable_icon.set_tooltip_text(_("Updates available"))
7174
self.outdated_icon.set_tooltip_text(
7275
_("Qube must be restarted to reflect changes in template")
7376
)
77+
self.preload_icon.set_tooltip_text(_("Preloaded disposable qube"))
7478

7579
self.update_outdated(False)
7680
self.update_updateable()
81+
self.update_preload()
7782

7883
self.pack_start(self.outdated_icon, False, False, 3)
7984
self.pack_start(self.updateable_icon, False, True, 3)
85+
self.pack_start(self.preload_icon, False, False, 3)
86+
87+
def update_preload(self):
88+
if self.vm is None:
89+
return
90+
try:
91+
is_preload = getattr(self.vm, "is_preload", False)
92+
except exc.QubesException:
93+
# no access to VM features
94+
is_preload = False
95+
self.preload_icon.set_visible(is_preload)
96+
self.is_preload = is_preload
97+
self.update_tooltip()
8098

8199
def update_outdated(self, state):
82100
self.outdated_icon.set_visible(state)

qui/tray/domains.py

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -522,15 +522,24 @@ async def perform_action(self):
522522
class InternalInfoItem(Gtk.MenuItem):
523523
"""Internal info label."""
524524

525-
def __init__(self):
525+
def __init__(self, is_preload=False):
526526
super().__init__()
527527
self.label = Gtk.Label(xalign=0)
528-
self.label.set_markup(_("<b>Internal qube</b>"))
529-
self.set_tooltip_text(
530-
"Internal qubes are used by the operating system. Do not modify"
531-
" them or run programs in them unless you really "
532-
"know what you are doing."
528+
title = "Internal qube"
529+
if is_preload:
530+
title += "\n(preloaded)"
531+
tooltip = (
532+
"Internal qubes are used by the operating system. Do not modify "
533+
"them or run programs in them unless you really know what you "
534+
"are doing."
533535
)
536+
if is_preload:
537+
tooltip += (
538+
"\n\nTo configure preloading, see Qubes Global Config and Qube "
539+
"Settings"
540+
)
541+
self.label.set_markup(_("<b>" + title + "</b>"))
542+
self.set_tooltip_text(tooltip)
534543
self.add(self.label)
535544
self.set_sensitive(False)
536545

@@ -625,7 +634,7 @@ def __init__(self, vm, icon_cache):
625634
class InternalMenu(Gtk.Menu):
626635
"""Sub-menu for Internal qubes"""
627636

628-
def __init__(self, vm, icon_cache, working_correctly=True):
637+
def __init__(self, vm, icon_cache, working_correctly=True, is_preload=False):
629638
"""
630639
:param vm: relevant Internal qube
631640
:param icon_cache: IconCache object
@@ -635,7 +644,7 @@ def __init__(self, vm, icon_cache, working_correctly=True):
635644
super().__init__()
636645
self.vm = vm
637646

638-
self.add(InternalInfoItem())
647+
self.add(InternalInfoItem(is_preload=is_preload))
639648

640649
logs = [
641650
(
@@ -749,8 +758,12 @@ def __init__(self, vm, app, icon_cache, state=None):
749758

750759
def _set_submenu(self, state):
751760
if self.vm.features.get("internal", False):
761+
is_preload = getattr(self.vm, "is_preload", False)
752762
submenu = InternalMenu(
753-
self.vm, self.icon_cache, working_correctly=(state == "Running")
763+
self.vm,
764+
self.icon_cache,
765+
working_correctly=(state == "Running"),
766+
is_preload=is_preload,
754767
)
755768
elif state == "Running":
756769
submenu = StartedMenu(self.vm, self.app, self.icon_cache)
@@ -919,6 +932,9 @@ def register_events(self):
919932
"domain-feature-delete:expert-mode", self.debug_change
920933
)
921934

935+
self.dispatcher.add_handler(
936+
"property-reset:is_preload", self.update_domain_item
937+
)
922938
self.dispatcher.add_handler(
923939
"domain-feature-set:internal", self.update_domain_item
924940
)
@@ -1168,6 +1184,9 @@ def update_domain_item(self, vm, event, **kwargs):
11681184

11691185
item.update_state(state)
11701186

1187+
if event == "property-reset:is_preload":
1188+
item.name.update_preload()
1189+
11711190
if event == "domain-shutdown":
11721191
self.handle_domain_shutdown(vm)
11731192
# if the VM was shut down, it is no longer outdated

rpm_spec/qubes-desktop-linux-manager.spec.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ gtk-update-icon-cache %{_datadir}/icons/Adwaita &>/dev/null || :
321321
/usr/share/icons/hicolor/scalable/apps/qubes-ok.svg
322322
/usr/share/icons/hicolor/scalable/apps/qubes-padlock.svg
323323
/usr/share/icons/hicolor/scalable/apps/qubes-policy-editor.svg
324+
/usr/share/icons/hicolor/scalable/apps/qubes-preloaded.svg
324325
/usr/share/icons/hicolor/scalable/apps/qubes-question.svg
325326
/usr/share/icons/hicolor/scalable/apps/qubes-this-device.svg
326327
/usr/share/icons/hicolor/scalable/apps/qubes-unplug.svg

0 commit comments

Comments
 (0)