[commit-gajim] r11229 - in trunk: . src src/common
asterix at gajim.org
asterix at gajim.org
Mon Apr 13 23:00:33 CEST 2009
Author: asterix
Date: 2009-04-13 23:00:33 +0200 (Mon, 13 Apr 2009)
New Revision: 11229
Modified:
trunk/configure.ac
trunk/src/common/config.py
trunk/src/common/defs.py
trunk/src/common/optparser.py
trunk/src/dialogs.py
trunk/src/gajim.py
Log:
save pep things (activity and mood) in preset status messages.
Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac 2009-04-13 15:15:45 UTC (rev 11228)
+++ trunk/configure.ac 2009-04-13 21:00:33 UTC (rev 11229)
@@ -1,5 +1,5 @@
AC_INIT([Gajim - A Jabber Instant Messager],
- [0.12.1.2-svn],[http://trac.gajim.org/],[gajim])
+ [0.12.1.3-svn],[http://trac.gajim.org/],[gajim])
AC_PREREQ([2.59])
AC_CONFIG_HEADER(config.h)
Modified: trunk/src/common/config.py
===================================================================
--- trunk/src/common/config.py 2009-04-13 15:15:45 UTC (rev 11228)
+++ trunk/src/common/config.py 2009-04-13 21:00:33 UTC (rev 11229)
@@ -350,6 +350,11 @@
}, {}),
'statusmsg': ({
'message': [ opt_str, '' ],
+ 'activity': [ opt_str, '' ],
+ 'subactivity': [ opt_str, '' ],
+ 'activity_text': [ opt_str, '' ],
+ 'mood': [ opt_str, '' ],
+ 'mood_text': [ opt_str, '' ],
}, {}),
'defaultstatusmsg': ({
'enabled': [ opt_bool, False ],
@@ -430,13 +435,13 @@
}
statusmsg_default = {
- _('Sleeping'): 'ZZZZzzzzzZZZZZ',
- _('Back soon'): _('Back in some minutes.'),
- _('Eating'): _("I'm eating, so leave me a message."),
- _('Movie'): _("I'm watching a movie."),
- _('Working'): _("I'm working."),
- _('Phone'): _("I'm on the phone."),
- _('Out'): _("I'm out enjoying life."),
+ _('Sleeping'): [ 'ZZZZzzzzzZZZZZ', 'inactive', 'sleeping', '', 'sleepy', '' ],
+ _('Back soon'): [ _('Back in some minutes.'), '', '', '', '', '' ],
+ _('Eating'): [ _("I'm eating, so leave me a message."), 'eating', 'other', '', '', '' ],
+ _('Movie'): [ _("I'm watching a movie."), 'relaxing', 'watching_a_movie', '', '', '' ],
+ _('Working'): [ _("I'm working."), 'working', 'other', '', '', '' ],
+ _('Phone'): [ _("I'm on the phone."), 'talking', 'on_the_phone', '', '', '' ],
+ _('Out'): [ _("I'm out enjoying life."), 'relaxing', 'going_out', '', '', '' ],
}
defaultstatusmsg_default = {
Modified: trunk/src/common/defs.py
===================================================================
--- trunk/src/common/defs.py 2009-04-13 15:15:45 UTC (rev 11228)
+++ trunk/src/common/defs.py 2009-04-13 21:00:33 UTC (rev 11229)
@@ -27,7 +27,7 @@
datadir = '../'
localedir = '../po'
-version = '0.12.1.2-svn'
+version = '0.12.1.3-svn'
import sys, os.path
for base in ('.', 'common'):
Modified: trunk/src/common/optparser.py
===================================================================
--- trunk/src/common/optparser.py 2009-04-13 15:15:45 UTC (rev 11228)
+++ trunk/src/common/optparser.py 2009-04-13 21:00:33 UTC (rev 11229)
@@ -191,6 +191,8 @@
self.update_config_to_01211()
if old < [0, 12, 1, 2] and new >= [0, 12, 1, 2]:
self.update_config_to_01212()
+ if old < [0, 12, 1, 3] and new >= [0, 12, 1, 3]:
+ self.update_config_to_01213()
gajim.logger.init_vars()
gajim.config.set('version', new_version)
@@ -629,4 +631,20 @@
gajim.config.set_per('accounts', account, opt, val)
gajim.config.set('version', '0.12.1.2')
+ def update_config_to_01213(self):
+ msgs = gajim.config.statusmsg_default
+ for msg_name in gajim.config.get_per('statusmsg'):
+ if msg_name in msgs:
+ gajim.config.set_per('statusmsg', msg_name, 'activity',
+ msgs[msg_name][1])
+ gajim.config.set_per('statusmsg', msg_name, 'subactivity',
+ msgs[msg_name][2])
+ gajim.config.set_per('statusmsg', msg_name, 'activity_text',
+ msgs[msg_name][3])
+ gajim.config.set_per('statusmsg', msg_name, 'mood',
+ msgs[msg_name][4])
+ gajim.config.set_per('statusmsg', msg_name, 'mood_text',
+ msgs[msg_name][5])
+ gajim.config.set('version', '0.12.1.3')
+
# vim: se ts=3:
Modified: trunk/src/dialogs.py
===================================================================
--- trunk/src/dialogs.py 2009-04-13 15:15:45 UTC (rev 11228)
+++ trunk/src/dialogs.py 2009-04-13 21:00:33 UTC (rev 11229)
@@ -435,12 +435,6 @@
self.entry.get_text().decode('utf-8'))
else:
self.on_response(None, None, '')
-# if self.checkbutton.get_active():
-# pep.user_send_activity(self.account, self.activity,
-# self.subactivity,
-# self.entry.get_text().decode('utf-8'))
-# else:
-# pep.user_send_activity(self.account, '')
self.window.destroy()
def on_cancel_button_clicked(self, widget):
@@ -523,10 +517,6 @@
'''Return mood and messsage (None if no mood selected)'''
message = self.entry.get_text().decode('utf-8')
self.on_response(self.mood, message)
-# if self.mood is None:
-# pep.user_send_mood(self.account, '')
-# else:
-# pep.user_send_mood(self.account, self.mood, message)
self.window.destroy()
def on_cancel_button_clicked(self, widget):
@@ -559,11 +549,14 @@
self.message_buffer.set_text(msg)
# have an empty string selectable, so user can clear msg
- self.preset_messages_dict = {'': ''}
+ self.preset_messages_dict = {'': ['', '', '', '', '', '']}
for msg_name in gajim.config.get_per('statusmsg'):
- msg_text = gajim.config.get_per('statusmsg', msg_name, 'message')
- msg_text = helpers.from_one_line(msg_text)
- self.preset_messages_dict[msg_name] = msg_text
+ opts = []
+ for opt in ['message', 'activity', 'subactivity', 'activity_text',
+ 'mood', 'mood_text']:
+ opts.append(gajim.config.get_per('statusmsg', msg_name, opt))
+ opts[0] = helpers.from_one_line(opts[0])
+ self.preset_messages_dict[msg_name] = opts
sorted_keys_list = helpers.get_sorted_keys(self.preset_messages_dict)
countdown_time = gajim.config.get('change_status_window_timeout')
@@ -671,7 +664,14 @@
if active < 0:
return None
name = model[active][0].decode('utf-8')
- self.message_buffer.set_text(self.preset_messages_dict[name])
+ self.message_buffer.set_text(self.preset_messages_dict[name][0])
+ self.pep_dict['activity'] = self.preset_messages_dict[name][1]
+ self.pep_dict['subactivity'] = self.preset_messages_dict[name][2]
+ self.pep_dict['activity_text'] = self.preset_messages_dict[name][3]
+ self.pep_dict['mood'] = self.preset_messages_dict[name][4]
+ self.pep_dict['mood_text'] = self.preset_messages_dict[name][5]
+ self.draw_activity()
+ self.draw_mood()
def on_change_status_message_dialog_key_press_event(self, widget, event):
self.countdown_enabled = False
@@ -700,21 +700,32 @@
if not msg_name: # msg_name was ''
msg_name = msg_text_1l.decode('utf-8')
+ def on_ok2():
+ self.preset_messages_dict[msg_name] = [msg_text, self.pep_dict.get(
+ 'activity'), self.pep_dict.get('subactivity'), self.pep_dict.get(
+ 'activity_text'), self.pep_dict.get('mood'), self.pep_dict.get(
+ 'mood_text')]
+ gajim.config.set_per('statusmsg', msg_name, 'message', msg_text_1l)
+ gajim.config.set_per('statusmsg', msg_name, 'activity',
+ self.pep_dict.get('activity'))
+ gajim.config.set_per('statusmsg', msg_name, 'subactivity',
+ self.pep_dict.get('subactivity'))
+ gajim.config.set_per('statusmsg', msg_name, 'activity_text',
+ self.pep_dict.get('activity_text'))
+ gajim.config.set_per('statusmsg', msg_name, 'mood',
+ self.pep_dict.get('mood'))
+ gajim.config.set_per('statusmsg', msg_name, 'mood_text',
+ self.pep_dict.get('mood_text'))
if msg_name in self.preset_messages_dict:
- def on_ok2():
- self.preset_messages_dict[msg_name] = msg_text
- gajim.config.set_per('statusmsg', msg_name, 'message',
- msg_text_1l)
ConfirmationDialog(_('Overwrite Status Message?'),
_('This name is already used. Do you want to overwrite this '
'status message?'), on_response_ok=on_ok2)
return
- self.preset_messages_dict[msg_name] = msg_text
+ gajim.config.add_per('statusmsg', msg_name)
+ on_ok2()
iter_ = self.message_liststore.append((msg_name,))
- gajim.config.add_per('statusmsg', msg_name)
# select in combobox the one we just saved
self.message_combobox.set_active_iter(iter_)
- gajim.config.set_per('statusmsg', msg_name, 'message', msg_text_1l)
InputDialog(_('Save as Preset Status Message'),
_('Please type a name for this status message'), is_modal=False,
ok_handler=on_ok)
Modified: trunk/src/gajim.py
===================================================================
--- trunk/src/gajim.py 2009-04-13 15:15:45 UTC (rev 11228)
+++ trunk/src/gajim.py 2009-04-13 21:00:33 UTC (rev 11229)
@@ -3264,10 +3264,17 @@
pass
# add default status messages if there is not in the config file
if len(gajim.config.get_per('statusmsg')) == 0:
- for msg in gajim.config.statusmsg_default:
+ default = gajim.config.statusmsg_default
+ for msg in default:
gajim.config.add_per('statusmsg', msg)
- gajim.config.set_per('statusmsg', msg, 'message',
- gajim.config.statusmsg_default[msg])
+ gajim.config.set_per('statusmsg', msg, 'message', default[msg][0])
+ gajim.config.set_per('statusmsg', msg, 'activity', default[msg][1])
+ gajim.config.set_per('statusmsg', msg, 'subactivity',
+ default[msg][2])
+ gajim.config.set_per('statusmsg', msg, 'activity_text',
+ default[msg][3])
+ gajim.config.set_per('statusmsg', msg, 'mood', default[msg][4])
+ gajim.config.set_per('statusmsg', msg, 'mood_text', default[msg][5])
#add default themes if there is not in the config file
theme = gajim.config.get('roster_theme')
if not theme in gajim.config.get_per('themes'):
More information about the Commits
mailing list