status messages now work
This commit is contained in:
parent
a269e4c421
commit
d75597cc38
|
@ -128,7 +128,10 @@ class Config:
|
||||||
'gpgpassword': [ opt_str, '' ],
|
'gpgpassword': [ opt_str, '' ],
|
||||||
'sync_with_global_status': [ opt_bool, 'True' ],
|
'sync_with_global_status': [ opt_bool, 'True' ],
|
||||||
'no_log_for': [ opt_str, '' ],
|
'no_log_for': [ opt_str, '' ],
|
||||||
} , {}),
|
}, {}),
|
||||||
|
'statusmsg': ({
|
||||||
|
'message': [ opt_str, '' ],
|
||||||
|
}, {}),
|
||||||
}
|
}
|
||||||
|
|
||||||
def foreach(self, func):
|
def foreach(self, func):
|
||||||
|
|
|
@ -427,37 +427,22 @@ class Preferences_window:
|
||||||
gajim.config.get('autoxatime')*60)
|
gajim.config.get('autoxatime')*60)
|
||||||
self.plugin.save_config()
|
self.plugin.save_config()
|
||||||
|
|
||||||
def on_msg_treemodel_row_changed(self, model, path, iter):
|
def save_status_messages(self, model):
|
||||||
|
for msg in gajim.config.get_per('statusmsg'):
|
||||||
|
gajim.config.del_per('statusmsg', msg)
|
||||||
iter = model.get_iter_first()
|
iter = model.get_iter_first()
|
||||||
i = 0
|
|
||||||
while iter:
|
while iter:
|
||||||
# FIXME: we need to add options
|
gajim.config.add_per('statusmsg', model.get_value(iter, 0))
|
||||||
gajim.config.set('msg%i_name' % i, model.get_value(iter, 0))
|
gajim.config.set_per('statusmsg', model.get_value(iter, 0), 'message',\
|
||||||
gajim.config.set('msg%i' % i, model.get_value(iter, 1))
|
model.get_value(iter, 1))
|
||||||
iter = model.iter_next(iter)
|
iter = model.iter_next(iter)
|
||||||
i += 1
|
|
||||||
#FIXME: we need to remove options
|
|
||||||
# while self.plugin.config.has_key('msg%s_name' % i):
|
|
||||||
# del gajim.config.set('msg%i_name' % i)
|
|
||||||
# del gajim.config.set('msg%i' % i)
|
|
||||||
i += 1
|
|
||||||
self.plugin.save_config()
|
self.plugin.save_config()
|
||||||
|
|
||||||
|
def on_msg_treemodel_row_changed(self, model, path, iter):
|
||||||
|
self.save_status_messages(model)
|
||||||
|
|
||||||
def on_msg_treemodel_row_deleted(self, model, path, iter):
|
def on_msg_treemodel_row_deleted(self, model, path, iter):
|
||||||
iter = model.get_iter_first()
|
self.save_status_messages(model)
|
||||||
i = 0
|
|
||||||
while iter:
|
|
||||||
# FIXME: we need to add options
|
|
||||||
gajim.config.set('msg%i_name' % i, model.get_value(iter, 0))
|
|
||||||
gajim.config.set('msg%i' % i, model.get_value(iter, 1))
|
|
||||||
iter = model.iter_next(iter)
|
|
||||||
i += 1
|
|
||||||
#FIXME: we need to remove options
|
|
||||||
# while self.plugin.config.has_key('msg%s_name' % i):
|
|
||||||
# del gajim.config.set('msg%i_name' % i)
|
|
||||||
# del gajim.config.set('msg%i' % i)
|
|
||||||
i += 1
|
|
||||||
self.plugin.save_config()
|
|
||||||
|
|
||||||
def on_links_open_with_combobox_changed(self, widget):
|
def on_links_open_with_combobox_changed(self, widget):
|
||||||
if widget.get_active() == 2:
|
if widget.get_active() == 2:
|
||||||
|
@ -502,16 +487,13 @@ class Preferences_window:
|
||||||
|
|
||||||
|
|
||||||
def fill_msg_treeview(self):
|
def fill_msg_treeview(self):
|
||||||
i = 0
|
|
||||||
self.xml.get_widget('delete_msg_button').set_sensitive(False)
|
self.xml.get_widget('delete_msg_button').set_sensitive(False)
|
||||||
model = self.msg_tree.get_model()
|
model = self.msg_tree.get_model()
|
||||||
model.clear()
|
model.clear()
|
||||||
#FIXME:
|
for msg in gajim.config.get_per('statusmsg'):
|
||||||
while gajim.config.exist('msg%s_name' % i):
|
|
||||||
iter = model.append()
|
iter = model.append()
|
||||||
model.set(iter, 0, gajim.config.get('msg%s_name' % i), 1, \
|
model.set(iter, 0, msg, 1, gajim.config.get_per('statusmsg', msg, \
|
||||||
gajim.config.get('msg%s' % i))
|
'message'))
|
||||||
i += 1
|
|
||||||
|
|
||||||
def on_msg_cell_edited(self, cell, row, new_text):
|
def on_msg_cell_edited(self, cell, row, new_text):
|
||||||
model = self.msg_tree.get_model()
|
model = self.msg_tree.get_model()
|
||||||
|
|
Loading…
Reference in New Issue