diff --git a/data/activities/default/unknown/category.png b/data/activities/default/unknown/category.png
new file mode 100644
index 000000000..63d9034cb
Binary files /dev/null and b/data/activities/default/unknown/category.png differ
diff --git a/src/chat_control.py b/src/chat_control.py
index 5b6152be8..0a6825192 100644
--- a/src/chat_control.py
+++ b/src/chat_control.py
@@ -45,7 +45,7 @@ from common.contacts import GC_Contact
from common.logger import Constants
constants = Constants()
from common.rst_xhtml_generator import create_xhtml
-from common.pep import MOODS
+from common.pep import MOODS, ACTIVITIES
from common.xmpp.protocol import NS_XHTML, NS_FILE, NS_MUC, NS_RECEIPTS
from common.xmpp.protocol import NS_ESESSION
@@ -1105,6 +1105,7 @@ class ChatControl(ChatControlBase):
self._tune_tooltip = gtk.Tooltips()
self.update_mood()
+ self.update_activity()
self.update_tune()
# keep timeout id and window obj for possible big avatar
@@ -1203,21 +1204,16 @@ class ChatControl(ChatControlBase):
self._convert_to_gc_button.set_sensitive(False)
def update_mood(self):
- if not isinstance(self.contact, GC_Contact) \
- and self.contact.mood.has_key('mood'):
- mood = self.contact.mood['mood']
- if HAVE_MARKUP_TOOLTIPS:
- mood = gobject.markup_escape_text(mood)
- else:
- mood = None
+ mood = None
+ text = ''
- if not isinstance(self.contact, GC_Contact) \
- and self.contact.mood.has_key('text'):
+ if isinstance(self.contact, GC_Contact):
+ return
+
+ if self.contact.mood.has_key('mood'):
+ mood = self.contact.mood['mood']
+ if self.contact.mood.has_key('text'):
text = self.contact.mood['text']
- if HAVE_MARKUP_TOOLTIPS:
- text = gobject.markup_escape_text(text)
- else:
- text = ''
if mood is not None:
if mood in MOODS:
@@ -1232,6 +1228,9 @@ class ChatControl(ChatControlBase):
'unknown').get_pixbuf())
if HAVE_MARKUP_TOOLTIPS:
+ mood = gobject.markup_escape_text(mood)
+ text = gobject.markup_escape_text(text)
+
self._mood_image.set_tooltip_markup(
'%s%s%s' % (mood,
'\n' if text is not '' else '', text))
@@ -1243,23 +1242,79 @@ class ChatControl(ChatControlBase):
else:
self._mood_image.hide()
+ def update_activity(self):
+ activity = None
+ subactivity = ''
+ text = ''
+
+ if isinstance(self.contact, GC_Contact):
+ return
+
+ if self.contact.activity.has_key('activity'):
+ activity = self.contact.activity['activity']
+ if self.contact.activity.has_key('subactivity'):
+ subactivity = self.contact.activity['subactivity']
+ if self.contact.activity.has_key('text'):
+ text = self.contact.activity['text']
+
+ if activity is not None:
+ if activity in ACTIVITIES:
+ self._activity_image.set_from_pixbuf(
+ gtkgui_helpers.load_activity_icon(
+ activity).get_pixbuf())
+ # Translate standard activities
+ if subactivity in ACTIVITIES[activity]:
+ subactivity = ACTIVITIES[activity] \
+ [subactivity]
+ activity = ACTIVITIES[activity]['category']
+ else:
+ self._activity_image.set_from_pixbuf(
+ gtkgui_helpers.load_activity_icon(
+ 'unknown').get_pixbuf())
+
+ # Translate standard subactivities
+
+ if HAVE_MARKUP_TOOLTIPS:
+ activity = gobject.markup_escape_text(activity)
+ subactivity = gobject.markup_escape_text(
+ subactivity)
+ text = gobject.markup_escape_text(text)
+
+ self._activity_image.set_tooltip_markup(
+ '%s%s%s%s%s' % (activity,
+ ': ' if subactivity is not '' else '',
+ subactivity,
+ '\n' if text is not '' else '', text))
+ else:
+ self._activity_tooltip.set_tip(
+ self._activity_image, '%s%s%s%s%s' % (
+ activity,
+ ': ' if subactivity is not '' else '',
+ subactivity,
+ '\n' if text is not '' else '', text))
+
+ self._activity_image.show()
+ else:
+ self._activity_image.hide()
+
+
def update_tune(self):
artist = None
title = None
source = None
- if not isinstance(self.contact, GC_Contact) \
- and self.contact.tune.has_key('artist'):
+ if isinstance(self.contact, GC_Contact):
+ return
+
+ if self.contact.tune.has_key('artist'):
artist = self.contact.tune['artist'].strip()
if HAVE_MARKUP_TOOLTIPS:
artist = gobject.markup_escape_text(artist)
- if not isinstance(self.contact, GC_Contact) \
- and self.contact.tune.has_key('title'):
+ if self.contact.tune.has_key('title'):
title = self.contact.tune['title'].strip()
if HAVE_MARKUP_TOOLTIPS:
title = gobject.markup_escape_text(title)
- if not isinstance(self.contact, GC_Contact) \
- and self.contact.tune.has_key('source'):
+ if self.contact.tune.has_key('source'):
source = self.contact.tune['source'].strip()
if HAVE_MARKUP_TOOLTIPS:
source = gobject.markup_escape_text(source)
diff --git a/src/common/pep.py b/src/common/pep.py
index 448263ba1..f5db85593 100644
--- a/src/common/pep.py
+++ b/src/common/pep.py
@@ -12,7 +12,7 @@ MOODS = ['afraid', 'amazed', 'angry', 'annoyed', 'anxious', 'aroused',
'shy', 'sick', 'sleepy', 'stressed', 'surprised', 'thirsty', 'worried']
ACTIVITIES = {
- 'doing_chores': {
+ 'doing_chores': {'category': _('Doing Chores'),
'buying_groceries': _('Buying Groceries'),
'cleaning': _('Cleaning'),
'cooking': _('Cooking'),
@@ -22,16 +22,16 @@ ACTIVITIES = {
'gardening': _('Gardening'),
'running_an_errand': _('Running an Errand'),
'walking_the_dog': _('Walking the Dog')},
- 'drinking': {
+ 'drinking': {'category': _('Drinking'),
'having_a_beer': _('Having a Beer'),
'having_coffee': _('Having Coffee'),
'having_tea': _('Having Tea')},
- 'eating': {
+ 'eating': {'category': _('Eating'),
'having_a_snack': _('Having a Snack'),
'having_breakfast': _('Having Breakfast'),
'having_dinner': _('Having Dinner'),
'having_lunch': _('Having Lunch')},
- 'exercising': {
+ 'exercising': {'category': _('Exercising'),
'cycling': _('Cycling'),
'hiking': _('Hiking'),
'jogging': _('Jogging'),
@@ -40,21 +40,21 @@ ACTIVITIES = {
'skiing': _('Skiing'),
'swimming': _('Swimming'),
'working_out': _('Working out')},
- 'grooming': {
+ 'grooming': {'category': _('Grooming'),
'at_the_spa': _('At the Spa'),
'brushing_teeth': _('Brushing Teeth'),
'getting_a_haircut': _('Getting a Haircut'),
'shaving': _('Shaving'),
'taking_a_bath': _('Taking a Bath'),
'taking_a_shower': _('Taking a Shower')},
- 'having_appointment': {},
- 'inactive': {
+ 'having_appointment': {'category:': _('Having an Appointment')},
+ 'inactive': {'category': _('Inactive'),
'day_off': _('Day Off'),
'hanging_out': _('Haning out'),
'on_vacation': _('On Vacation'),
'scheduled_holiday': _('Scheduled Holiday'),
'sleeping': _('Sleeping')},
- 'relaxing': {
+ 'relaxing': {'category': _('Relaxing'),
'gaming': _('Gaming'),
'going_out': _('Going out'),
'partying': _('Partying'),
@@ -65,11 +65,11 @@ ACTIVITIES = {
'sunbathing': _('Sunbathing'),
'watching_tv': _('Watching TV'),
'watching_a_movie': _('Watching a Movie')},
- 'talking': {
+ 'talking': {'category': _('Talking'),
'in_real_life': _('In Real Life'),
'on_the_phone': _('On the Phone'),
'on_video_phone': _('On Video Phone')},
- 'traveling': {
+ 'traveling': {'category': _('Traveling'),
'commuting': _('Commuting'),
'cycling': _('Cycling'),
'driving': _('Driving'),
@@ -79,7 +79,7 @@ ACTIVITIES = {
'on_a_train': _('On a Train'),
'on_a_trip': _('On a Trip'),
'walking': _('Walking')},
- 'working': {
+ 'working': {'category': _('Working'),
'coding': _('Coding'),
'in_a_meeting': _('In a Meeting'),
'studying': _('Studying'),
@@ -319,6 +319,14 @@ def user_activity(items, name, jid):
if contact.activity.has_key('text'):
del contact.activity['text']
+ #if jid == gajim.get_jid_from_account(name):
+ # gajim.interface.roster.draw_account(name)
+ #else:
+ # gajim.interface.roster.draw_activity(user, name)
+ ctrl = gajim.interface.msg_win_mgr.get_control(user, name)
+ if ctrl:
+ ctrl.update_activity()
+
def user_nickname(items, name, jid):
has_child = False
retract = False
diff --git a/src/dialogs.py b/src/dialogs.py
index dbdb72a94..7da8a37e0 100644
--- a/src/dialogs.py
+++ b/src/dialogs.py
@@ -360,6 +360,9 @@ class ChangeActivityDialog:
vbox = self.xml.get_widget(category + '_vbox')
for activity in pep.ACTIVITIES[category]:
+ if activity == 'category':
+ continue
+
act = category + '_' + activity
if group: