Commit aa861b90 authored by Yann Leboulanger's avatar Yann Leboulanger

configuration is now in common/config

currently gajim cannot be accessed from every where, even with global gajim :(
parent aaf349f1
......@@ -33,7 +33,7 @@ APP = i18n.APP
gtk.glade.bindtextdomain(APP, i18n.DIR)
gtk.glade.textdomain(APP)
GTKGUI_GLADE='plugins/gtkgui/gtkgui.glade'
GTKGUI_GLADE='gtkgui.glade'
class Chat:
"""Class for chat/groupchat windows"""
......@@ -58,15 +58,15 @@ class Chat:
def update_tags(self):
for jid in self.tagIn:
self.tagIn[jid].set_property("foreground", \
self.plugin.config['inmsgcolor'])
self.tagOut[jid].set_property("foreground", \
self.plugin.config['outmsgcolor'])
self.tagStatus[jid].set_property("foreground", \
self.plugin.config['statusmsgcolor'])
self.tagIn[jid].set_property('foreground', \
gajim.config.get('inmsgcolor'))
self.tagOut[jid].set_property('foreground', \
gajim.config.get('outmsgcolor'))
self.tagStatus[jid].set_property('foreground', \
gajim.config.get('statusmsgcolor'))
def update_print_time(self):
if self.plugin.config['print_time'] != 'sometimes':
if gajim.config.get('print_time') != 'sometimes':
list_jid = self.print_time_timeout_id.keys()
for jid in list_jid:
gobject.source_remove(self.print_time_timeout_id[jid])
......@@ -85,9 +85,9 @@ class Chat:
unread += self.nb_unread[jid]
start = ""
if unread > 1:
start = "[" + str(unread) + "] "
start = '[' + str(unread) + '] '
elif unread == 1:
start = "* "
start = '* '
chat = self.names[jid]
if len(self.xmls) > 1: # if more than one tabs in the same window
if self.widget_name == 'tabbed_chat_window':
......@@ -105,9 +105,9 @@ class Chat:
"""redraw the label of the tab"""
start = ''
if self.nb_unread[jid] > 1:
start = "[" + str(self.nb_unread[jid]) + "] "
start = '[' + str(self.nb_unread[jid]) + '] '
elif self.nb_unread[jid] == 1:
start = "* "
start = '* '
child = self.childs[jid]
tab_label = self.notebook.get_tab_label(child).get_children()[0]
tab_label.set_text(start + self.names[jid])
......@@ -134,8 +134,7 @@ class Chat:
return active_jid
def on_close_button_clicked(self, button, jid):
"""When close button is pressed :
close a tab"""
"""When close button is pressed : close a tab"""
self.remove_tab(jid)
def on_chat_window_focus_in_event(self, widget, event):
......@@ -219,13 +218,13 @@ class Chat:
conversation_buffer.create_mark('end', end_iter, False)
self.tagIn[jid] = conversation_buffer.create_tag('incoming')
color = self.plugin.config['inmsgcolor']
color = gajim.config.get('inmsgcolor')
self.tagIn[jid].set_property('foreground', color)
self.tagOut[jid] = conversation_buffer.create_tag('outgoing')
color = self.plugin.config['outmsgcolor']
color = gajim.config.get('outmsgcolor')
self.tagOut[jid].set_property('foreground', color)
self.tagStatus[jid] = conversation_buffer.create_tag('status')
color = self.plugin.config['statusmsgcolor']
color = gajim.config.get('statusmsgcolor')
self.tagStatus[jid].set_property('foreground', color)
tag = conversation_buffer.create_tag('time_sometimes')
......@@ -405,7 +404,7 @@ class Chat:
def print_time_timeout(self, jid):
if not jid in self.xmls.keys():
return 0
if self.plugin.config['print_time'] == 'sometimes':
if gajim.config.get('print_time') == 'sometimes':
conversation_textview = self.xmls[jid].\
get_widget('conversation_textview')
conversation_buffer = conversation_textview.get_buffer()
......@@ -487,7 +486,7 @@ class Chat:
index = 0
# basic: links + mail + formatting is always checked (we like that)
if self.plugin.config['useemoticons']: # search for emoticons & urls
if gajim.config.get('useemoticons'): # search for emoticons & urls
iterator = self.plugin.emot_and_basic_re.finditer(otext)
else: # search for just urls + mail + formatting
iterator = self.plugin.basic_pattern_re.finditer(otext)
......@@ -593,11 +592,11 @@ class Chat:
text = ''
if conversation_buffer.get_char_count() > 0:
conversation_buffer.insert(end_iter, '\n')
if self.plugin.config['print_time'] == 'always':
if gajim.config.get('print_time') == 'always':
if not tim:
tim = time.localtime()
self.before_time_symbols = self.plugin.config['before_time']
self.after_time_symbols = self.plugin.config['after_time']
self.before_time_symbols = gajim.config.get('before_time')
self.after_time_symbols = gajim.config.get('after_time')
format = self.before_time_symbols + '%H:%M:%S' + self.after_time_symbols
tim_format = time.strftime(format, tim)
conversation_buffer.insert(end_iter, tim_format + ' ')
......@@ -614,8 +613,8 @@ class Chat:
tags = other_tags_for_name[:] #create a new list
tags.append(kind)
if name and not print_all_special:
self.before_nickname_symbols = self.plugin.config['before_nickname']
self.after_nickname_symbols = self.plugin.config['after_nickname']
self.before_nickname_symbols = gajim.config.get('before_nickname')
self.after_nickname_symbols = gajim.config.get('after_nickname')
format = self.before_nickname_symbols + name\
+ self.after_nickname_symbols + ' '
self.print_with_tag_list(conversation_buffer, format, end_iter, tags)
......
## Core/connection.py
## common/connection.py
##
## Gajim Team:
## - Yann Le Boulanger <asterix@lagaule.org>
......@@ -86,13 +86,12 @@ class connection:
def __init__(self, name = None):
# dict of function to be calledfor each event
self.handlers = {'ROSTER': [], 'WARNING': [], 'ERROR': [], 'STATUS': [], \
'NOTIFY': [], 'MSG': [], 'MSGERROR': [], 'SUBSCRIBED': [], \
'UNSUBSCRIBED': [], 'SUBSCRIBE': [], 'AGENTS': [], 'AGENT_INFO': [], \
'AGENT_INFO_ITEMS': [], 'AGENT_INFO_INFO': [], 'REG_AGENT_INFO': [], \
'QUIT': [], 'ACC_OK': [], 'CONFIG': [], 'MYVCARD': [], 'OS_INFO': [], \
'VCARD': [], 'LOG_NB_LINE': [], 'LOG_LINE': [], 'VISUAL': [], \
'NOTIFY': [], 'MSG': [], 'MSGERROR': [], 'MSGSENT': [] , \
'SUBSCRIBED': [], 'UNSUBSCRIBED': [], 'SUBSCRIBE': [], \
'AGENT_INFO': [], 'AGENT_INFO_ITEMS': [], 'AGENT_INFO_INFO': [], \
'QUIT': [], 'ACC_OK': [], 'MYVCARD': [], 'OS_INFO': [], 'VCARD': [], \
'GC_MSG': [], 'GC_SUBJECT': [], 'BAD_PASSPHRASE': [], \
'GPG_SECRETE_KEYS': [], 'ROSTER_INFO': [], 'MSGSENT': []}
'ROSTER_INFO': []}
self.name = name
self.connected = 0 # offline
self.connection = None # Jabber.py instance
......
......@@ -31,7 +31,7 @@ gtk.glade.textdomain (APP)
from dialogs import *
import gtkgui
GTKGUI_GLADE='plugins/gtkgui/gtkgui.glade'
GTKGUI_GLADE='gtkgui.glade'
class Preferences_window:
......@@ -1213,9 +1213,13 @@ class Account_modification_window:
self.plugin.send('ASK_VCARD', self.account, jid)
def on_gpg_choose_button_clicked(self, widget, data=None):
w = choose_gpg_key_dialog()
self.plugin.windows['gpg_keys'] = w
self.plugin.send('GPG_SECRETE_KEYS', None, ())
#FIXME:
secret_keys = connection.ask_gpg_secrete_keys()
if not secret_keys:
Error_dialog(_('error contacting %s') % service)
return
secret_keys['None'] = 'None'
w = choose_gpg_key_dialog(secret_keys)
keyID = w.run()
if keyID == -1:
return
......@@ -1796,7 +1800,12 @@ class Service_discovery_window:
if not iter :
return
service = model.get_value(iter, 1)
self.plugin.send('REG_AGENT_INFO', self.account, service)
#FIXME:
infos = connection.ask_register_agent_info(service)
if not infos.has_key('instructions'):
Error_dialog(_('error contacting %s') % service)
else:
Service_registration_window(service, infos, self.plugin, self.account)
self.window.destroy()
def on_services_treeview_cursor_changed(self, widget):
......
......@@ -27,9 +27,8 @@ gtk.glade.bindtextdomain (APP, i18n.DIR)
gtk.glade.textdomain (APP)
import gtkgui
import version
GTKGUI_GLADE='plugins/gtkgui/gtkgui.glade'
GTKGUI_GLADE='gtkgui.glade'
class Vcard_information_window:
"""Class for user's information window"""
......@@ -363,7 +362,7 @@ class choose_gpg_key_dialog:
for keyID in list.keys():
model.append((keyID, list[keyID]))
def __init__(self):
def __init__(self, secret_keys):
#list : {keyID: userName, ...}
xml = gtk.glade.XML(GTKGUI_GLADE, 'choose_gpg_key_dialog', APP)
self.window = xml.get_widget('choose_gpg_key_dialog')
......@@ -377,6 +376,7 @@ class choose_gpg_key_dialog:
renderer = gtk.CellRendererText()
self.keys_treeview.insert_column_with_attributes(-1, _('User name'), \
renderer, text=1)
self.fill_tree(secret_keys)
self.window.show_all()
......@@ -389,12 +389,12 @@ class Change_status_message_dialog:
self.autoconnect = autoconnect
message_textview = self.xml.get_widget('message_textview')
self.message_buffer = message_textview.get_buffer()
self.message_buffer.set_text(self.plugin.config['last_msg'])
self.message_buffer.set_text(gajim.config.get('last_msg'))
self.values = {'':''}
i = 0
while self.plugin.config.has_key('msg%s_name' % i):
self.values[self.plugin.config['msg%s_name' % i]] = \
self.plugin.config['msg%s' % i]
while gajim.config.exist('msg%s_name' % i):
self.values[gajim.config.get('msg%s_name' % i)] = \
gajim.config.get('msg%s' % i)
i += 1
liststore = gtk.ListStore(str, str)
message_comboboxentry = self.xml.get_widget('message_comboboxentry')
......@@ -413,7 +413,7 @@ class Change_status_message_dialog:
if rep == gtk.RESPONSE_OK:
beg, end = self.message_buffer.get_bounds()
message = self.message_buffer.get_text(beg, end, 0)
self.plugin.config['last_msg'] = message
gajim.config.set('last_msg', message)
else:
message = -1
self.window.destroy()
......@@ -565,7 +565,7 @@ class About_dialog:
dlg = gtk.AboutDialog()
dlg.set_name('Gajim')
dlg.set_version(version.version)
dlg.set_version(gajim.version.version)
s = u'Copyright \xa9 2003-2005 Gajim Team'
dlg.set_copyright(s)
text = open('COPYING').read()
......@@ -683,7 +683,7 @@ class Join_groupchat_window:
cell = gtk.CellRendererText()
self.recently_combobox.pack_start(cell, True)
self.recently_combobox.add_attribute(cell, 'text', 0)
self.recently_groupchat = self.plugin.config['recently_groupchat'].split()
self.recently_groupchat = gajim.config.get('recently_groupchat').split()
for g in self.recently_groupchat:
self.recently_combobox.append_text(g)
......@@ -720,8 +720,7 @@ class Join_groupchat_window:
self.recently_groupchat.insert(0, jid)
if len(self.recently_groupchat) > 10:
self.recently_groupchat = self.recently_groupchat[0:10]
self.plugin.config['recently_groupchat'] = \
' '.join(self.recently_groupchat)
gajim.config.set('recently_groupchat', ' '.join(self.recently_groupchat))
self.plugin.roster.new_group(jid, nickname, self.account)
self.plugin.send('GC_JOIN', self.account, (nickname, room, server, \
password))
......
......@@ -34,7 +34,7 @@ APP = i18n.APP
gtk.glade.bindtextdomain(APP, i18n.DIR)
gtk.glade.textdomain(APP)
GTKGUI_GLADE='plugins/gtkgui/gtkgui.glade'
GTKGUI_GLADE='gtkgui.glade'
class Groupchat_window(Chat):
"""Class for Groupchat window"""
......
This diff is collapsed.
......@@ -28,7 +28,7 @@ APP = i18n.APP
gtk.glade.bindtextdomain(APP, i18n.DIR)
gtk.glade.textdomain(APP)
GTKGUI_GLADE='plugins/gtkgui/gtkgui.glade'
GTKGUI_GLADE='gtkgui.glade'
class history_window:
"""Class for bowser agent window:
......@@ -148,13 +148,13 @@ class history_window:
self.latest_button = xml.get_widget('latest_button')
xml.signal_autoconnect(self)
tagIn = self.history_buffer.create_tag('incoming')
color = self.plugin.config['inmsgcolor']
color = gajim.config.get('inmsgcolor')
tagIn.set_property('foreground', color)
tagOut = self.history_buffer.create_tag('outgoing')
color = self.plugin.config['outmsgcolor']
color = gajim.config.get('outmsgcolor')
tagOut.set_property('foreground', color)
tagStatus = self.history_buffer.create_tag('status')
color = self.plugin.config['statusmsgcolor']
color = gajim.config.get('statusmsgcolor')
tagStatus.set_property('foreground', color)
self.window.show_all()
self.plugin.send('LOG_NB_LINE', None, jid)
This diff is collapsed.
......@@ -28,7 +28,7 @@ APP = i18n.APP
gtk.glade.bindtextdomain(APP, i18n.DIR)
gtk.glade.textdomain(APP)
GTKGUI_GLADE='plugins/gtkgui/gtkgui.glade'
GTKGUI_GLADE='gtkgui.glade'
class Systray:
"""Class for icon in the systray"""
......
......@@ -34,7 +34,7 @@ APP = i18n.APP
gtk.glade.bindtextdomain(APP, i18n.DIR)
gtk.glade.textdomain(APP)
GTKGUI_GLADE='plugins/gtkgui/gtkgui.glade'
GTKGUI_GLADE='gtkgui.glade'
class Tabbed_chat_window(Chat):
"""Class for tabbed chat window"""
......@@ -144,7 +144,7 @@ class Tabbed_chat_window(Chat):
if self.plugin.queues[self.account].has_key(user.jid):
self.read_queue(user.jid)
if self.plugin.config['print_time'] == 'sometimes':
if gajim.config.get('print_time') == 'sometimes':
self.print_time_timeout(user.jid)
self.print_time_timeout_id[user.jid] = gobject.timeout_add(300000, \
self.print_time_timeout, user.jid)
......@@ -211,7 +211,7 @@ class Tabbed_chat_window(Chat):
self.plugin.roster.redraw_jid(jid, self.account)
if self.plugin.systray_enabled:
self.plugin.systray.remove_jid(jid, self.account)
showOffline = self.plugin.config['showoffline']
showOffline = gajim.config.get('showoffline')
if (user.show == 'offline' or user.show == 'error') and \
not showOffline:
if len(self.plugin.roster.contacts[self.account][jid]) == 1:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment