Convert icon data to python string before exposing it

This commit is contained in:
Dan Williams 2007-04-10 22:24:31 -04:00
parent 117934f709
commit defd9f76e3
2 changed files with 13 additions and 10 deletions

View File

@ -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()

View File

@ -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