Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/DeviceRow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
*/

public class Bluetooth.DeviceRow : Gtk.ListBoxRow {
public signal void status_changed ();

public Services.Device device { get; construct; }
public unowned Services.Adapter adapter { get; construct; }
private static Gtk.SizeGroup size_group;

public signal void status_changed ();
private static Gtk.SizeGroup size_group;

private enum Status {
UNPAIRED,
Expand Down Expand Up @@ -62,8 +62,8 @@ public class Bluetooth.DeviceRow : Gtk.ListBoxRow {
private Gtk.Label state_label;
private Gtk.LinkButton settings_button;

public DeviceRow (Services.Device device, Services.Adapter adapter) {
Object (device: device, adapter: adapter);
public DeviceRow (Services.Device device) {
Object (device: device);
}

static construct {
Expand Down Expand Up @@ -187,6 +187,8 @@ public class Bluetooth.DeviceRow : Gtk.ListBoxRow {
break;
}

var adapter = Services.ObjectManager.get_default ().get_adapter_from_path (device.adapter);

compute_status ();
set_sensitive (adapter.powered);

Expand Down
6 changes: 2 additions & 4 deletions src/MainView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ public class Bluetooth.MainView : Switchboard.SettingsPage {

private void complete_setup () {
foreach (var device in manager.get_devices ()) {
var adapter = manager.get_adapter_from_path (device.adapter);
var row = new DeviceRow (device, adapter);
var row = new DeviceRow (device);
list_box.append (row);
}

Expand All @@ -100,8 +99,7 @@ public class Bluetooth.MainView : Switchboard.SettingsPage {

/* Now retrieve finished, we can connect manager signals */
manager.device_added.connect ((device) => {
var adapter = manager.get_adapter_from_path (device.adapter);
var row = new DeviceRow (device, adapter);
var row = new DeviceRow (device);
list_box.append (row);
if (list_box.get_selected_row () == null) {
list_box.select_row (row);
Expand Down