Created attachment 3159
Make plugin work with devices connected after plugin start.
xfce4-diskperf-plugin will not work if you configure it to monitor a removable drive. I'd like to use it with USB drives and other hotpluggable stuff.
The configuration dialog won't let you enter a device which doesn't exist and will use hda or whatever as default. However, you can do the configuration while the device is connected, and the settings will be saved successfully. Plug the device in at a later time, and the monitor will work ok.
However, upon panel restart, the plugin will not do its monitoring duty anymore if the device is not present.
I've fixed the last problem, but I think it's more a hack than a real solution. See patch attached.
1) Let user specify non-existent device in configuration dialog, perhaps popup a warning or changing text color to red when it doesn't exist like in thunar mass renamer.
2) Make plugin work when device gets connected after panel restart.
I take the liberty of bumping this bug so it won't get lost.
Note though, that the patch only fixes this in Linux, not *BSD. I don't use FreeBSD etc., so I cannot test any changes.
Additionally, a patch is recommended to change the dialog currently alerting the user that the specified device doesn't exist. Maybe I will post such a patch when I have more time.
A better solution would be to create one instance of diskperf-plugin to watch several drives at once and add or remove progress meters and labels accordingly, depending on which drive is available (attached).
Idea is nice, but a full patch properly implementing this would be welcome..
Created attachment 4361
Ok, let's try to improve the situation a bit.
First, here's a patch to always show a tooltip, even when no stats are available. I found it weird and a bit annoying that sometimes the tooltip would not appear; it's like the plugin simply ignores my request to display information, which is a behaviour I'm not very fond of.
This patch does not require attachment 3159 from the initial report. If I did not accidently make a mistake, it should apply fine.
I'm planning on removing the error message from the configuration dialog. With this patch, the tooltip will tell when the stats are not available. Next, I'll try to adapt the first patch so that it is compatible with a non-linux OS. Any help here would be greatly appreciated, as I cannot test it as a linux user.
Created attachment 4362
Remove the error in the configuration dialog, relying on the tooltip displaying the error.
Of course, this has one drawback: The actual cause of the error will not be shown anymore, e.g. "Device does not exist". However, I wonder whether this is really a problem, because a default device name (even os-specific!) is already provided when the user adds a new monitor to the panel. Also, this check is only performed once - at configuration time, so if any problem arises later, the user will not be informed anyway.
I think the functionality gained when used together with the other patches outweighs this drawback, but opinions might differ.
Created attachment 4363
After looking through the code, I believe that the problem this bug report was created for actually exists only on linux. Gathering stats works differently (and apparently simpler) on the other platforms.
I've modified the original patch so that the device is initialized (I don't even know if that is the correct word here) only when necessary, that is when it becomes available.
Is this solution acceptable for you?
Sorry, the last explanation was wrong... In fact, the patch tries to initialize the device when gathering stats was unsuccessful before.
Applied all the patches to git, tested here on OpenBSD with an USB key, the behaviour is still correct. Thanks!