Re: Pidgin status



2010/8/30 William Friesen <wfriesen gmail com>:
> I have added the ability to change between Pidgin's saved statuses to
> http://github.com/wfriesen/kupfer
> So far all the statuses are obtained via dbus, along with their title,
> and this is used to yield the appropriate StatusLeaf objects.
> So far, each object just uses the pidgin icon, but I'd like to change that.
> Each saved status can have a 'type' (which can be obtained from a dbus
> method), which corresponds to one of
> STATUS_OFFLINE = 1
> STATUS_AVAILABLE = 2
> STATUS_UNAVAILABLE = 3
> STATUS_INVISIBLE = 4
> STATUS_AWAY = 5
> STATUS_EXTENDED_AWAY = 6
> STATUS_MOBILE = 7
> STATUS_TUNE = 8
> On my system pidgin stores some icons in
> /usr/share/pixmaps/pidgin/status which match up with several of the
> above status types.
> Ideally when a saved status matches one of these types, the
> appropriate icon would be used, but I am still unfamiliar with how
> kupfer finds icons to use.


Hi William,

Here are my code review comments, it's all about coding style (mostly
how and not what we do).

StatusLeaf: make self.status_icons a class attribute by defining it in
class scope 'status_icons = { ..'; this way there is only one copy of
the dict for all statuses. Access is still 'self.status_icons'.

Leaves in general have two properties that they always have: their
name and the "represented object" 'self.object'. Take advantage of
this by constructing it as RunnableLeaf.__init__(self, status, title)
sefl.status_type stays as an object attribute.

_("Set Pidgin status to " + self.title)  will look for "Set Pidgin
status to Away"  (etc) in the gettext catalog, and will find nothing.
You want  _('Set Pidgin status to "%s"') % (unicode(self), )  -- We
translate the format string, then we interpolate it (insert
variables).


Do the specific icons already work for you? Kupfer simply resolves
icons by asking the current icon theme --what's the icon for
'user-offline'? (answer  might be None)  So it's simple as long as the
icons are installed into the icon system. (/usr/share/pixmap is not).

Also, we can consider adding an update callback when pidgin launches
(See the contacts source that uses callbacks; this will be similar but
easier).

Thanks for this contribution.
Ulrik


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]