-
-
Notifications
You must be signed in to change notification settings - Fork 13
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
Fixed: Duplicated bluetooth devices #17
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That looks much better! Thanks. Two things in the diff comments.
src/Services/Manager.vala
Outdated
private void add_device (BluetoothIndicator.Services.Device device, string path) { | ||
lock (devices) { | ||
if (!devices.has_key (path)) { | ||
devices.set (path, device); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use this:
devices[path] = device
src/Widgets/Views/MainView.vala
Outdated
if (child is Bluetooth.Widgets.Device) { | ||
((Bluetooth.Widgets.Device) child).destroy (); | ||
var device_child = child as Bluetooth.Widgets.Device; | ||
if (device_child != null && device_child.device.modalias == device.modalias) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, could we have a compare
method inside the Device
class like that?
public bool compare (Device device) {
return modalias == device.modalias;
}
It would just make this easier to compare devices in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks! (code)
Fixes: #10 Makes sure to only add and send the signal that a device has been added once, also prevents all devices from being deleted if you unpair a device