Daniel Brötzmann pushed to branch master at gajim / gajim
Commits:
3ca29b03 by wurstsalat at 2021-12-23T00:30:43+01:00
LogindListener: Catch errors while trying to inhibit sleep
Fixes #10248, fixes #9767
- - - - -
1 changed file:
- gajim/common/dbus/logind.py
Changes:
=====================================
gajim/common/dbus/logind.py
=====================================
@@ -94,17 +94,24 @@ def _inhibit_sleep(self, connection):
log.warning('Trying to obtain a sleep inhibitor '
'while already holding one.')
- ret, ret_fdlist = connection.call_with_unix_fd_list_sync(
- 'org.freedesktop.login1',
- '/org/freedesktop/login1',
- 'org.freedesktop.login1.Manager',
- 'Inhibit',
- GLib.Variant('(ssss)', (
- 'sleep', 'org.gajim.Gajim', _('Disconnect from the network'),
- 'delay' # Inhibitor will delay but not block sleep
- )),
- GLib.VariantType.new('(h)'),
- Gio.DBusCallFlags.NONE, -1, None, None)
+ try:
+ ret, ret_fdlist = connection.call_with_unix_fd_list_sync(
+ 'org.freedesktop.login1',
+ '/org/freedesktop/login1',
+ 'org.freedesktop.login1.Manager',
+ 'Inhibit',
+ GLib.Variant('(ssss)', (
+ 'sleep',
+ 'org.gajim.Gajim',
+ _('Disconnect from the network'),
+ 'delay' # Inhibitor will delay but not block sleep
+ )),
+ GLib.VariantType.new('(h)'),
+ Gio.DBusCallFlags.NONE, -1, None, None)
+ except GLib.Error as error:
+ log.warning(
+ 'Cannot obtain a sleep delay inhibitor from logind: %s', error)
+ return
log.info('Inhibit sleep')
self._inhibit_fd = ret_fdlist.get(ret.unpack()[0])
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/3ca29b0389eb05e02079cd6f723e2fcd0c4f4f0d
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/3ca29b0389eb05e02079cd6f723e2fcd0c4f4f0d
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