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
8 changes: 8 additions & 0 deletions src/PairDialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,14 @@ public class PairDialog : Granite.MessageDialog {
device = Bus.get_proxy_sync (BusType.SYSTEM, "org.bluez", object_path, DBusProxyFlags.GET_INVALIDATED_PROPERTIES);
image_icon = new ThemedIcon (device.icon ?? "bluetooth");
device_name = device.name ?? device.address;

// Close when pins or passkeys are accepted for example
((DBusProxy)device).g_properties_changed.connect ((changed, invalid) => {
var paired = changed.lookup_value ("Paired", new VariantType ("b"));
if (paired != null && device.paired) {
response (Gtk.ResponseType.ACCEPT);
}
});
} catch (IOError e) {
image_icon = new ThemedIcon ("bluetooth");
critical (e.message);
Expand Down
4 changes: 2 additions & 2 deletions src/Services/Agent.vala
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public class Bluetooth.Services.Agent : Object {
// instantly
public async void display_pin_code (ObjectPath device, string pincode) throws Error, BluezError {
pair_dialog = new PairDialog.display_pin_code (device, pincode, main_window);
pair_dialog.present ();
yield check_pairing_response (pair_dialog);
}

public async uint32 request_passkey (ObjectPath device) throws Error, BluezError {
Expand All @@ -81,7 +81,7 @@ public class Bluetooth.Services.Agent : Object {
// instantly
public async void display_passkey (ObjectPath device, uint32 passkey, uint16 entered) throws Error {
pair_dialog = new PairDialog.display_passkey (device, passkey, entered, main_window);
pair_dialog.present ();
yield check_pairing_response (pair_dialog);
}

// Called to request confirmation from the user that they want to pair with the given device and that
Expand Down