Suppress annoying warnings about unknown activities from the PS

This commit is contained in:
Dan Williams 2007-07-18 02:04:01 -04:00
parent 83a49dcd4e
commit 326126cbd7
3 changed files with 28 additions and 8 deletions

1
NEWS
View File

@ -1,3 +1,4 @@
* Suppress annoying warnings about unknown activities from the PS (dcbw)
* Don't close GlibTCPServer sockets prematurely (dcbw) * Don't close GlibTCPServer sockets prematurely (dcbw)
Snapshot 5212790236 Snapshot 5212790236

View File

@ -113,7 +113,15 @@ class HomeActivity(gobject.GObject):
colour for the icon. colour for the icon.
""" """
pservice = presenceservice.get_instance() pservice = presenceservice.get_instance()
activity = pservice.get_activity(self._activity_id)
# HACK to suppress warning in logs when activity isn't found
# (if it's locally launched and not shared yet)
activity = None
for act in pservice.get_activities():
if self._activity_id == act.props.id:
activity = act
break
if activity != None: if activity != None:
return XoColor(activity.props.color) return XoColor(activity.props.color)
else: else:

View File

@ -105,13 +105,24 @@ class FriendsBox(hippo.CanvasBox):
'buddy-left', self.__buddy_left_cb) 'buddy-left', self.__buddy_left_cb)
def _active_activity_changed_cb(self, home_model, home_activity): def _active_activity_changed_cb(self, home_model, home_activity):
if home_activity: if not home_activity:
activity_id = home_activity.get_activity_id() self._set_activity_ps(None)
if activity_id: return
ps = self._pservice.get_activity(activity_id)
self._set_activity_ps(ps) activity_id = home_activity.get_activity_id()
else: if not activity_id:
self._set_activity_ps(None) self._set_activity_ps(None)
return
# HACK to suppress warning in logs when activity isn't found
# (if it's locally launched and not shared yet)
activity = None
for act in self._pservice.get_activities():
if activity_id == act.props.id:
activity = act
break
if activity:
self._set_activity_ps(activity)
else: else:
self._set_activity_ps(None) self._set_activity_ps(None)