Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qui-devices refactor #55

Merged
merged 2 commits into from
Mar 23, 2019
Merged

Conversation

marmarta
Copy link
Member

@marmarta marmarta commented Mar 18, 2019

Thorough refactoring of qui-devices; instead of maintaining a list of
updating Gtk widgets, only data is maintained and updated, and the menu
is created on demand.

fixes QubesOS/qubes-issues#4849
fixes QubesOS/qubes-issues#4720
fixes QubesOS/qubes-issues#4355
fixes QubesOS/qubes-issues#3215
fixes QubesOS/qubes-issues#2970

@marmarta marmarta force-pushed the qui-devices-rewrite branch 2 times, most recently from 885802a to 51b98d0 Compare March 20, 2019 22:00
"Detaching device {0} from {1} failed. Error: {2}".format(
self.device.description, vm, ex),
Gio.NotificationPriority.HIGH,
error=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is inconsistent. Since this method is also used in attach_item(), it should give some indication whether detach succeeded or not. Otherwise, attach_item() will try to attach even if detach failed (leading to device being attached to multiple VMs). The purpose of detach_item() call in attach_item() was to avoid this situation.

On the other hand, the use case of switching device to another VM is (I think) rare, compared to simply detaching it. So, maybe the UI should be optimized for this common case of just detaching the device? In this case, I'd list only VM(s) to which device is currently connected, to ease clicking on it.
@andrewdavidwong, is my assumption correct here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the other hand, the use case of switching device to another VM is (I think) rare, compared to simply detaching it. So, maybe the UI should be optimized for this common case of just detaching the device? In this case, I'd list only VM(s) to which device is currently connected, to ease clicking on it.
@andrewdavidwong, is my assumption correct here?

In my experience, it's not extremely common, but I'm not sure I'd call it "rare." I think it's reasonable to optimize for the most common "detaching" use case, but some users will certainly want to switch devices to other VMs. Perhaps the VM to which the device is currently connected should be visually more prominent (e.g., shown at the top of a list, with a separator below it, and all the other VMs below that).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed it to be bolded - to be honest I'm a bit wary about changing the VM order, it makes it harder to find the one you're looking for. I can be convinced otherwise, but as for now it seems for me that bolding it made it quite prominent enough.


class VM:
def __init__(self, vm):
self.hash = hash(vm)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This internal attribute, must not be modified from outside and preferably also accessed. Please rename to __hash.

'<b>Qubes Devices</b>\nView and manage devices.')
for domain in self.vms:
if domain.name == name:
domain.icon = vm.icon
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is real QubesVM object, so it should be vm.label.icon.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Icon is also cached in devices (vm_icon attribute).

@marmarta marmarta force-pushed the qui-devices-rewrite branch from 2f75c79 to 148f42a Compare March 22, 2019 13:46
Thorough refactoring of qui-devices; instead of maintaining a list of
updating Gtk widgets, only data is maintained and updated, and the menu
is created on demand.

fixes QubesOS/qubes-issues#4849
fixes QubesOS/qubes-issues#4720
fixes QubesOS/qubes-issues#4355
fixes QubesOS/qubes-issues#3215
fixes QubesOS/qubes-issues#2970
Bolded the VM name, to make it easier to find it when detaching.
@marmarta marmarta force-pushed the qui-devices-rewrite branch from 148f42a to 9478109 Compare March 22, 2019 13:51
@marmarek marmarek merged commit 9478109 into QubesOS:master Mar 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants