[kupfer: 2/22] plugin.pidgin: refactor get_buddy_icon a bit
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [kupfer: 2/22] plugin.pidgin: refactor get_buddy_icon a bit
- Date: Fri, 30 Oct 2009 14:02:20 +0000 (UTC)
commit 05a8557b8908c4c9d90c1f1080afca73d7434435
Author: Chmouel Boudjnah <chmouel boudjnah rackspace co uk>
Date: Tue Oct 27 12:01:39 2009 +0000
plugin.pidgin: refactor get_buddy_icon a bit
kupfer/plugin/pidgin.py | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/kupfer/plugin/pidgin.py b/kupfer/plugin/pidgin.py
index 751ddc8..16b59a9 100644
--- a/kupfer/plugin/pidgin.py
+++ b/kupfer/plugin/pidgin.py
@@ -91,6 +91,12 @@ class ContactsSource(AppLeafContentMixin, Source):
def __init__(self):
Source.__init__(self, _('Pidgin Contacts'))
+ def _get_buddy_icon(self, interface, buddy):
+ ''' Lookup the buddy Icon via DBUS Pidgin API '''
+ icon = interface.PurpleBuddyGetIcon(buddy)
+ if icon != 0:
+ return interface.PurpleBuddyIconGetFullPath(icon)
+
def get_items(self):
interface = _create_dbus_connection()
if interface is None:
@@ -100,15 +106,12 @@ class ContactsSource(AppLeafContentMixin, Source):
buddies = interface.PurpleFindBuddies(account, dbus.String(''))
for buddy in buddies:
+ if not interface.PurpleBuddyIsOnline(buddy):
+ continue
+
jid = interface.PurpleBuddyGetName(buddy)
name = interface.PurpleBuddyGetAlias(buddy)
- _icon = interface.PurpleBuddyGetIcon(buddy)
- icon = None
- if _icon != 0:
- icon = interface.PurpleBuddyIconGetFullPath(_icon)
- if not interface.PurpleBuddyIsOnline(buddy):
- continue
-
+ icon = self._get_buddy_icon(interface, buddy)
yield PidginContact(jid, name, account, icon)
def is_dynamic(self):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]