Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim-plugins.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Fomin <fominde@gmail.com>2012-04-10 01:55:05 +0400
committerDenis Fomin <fominde@gmail.com>2012-04-10 01:55:05 +0400
commit38efc8c3b4cbbfa3031dacd0679cef6e4cc386da (patch)
tree3256e25db34f04c337996bc43ec40bc7deb61635 /roster_tweaks/roster_tweaks.py
parent88edc3f6102c3878c6026a201bb9140553eba7d9 (diff)
roster_tweaks. rewrite pep support
Diffstat (limited to 'roster_tweaks/roster_tweaks.py')
-rw-r--r--roster_tweaks/roster_tweaks.py53
1 files changed, 21 insertions, 32 deletions
diff --git a/roster_tweaks/roster_tweaks.py b/roster_tweaks/roster_tweaks.py
index c9c57f8..794bf7a 100644
--- a/roster_tweaks/roster_tweaks.py
+++ b/roster_tweaks/roster_tweaks.py
@@ -28,9 +28,29 @@ class RosterTweaksPlugin(GajimPlugin):
'use_ctr_m': (False, ''),
'menu_visible': (True, ''),
'quick_status': (False, '')}
- self.events_handlers = {'our-show': (ged.GUI2, self.our_show)}
+ self.events_handlers = {'our-show': (ged.GUI2, self.our_show),
+ 'pep-received': (ged.GUI2, self.pep_received)}
self.roster = gajim.interface.roster
+
+ def pep_received(self, obj):
+ if obj.jid != gajim.get_jid_from_account(obj.conn.name):
+ return
+
+ pep_dict = gajim.connections[obj.conn.name].pep
+ if obj.pep_type == 'mood':
+ img = self.xml.get_object('mood_image')
+ if 'mood' in pep_dict:
+ img.set_from_pixbuf(pep_dict['mood'].asPixbufIcon())
+ else:
+ img.set_from_stock('gtk-stop', gtk.ICON_SIZE_MENU)
+ if obj.pep_type == 'activity':
+ img = self.xml.get_object('activity_image')
+ if 'activity' in pep_dict:
+ img.set_from_pixbuf(pep_dict['activity'].asPixbufIcon())
+ else:
+ img.set_from_stock('gtk-stop', gtk.ICON_SIZE_MENU)
+
def our_show(self, obj):
if self.active:
if helpers.get_global_show() != gajim.SHOW_LIST[0]:
@@ -114,7 +134,6 @@ class RosterTweaksPlugin(GajimPlugin):
self.pep_dict['activity'] = activity or ''
self.pep_dict['subactivity'] = subactivity or ''
self.pep_dict['activity_text'] = text
- self.draw_activity()
self.send_pep()
ChangeActivityDialog(on_response, self.pep_dict.get('activity', None),
self.pep_dict.get('subactivity', None),
@@ -124,7 +143,6 @@ class RosterTweaksPlugin(GajimPlugin):
def on_response(mood, text):
self.pep_dict['mood'] = mood or ''
self.pep_dict['mood_text'] = text
- self.draw_mood()
self.send_pep()
ChangeMoodDialog(on_response, self.pep_dict.get('mood', None),
self.pep_dict.get('mood_text', None))
@@ -135,35 +153,6 @@ class RosterTweaksPlugin(GajimPlugin):
if gajim.account_is_connected(account):
self.roster.send_pep(account, self.pep_dict)
- def draw_activity(self):
- """
- Set activity button
- """
- img = self.xml.get_object('activity_image')
- if 'activity' in self.pep_dict and self.pep_dict['activity'] in \
- pep.ACTIVITIES:
- if 'subactivity' in self.pep_dict and self.pep_dict['subactivity'] \
- in pep.ACTIVITIES[self.pep_dict['activity']]:
- img.set_from_pixbuf(gtkgui_helpers.load_activity_icon(
- self.pep_dict['activity'], self.pep_dict['subactivity']).\
- get_pixbuf())
- else:
- img.set_from_pixbuf(gtkgui_helpers.load_activity_icon(
- self.pep_dict['activity']).get_pixbuf())
- else:
- img.set_from_stock('gtk-stop', gtk.ICON_SIZE_MENU)
-
- def draw_mood(self):
- """
- Set mood button
- """
- img = self.xml.get_object('mood_image')
- if 'mood' in self.pep_dict and self.pep_dict['mood'] in pep.MOODS:
- img.set_from_pixbuf(gtkgui_helpers.load_mood_icon(
- self.pep_dict['mood']).get_pixbuf())
- else:
- img.set_from_stock('gtk-stop', gtk.ICON_SIZE_MENU)
-
class RosterTweaksPluginConfigDialog(GajimPluginConfigDialog):
def init(self):