Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Joshua Strobl <JoshStrobl@users.noreply.github.com>
  • Loading branch information
EbonJaeger and JoshStrobl authored Jan 10, 2024
1 parent 655b2d4 commit 33d615f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 26 deletions.
24 changes: 6 additions & 18 deletions src/dialogs/sendto/Dialog/ScanDialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -208,29 +208,17 @@ public class ScanDialog : Gtk.Dialog {
unowned Bluetooth.Device device1 = row1.device;
unowned Bluetooth.Device device2 = row2.device;

if (device1.paired && !device2.paired) {
return -1;
}
if (device1.paired && !device2.paired) return -1;

if (!device1.paired && device2.paired) {
return 1;
}
if (!device1.paired && device2.paired) return 1;

if (device1.connected && !device2.connected) {
return -1;
}
if (device1.connected && !device2.connected) return -1;

if (!device1.connected && device2.connected) {
return 1;
}
if (!device1.connected && device2.connected) return 1;

if (device1.name != null && device2.name == null) {
return -1;
}
if (device1.name != null && device2.name == null) return -1;

if (device1.name == null && device2.name != null) {
return 1;
}
if (device1.name == null && device2.name != null) return 1;

var name1 = device1.name ?? device1.address;
var name2 = device2.name ?? device2.address;
Expand Down
1 change: 0 additions & 1 deletion src/dialogs/sendto/Services/Manager.vala
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ public class Bluetooth.ObjectManager : Object {
}
}

// TODO: Do not rely on this when it is possible to do it natively in Vala
[CCode (cname="bluetooth_device_proxy_get_type")]
extern static GLib.Type get_device_proxy_type();

Expand Down
13 changes: 6 additions & 7 deletions src/panel/applets/status/BluetoothIndicator.vala
Original file line number Diff line number Diff line change
Expand Up @@ -659,14 +659,13 @@ public class BTDeviceRow : ListBoxRow {
}

private void update_status() {
if (device.connected) {
status_label.set_text(_("Connected"));
connection_button.show();
activatable = false;
} else {
status_label.set_text(_("Disconnected"));
activatable = !device.connected;
status_label.set_text(activatable ? _("Disconnected") : _("Connected"));

if (activatable) {
connection_button.hide();
activatable = true;
} else {
connection_button.show();
}

// Update the name if changed
Expand Down

0 comments on commit 33d615f

Please sign in to comment.