move enable_location_listener to location_listener.py directly
This commit is contained in:
parent
869ad9ec2b
commit
108aaa0027
|
@ -78,6 +78,7 @@ class LocationListener:
|
|||
accuracy)
|
||||
|
||||
def start(self):
|
||||
self.get_data()
|
||||
bus = dbus.SessionBus()
|
||||
# Geoclue
|
||||
bus.add_signal_receiver(self._on_geoclue_address_changed,
|
||||
|
@ -114,3 +115,11 @@ class LocationListener:
|
|||
continue
|
||||
gajim.connections[acct].send_location(self._data)
|
||||
gajim.connections[acct].location_info = self._data
|
||||
|
||||
def enable():
|
||||
listener = LocationListener.get()
|
||||
listener.start()
|
||||
|
||||
def disable():
|
||||
listener = LocationListener.get()
|
||||
listener.shut_down()
|
||||
|
|
|
@ -50,7 +50,7 @@ from common import gajim
|
|||
from common import dbus_support
|
||||
if dbus_support.supported:
|
||||
from music_track_listener import MusicTrackListener
|
||||
from common.location_listener import LocationListener
|
||||
from common import location_listener
|
||||
import dbus
|
||||
|
||||
import gtkgui_helpers
|
||||
|
@ -1551,7 +1551,7 @@ class Interface:
|
|||
# enable location listener
|
||||
if gajim.connections[account].pep_supported and dbus_support.supported \
|
||||
and gajim.config.get_per('accounts', account, 'publish_location'):
|
||||
self.enable_location_listener()
|
||||
location_listener.enable()
|
||||
|
||||
def handle_event_metacontacts(self, account, tags_list):
|
||||
gajim.contacts.define_metacontacts(account, tags_list)
|
||||
|
@ -2790,15 +2790,6 @@ class Interface:
|
|||
listener.disconnect(self.music_track_changed_signal)
|
||||
self.music_track_changed_signal = None
|
||||
|
||||
def enable_location_listener(self):
|
||||
listener = LocationListener.get()
|
||||
listener.get_data()
|
||||
listener.start()
|
||||
|
||||
def disable_location_listener(self):
|
||||
listener = LocationListener.get()
|
||||
listener.shut_down()
|
||||
|
||||
def music_track_changed(self, unused_listener, music_track_info, account=None):
|
||||
if not account:
|
||||
accounts = gajim.connections.keys()
|
||||
|
|
|
@ -59,6 +59,7 @@ from common import helpers
|
|||
from common.exceptions import GajimGeneralException
|
||||
from common import i18n
|
||||
from common import pep
|
||||
from common import location_listener
|
||||
|
||||
from message_window import MessageWindowMgr
|
||||
|
||||
|
@ -3437,7 +3438,7 @@ class RosterWindow:
|
|||
active = widget.get_active()
|
||||
gajim.config.set_per('accounts', account, 'publish_location', active)
|
||||
if active:
|
||||
gajim.interface.enable_location_listener()
|
||||
location_listener.enable()
|
||||
else:
|
||||
gajim.connections[account].retract_location()
|
||||
# disable music listener only if no other account uses it
|
||||
|
@ -3445,7 +3446,7 @@ class RosterWindow:
|
|||
if gajim.config.get_per('accounts', acc, 'publish_location'):
|
||||
break
|
||||
else:
|
||||
gajim.interface.disable_location_listener()
|
||||
location_listener.disable()
|
||||
|
||||
helpers.update_optional_features(account)
|
||||
|
||||
|
|
Loading…
Reference in New Issue