Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2007-04-11 02:24:31 (GMT)
committer Dan Williams <dcbw@redhat.com>2007-04-11 02:24:31 (GMT)
commitdefd9f76e3fd3fab2fbedadd0d948ea26fb7704c (patch)
treea14e52d04a71aca8c856aca554f9fe41b5034616
parent117934f7098652ebc92262356802d920bf4b92c5 (diff)
Convert icon data to python string before exposing it
-rw-r--r--shell/view/BuddyMenu.py11
-rw-r--r--sugar/presence/buddy.py12
2 files changed, 13 insertions, 10 deletions
diff --git a/shell/view/BuddyMenu.py b/shell/view/BuddyMenu.py
index 10b198d..1a76168 100644
--- a/shell/view/BuddyMenu.py
+++ b/shell/view/BuddyMenu.py
@@ -58,15 +58,12 @@ class BuddyMenu(Menu):
if not buddy_object:
return None
- pixbuf = None
icon_data = buddy_object.props.icon
- icon_data_string = ""
- for item in icon_data:
- if item < 0:
- item = item + 128
- icon_data_string += chr(item)
+ if not icon_data:
+ return None
pbl = gtk.gdk.PixbufLoader()
- pbl.write(icon_data_string)
+ pbl.write(icon_data)
+ pixbuf = None
try:
pbl.close()
pixbuf = pbl.get_pixbuf()
diff --git a/sugar/presence/buddy.py b/sugar/presence/buddy.py
index f1b1c29..c6f51d5 100644
--- a/sugar/presence/buddy.py
+++ b/sugar/presence/buddy.py
@@ -19,6 +19,12 @@ import gobject
import gtk
import dbus
+def _bytes_to_string(bytes):
+ if len(bytes):
+ return ''.join([chr(item) for item in bytes])
+ return None
+
+
class Buddy(gobject.GObject):
__gsignals__ = {
@@ -87,14 +93,14 @@ class Buddy(gobject.GObject):
return self._properties["owner"]
elif pspec.name == "icon":
if not self._icon:
- self._icon = self._buddy.GetIcon()
+ self._icon = _bytes_to_string(self._buddy.GetIcon())
return self._icon
def object_path(self):
return self._object_path
- def _emit_icon_changed_signal(self, icon_data):
- self._icon = icon_data
+ def _emit_icon_changed_signal(self, bytes):
+ self._icon = _bytes_to_string(bytes)
self.emit('icon-changed')
return False