Re: Pidgin Plugin Rebased
- From: Ulrik Sverdrup <ulrik sverdrup gmail com>
- To: Chmouel Boudjnah <chmouel chmouel com>
- Cc: Kupfer list <kupfer-list gnome org>, Karol Będkowski <karol bedkowski gmail com>
- Subject: Re: Pidgin Plugin Rebased
- Date: Wed, 28 Oct 2009 20:55:08 +0100
Here's the patch for descriptions.
From 7d7219f752bf1b0a8bfc946ae284498ce444e0f8 Mon Sep 17 00:00:00 2001
From: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Wed, 28 Oct 2009 17:30:22 +0100
Subject: [PATCH] plugin.{gajim,pidgin}: Unify pidgin and gajim contact descriptions
---
kupfer/plugin/gajim.py | 14 +++++++++-----
kupfer/plugin/pidgin.py | 21 +++++++++++----------
2 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/kupfer/plugin/gajim.py b/kupfer/plugin/gajim.py
index c188001..a1af001 100644
--- a/kupfer/plugin/gajim.py
+++ b/kupfer/plugin/gajim.py
@@ -51,11 +51,15 @@ class GajimContact(Leaf):
""" Leaf represent single contact from Gajim """
def __init__(self, name, jid, account, status, resource):
- Leaf.__init__(self, name or jid, name or jid)
-
- str_resource = ("/" + resource[0][0]) if resource and len(resource) > 0 else ''
- self._description = ('[' + _STATUSES.get(status, status) + '] '+ \
- jid + str_resource + ' via ' + account )
+ obj = (account, jid)
+ Leaf.__init__(self, obj, name or jid)
+
+ self._description = _("[%(status)s] %(userid)s/%(service)s") % \
+ {
+ "status": _STATUSES.get(status, status),
+ "userid": jid,
+ "service": resource[0][0] if resource else u"",
+ }
self.account = account
def get_actions(self):
diff --git a/kupfer/plugin/pidgin.py b/kupfer/plugin/pidgin.py
index e7513e7..0a50f23 100644
--- a/kupfer/plugin/pidgin.py
+++ b/kupfer/plugin/pidgin.py
@@ -89,12 +89,15 @@ class PidginContact(Leaf):
obj = (account, jid)
Leaf.__init__(self, obj, name or jid)
- self.info = {
- "userid": jid,
- "available": u"" if available else u", %s" % _("Away"),
- "protocol": protocol,
- "status": status_message,
- }
+ self._description = _("[%(status)s] %(userid)s/%(service)s") % \
+ {
+ "status": _("Available") if available else _("Away"),
+ "userid": jid,
+ "service": protocol,
+ }
+
+ if status_message:
+ self._description += u"\n%s" % status_message
self.account = account
self.jid = jid
@@ -105,10 +108,7 @@ class PidginContact(Leaf):
yield SendMessage()
def get_description(self):
- desc = _("%(userid)s on %(protocol)s%(available)s") % self.info
- if self.info["status"]:
- desc += u"\n%s" % self.info["status"]
- return desc
+ return self._description
def get_thumbnail(self, width, height):
if not self.icon:
@@ -125,6 +125,7 @@ class ContactsSource(AppLeafContentMixin, Source, PicklingHelperMixin):
def __init__(self):
Source.__init__(self, _('Pidgin Contacts'))
+ self._version = 2
self.unpickle_finish()
def unpickle_finish(self):
--
1.6.4
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]