Remove upower_listener

the 'Sleeping' signal has been removed from UPower about four years ago
https://cgit.freedesktop.org/upower/commit/src/org.freedesktop.UPower.xml?id=1ee642e705a63f5ad56a6b55e4bf5c4a64c959b8
This commit is contained in:
André Apitzsch 2017-12-09 00:34:17 +01:00
parent 786ef96400
commit be32d9afe6
3 changed files with 0 additions and 57 deletions

View File

@ -85,10 +85,6 @@ class FeaturesWindow:
_('Ability to request your router to forward port for file transfer.'), _('Ability to request your router to forward port for file transfer.'),
_('Requires gir1.2-gupnpigd-1.0.'), _('Requires gir1.2-gupnpigd-1.0.'),
_('Feature not available under Windows.')), _('Feature not available under Windows.')),
_('UPower'): (self.upower_available,
_('Ability to disconnect properly just before suspending the machine.'),
_('Requires upower and python-dbus.'),
_('Feature not available under Windows.')),
} }
# name, supported # name, supported
@ -186,8 +182,3 @@ class FeaturesWindow:
def gupnp_igd_available(self): def gupnp_igd_available(self):
return app.HAVE_UPNP_IGD return app.HAVE_UPNP_IGD
def upower_available(self):
if os.name == 'nt':
return False
from gajim import upower_listener
return upower_listener.supported

View File

@ -2853,7 +2853,6 @@ class Interface:
self.remote_ctrl = None self.remote_ctrl = None
if dbus_support.supported: if dbus_support.supported:
from gajim import upower_listener
from gajim import logind_listener from gajim import logind_listener
# Handle gnome screensaver # Handle gnome screensaver

View File

@ -1,47 +0,0 @@
## src/upower_listener.py
##
## Copyright (C) 2006-2014 Yann Leboulanger <asterix AT lagaule.org>
##
## This file is part of Gajim.
##
## Gajim is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published
## by the Free Software Foundation; version 3 only.
##
## Gajim is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with Gajim. If not, see <http://www.gnu.org/licenses/>.
##
supported = False
from gajim.common import dbus_support
from gajim.common import app
def on_suspend(*args, **kwargs):
for name, conn in app.connections.items():
if app.account_is_connected(name):
conn.old_show = app.SHOW_LIST[conn.connected]
st = conn.status
conn.change_status('offline', _('Machine going to sleep'))
conn.status = st
conn.time_to_reconnect = 5
if dbus_support.supported:
try:
from gajim.common.dbus_support import system_bus
bus = system_bus.bus()
if 'org.freedesktop.UPower' in bus.list_names():
up_object = bus.get_object('org.freedesktop.UPower',
'/org/freedesktop/UPower')
bus.add_signal_receiver(on_suspend, 'Sleeping',
'org.freedesktop.UPower', 'org.freedesktop.UPower',
'/org/freedesktop/UPower')
supported = True
except Exception:
pass