Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar

This commit is contained in:
Marco Pesenti Gritti 2007-07-18 14:56:01 +02:00
commit de2d4ef43b
6 changed files with 57 additions and 11 deletions

5
NEWS
View File

@ -1,3 +1,8 @@
* Actually handle multiple mime types (dcbw)
* Keep owner in the center in mesh view (dcbw)
* Suppress annoying warnings about unknown activities from the PS (dcbw)
* Don't close GlibTCPServer sockets prematurely (dcbw)
Snapshot 5212790236
* Fix initialization order of buddy class '_activities' member (dcbw)

View File

@ -113,7 +113,15 @@ class HomeActivity(gobject.GObject):
colour for the icon.
"""
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:
return XoColor(activity.props.color)
else:

View File

@ -105,13 +105,24 @@ class FriendsBox(hippo.CanvasBox):
'buddy-left', self.__buddy_left_cb)
def _active_activity_changed_cb(self, home_model, home_activity):
if home_activity:
activity_id = home_activity.get_activity_id()
if activity_id:
ps = self._pservice.get_activity(activity_id)
self._set_activity_ps(ps)
else:
self._set_activity_ps(None)
if not home_activity:
self._set_activity_ps(None)
return
activity_id = home_activity.get_activity_id()
if not activity_id:
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:
self._set_activity_ps(None)

View File

@ -260,6 +260,9 @@ class MeshBox(hippo.CanvasBox):
self._remove_buddy(buddy_model)
def _buddy_moved_cb(self, model, buddy_model, activity_model):
# Owner doesn't move from the center
if buddy_model.is_owner():
return
self._move_buddy(buddy_model, activity_model)
def _activity_added_cb(self, model, activity_model):

View File

@ -132,7 +132,7 @@ class Bundle:
if cp.has_option(section, 'mime_types'):
mime_list = cp.get(section, 'mime_types')
self._mime_types = mime_list.strip(';')
self._mime_types = mime_list.strip(';').split(';')
if cp.has_option(section, 'show_launcher'):
if cp.get(section, 'show_launcher') == 'no':

View File

@ -69,6 +69,11 @@ class GlibTCPServer(SocketServer.TCPServer):
self.handle_request()
return True
def close_request(self, request):
"""Called to clean up an individual request."""
# let the request be closed by the request handler when its done
pass
class ChunkedGlibHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
"""RequestHandler class that integrates with Glib mainloop. It writes
@ -112,6 +117,7 @@ class ChunkedGlibHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def _cleanup(self):
if self._file:
self._file.close()
self._file = None
if self._srcid > 0:
gobject.source_remove(self._srcid)
self._srcid = 0
@ -507,12 +513,23 @@ def xmlrpc_test(loop):
error_handler=xmlrpc_error_cb,
user_data=loop)
def main():
loop = gobject.MainLoop()
def start_xmlrpc():
server = GlibXMLRPCServer(("", 8888))
inst = Test()
server.register_instance(inst)
gobject.idle_add(xmlrpc_test, loop)
class TestReqHandler(ChunkedGlibHTTPRequestHandler):
def translate_path(self, path):
return "/tmp/foo"
def start_http():
server = GlibTCPServer(("", 8890), TestReqHandler)
def main():
loop = gobject.MainLoop()
# start_xmlrpc()
start_http()
try:
loop.run()
except KeyboardInterrupt:
@ -521,3 +538,5 @@ def main():
if __name__ == "__main__":
main()