Skip to content
Open
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
10 changes: 6 additions & 4 deletions blueman/bluez/Base.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from blueman.bluez.errors import parse_dbus_error, BluezDBusException
import logging

DBUS_TIMEOUT = 10 * 1_000


class BaseMeta(GObjectMeta):
def __call__(cls, *args: object, **kwargs: str) -> "Base":
Expand Down Expand Up @@ -92,7 +94,7 @@ def callback(
else:
logging.error(f"Unhandled error for {self.__proxy.get_interface_name()}.{method}", exc_info=True)

self.__proxy.call(method, param, Gio.DBusCallFlags.NONE, GLib.MAXINT, None,
self.__proxy.call(method, param, Gio.DBusCallFlags.NONE, DBUS_TIMEOUT, None,
callback, reply_handler, error_handler)

def get(self, name: str) -> Any:
Expand All @@ -101,7 +103,7 @@ def get(self, name: str) -> Any:
'org.freedesktop.DBus.Properties.Get',
GLib.Variant('(ss)', (self._interface_name, name)),
Gio.DBusCallFlags.NONE,
GLib.MAXINT,
DBUS_TIMEOUT,
None)
return prop.unpack()[0]
except GLib.Error as e:
Expand All @@ -119,7 +121,7 @@ def set(self, name: str, value: str | int | bool) -> None:
self.__proxy.call('org.freedesktop.DBus.Properties.Set',
param,
Gio.DBusCallFlags.NONE,
GLib.MAXINT,
DBUS_TIMEOUT,
None)

def get_object_path(self) -> ObjectPath:
Expand All @@ -130,7 +132,7 @@ def get_properties(self) -> dict[str, Any]:
res = self.__proxy.call_sync('org.freedesktop.DBus.Properties.GetAll',
param,
Gio.DBusCallFlags.NONE,
GLib.MAXINT,
DBUS_TIMEOUT,
None)

props: dict[str, Any] = res.unpack()[0]
Expand Down
6 changes: 4 additions & 2 deletions blueman/gui/manager/ManagerDeviceMenu.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
from blueman.gui.manager.ManagerDeviceList import ManagerDeviceList
from blueman.main.Manager import Blueman

DBUS_TIMEOUT = 10 * 1_000


class DeviceMenuItem:
class Group(Enum):
Expand Down Expand Up @@ -163,7 +165,7 @@ def fail(_obj: AppletService | None, result: GLib.Error, _user_data: None) -> No

self._appl.ConnectService('(os)', device.get_object_path(), uuid,
result_handler=success, error_handler=fail,
timeout=GLib.MAXINT)
timeout=DBUS_TIMEOUT)

prog.start()

Expand All @@ -183,7 +185,7 @@ def err(_obj: AppletService | None, result: GLib.Error, _user_date: None) -> Non
return

self._appl.DisconnectService('(osd)', device.get_object_path(), uuid, port,
result_handler=ok, error_handler=err, timeout=GLib.MAXINT)
result_handler=ok, error_handler=err, timeout=DBUS_TIMEOUT)

def on_device_property_changed(self, lst: "ManagerDeviceList", _device: Device, tree_iter: Gtk.TreeIter,
key_value: tuple[str, object]) -> None:
Expand Down
Loading