Philipp Hörist pushed to branch master at gajim / gajim
Commits:
ef52d49b by lovetox at 2022-01-24T14:13:10+01:00
Notifications: Don’t send nullable types via DBus
DBus does not support nullable types like GLib.Variant('ms',
'test')
- - - - -
3 changed files:
- gajim/gtk/application.py
- gajim/gtk/notification.py
- gajim/gtk/structs.py
Changes:
=====================================
gajim/gtk/application.py
=====================================
@@ -750,8 +750,9 @@ def _on_open_event_action(_action: Gio.SimpleAction,
'incoming-call',
'file-transfer'):
- assert params.jid is not None
- app.window.select_chat(params.account, params.jid)
+ assert params.jid
+ jid = JID.from_string(params.jid)
+ app.window.select_chat(params.account, jid)
app.window.present_with_time(Gtk.get_current_event_time())
=====================================
gajim/gtk/notification.py
=====================================
@@ -212,12 +212,13 @@ def _on_button_press(self,
event: Gdk.EventButton
) -> None:
if event.button == 1:
- jid = self._event.jid
- if jid is not None and isinstance(jid, str):
- jid = JID.from_string(jid)
+
+ jid = ''
+ if self._event.jid is not None:
+ jid = str(self._event.jid)
params = OpenEventActionParams(type=self._event.type,
- sub_type=self._event.sub_type,
+ sub_type=self._event.sub_type or '',
account=self._event.account,
jid=jid)
app.app.activate_action(f'app.{self._event.account}-open-event',
@@ -304,12 +305,12 @@ def _add_actions(self,
if 'actions' not in self._daemon_capabilities:
return
- jid = event.jid
- if jid is not None and isinstance(jid, str):
- jid = JID.from_string(jid)
+ jid = ''
+ if event.jid is not None:
+ jid = str(event.jid)
params = OpenEventActionParams(type=event.type,
- sub_type=event.sub_type,
+ sub_type=event.sub_type or '',
account=event.account,
jid=jid)
=====================================
gajim/gtk/structs.py
=====================================
@@ -31,10 +31,12 @@
@dataclass
class OpenEventActionParams(VariantMixin):
+ # Event which is used for Notifications and gets sent over DBus
+ # Don’t use Optional types here because DBus does not support "None"
type: str
- sub_type: Optional[str]
+ sub_type: str
account: str
- jid: Optional[JID]
+ jid: str
@dataclass
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/ef52d49b2801eae4317a08fa7fdb7c25d154126f
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/ef52d49b2801eae4317a08fa7fdb7c25d154126f
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits