fix(services): Properly define and emit Seeked signal with correct GObject typing
- Removed outdated TODO comment and placeholder signal definition that caused type conversion errors - Added Signal with explicit GObject.TYPE_INT64 argument type and correct parameter extraction using .get_int64() - Ensured reliable emission of seeked signal to upstream DBus handler
This commit is contained in:
1 file changed
+3
-6
+3
-6
@@ -1,7 +1,7 @@
|
|||||||
from typing import Literal, Optional
|
from typing import Literal, Optional
|
||||||
|
|
||||||
from fabric.core.service import Property, Service, Signal
|
from fabric.core.service import Property, Service, Signal
|
||||||
from fabric.utils import Gio, GLib, logger
|
from fabric.utils import Gio, GLib, logger, GObject
|
||||||
from fabric.utils.helpers import (
|
from fabric.utils.helpers import (
|
||||||
bulk_connect,
|
bulk_connect,
|
||||||
clamp,
|
clamp,
|
||||||
@@ -27,10 +27,7 @@ class MprisPlayer(Service):
|
|||||||
@Signal
|
@Signal
|
||||||
def changed(self) -> None: ...
|
def changed(self) -> None: ...
|
||||||
|
|
||||||
# TODO: why??? object
|
seeked = Signal(name="seeked", arg_types=(GObject.TYPE_INT64,))
|
||||||
# TypeError: can't convert return value to desired type
|
|
||||||
@Signal
|
|
||||||
def seeked(self, position: int) -> object: ...
|
|
||||||
|
|
||||||
@Property(str, "readable")
|
@Property(str, "readable")
|
||||||
def player_name(self):
|
def player_name(self):
|
||||||
@@ -256,7 +253,7 @@ class MprisPlayer(Service):
|
|||||||
):
|
):
|
||||||
# Only One Signal for Mpris
|
# Only One Signal for Mpris
|
||||||
if signal_name == "Seeked":
|
if signal_name == "Seeked":
|
||||||
self.seeked(params[0])
|
self.seeked(params[0].get_int64())
|
||||||
|
|
||||||
def _proxy_call(self, method_name: str, parameter: Optional[GLib.Variant]):
|
def _proxy_call(self, method_name: str, parameter: Optional[GLib.Variant]):
|
||||||
self._dbus_helper.proxy.call(
|
self._dbus_helper.proxy.call(
|
||||||
|
|||||||
Reference in new issue
Block a user