remove trailing whitespaces and fix coding styles etc and add a FIXME
This commit is contained in:
parent
5868901824
commit
eb94b9632a
|
@ -85,7 +85,7 @@ awaiting_events = {} # list of messages/FT reveived but not printed
|
||||||
# if type in ('chat', 'normal'): data = (message, subject, kind, time,
|
# if type in ('chat', 'normal'): data = (message, subject, kind, time,
|
||||||
# encrypted, resource)
|
# encrypted, resource)
|
||||||
# kind can be (incoming, error)
|
# kind can be (incoming, error)
|
||||||
# if type in file-request, file-request-error, file-send-error, file-error,
|
# if type in file-request, file-request-error, file-send-error, file-error,
|
||||||
# file-completed, file-stopped:
|
# file-completed, file-stopped:
|
||||||
# data = file_props
|
# data = file_props
|
||||||
nicks = {} # list of our nick names in each account
|
nicks = {} # list of our nick names in each account
|
||||||
|
@ -118,7 +118,7 @@ def get_nick_from_fjid(jid):
|
||||||
# fake jid is the jid for a contact in a room
|
# fake jid is the jid for a contact in a room
|
||||||
# gaim@conference.jabber.no/nick/nick-continued
|
# gaim@conference.jabber.no/nick/nick-continued
|
||||||
return jid.split('/', 1)[1]
|
return jid.split('/', 1)[1]
|
||||||
|
|
||||||
def get_room_name_and_server_from_room_jid(jid):
|
def get_room_name_and_server_from_room_jid(jid):
|
||||||
room_name = get_nick_from_jid(jid)
|
room_name = get_nick_from_jid(jid)
|
||||||
server = get_server_from_jid(jid)
|
server = get_server_from_jid(jid)
|
||||||
|
@ -169,7 +169,7 @@ def get_first_contact_instance_from_jid(account, jid):
|
||||||
get_room_and_nick_from_fjid(jid) # if we ban/kick we now real jid
|
get_room_and_nick_from_fjid(jid) # if we ban/kick we now real jid
|
||||||
if gc_contacts[account].has_key(room) and \
|
if gc_contacts[account].has_key(room) and \
|
||||||
nick in gc_contacts[account][room]:
|
nick in gc_contacts[account][room]:
|
||||||
contact = gc_contacts[account][room][nick]
|
contact = gc_contacts[account][room][nick]
|
||||||
return contact
|
return contact
|
||||||
|
|
||||||
def get_contact_instance_with_highest_priority(account, jid):
|
def get_contact_instance_with_highest_priority(account, jid):
|
||||||
|
@ -178,7 +178,7 @@ def get_contact_instance_with_highest_priority(account, jid):
|
||||||
|
|
||||||
def get_contact_name_from_jid(account, jid):
|
def get_contact_name_from_jid(account, jid):
|
||||||
return contacts[account][jid][0].name
|
return contacts[account][jid][0].name
|
||||||
|
|
||||||
def get_highest_prio_contact_from_contacts(contacts):
|
def get_highest_prio_contact_from_contacts(contacts):
|
||||||
prim_contact = None # primary contact
|
prim_contact = None # primary contact
|
||||||
for contact in contacts:
|
for contact in contacts:
|
||||||
|
@ -197,7 +197,7 @@ def construct_fjid(room_jid, nick):
|
||||||
if isinstance(nick, str):
|
if isinstance(nick, str):
|
||||||
nick = unicode(nick, 'utf-8')
|
nick = unicode(nick, 'utf-8')
|
||||||
return room_jid + '/' + nick
|
return room_jid + '/' + nick
|
||||||
|
|
||||||
def get_resource_from_jid(jid):
|
def get_resource_from_jid(jid):
|
||||||
jids = jid.split('/', 1)
|
jids = jid.split('/', 1)
|
||||||
if len(jids) > 1:
|
if len(jids) > 1:
|
||||||
|
@ -255,7 +255,7 @@ def jid_is_transport(jid):
|
||||||
sms = jid.startswith('sms.')
|
sms = jid.startswith('sms.')
|
||||||
tlen = jid.startswith('tlen.')
|
tlen = jid.startswith('tlen.')
|
||||||
yahoo = jid.startswith('yahoo.')
|
yahoo = jid.startswith('yahoo.')
|
||||||
|
|
||||||
if aim or gg or irc or icq or msn or sms or yahoo or tlen:
|
if aim or gg or irc or icq or msn or sms or yahoo or tlen:
|
||||||
is_transport = True
|
is_transport = True
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -369,7 +369,8 @@ class PreferencesWindow:
|
||||||
self.applications_frame.set_no_show_all(True)
|
self.applications_frame.set_no_show_all(True)
|
||||||
self.applications_frame.hide()
|
self.applications_frame.hide()
|
||||||
else:
|
else:
|
||||||
self.applications_combobox = self.xml.get_widget('applications_combobox')
|
self.applications_combobox = self.xml.get_widget(
|
||||||
|
'applications_combobox')
|
||||||
if gajim.config.get('autodetect_browser_mailer'):
|
if gajim.config.get('autodetect_browser_mailer'):
|
||||||
self.applications_combobox.set_active(0)
|
self.applications_combobox.set_active(0)
|
||||||
gtkgui_helpers.autodetect_browser_mailer()
|
gtkgui_helpers.autodetect_browser_mailer()
|
||||||
|
@ -527,7 +528,7 @@ class PreferencesWindow:
|
||||||
|
|
||||||
def merge_windows(self, kind):
|
def merge_windows(self, kind):
|
||||||
for acct in gajim.connections:
|
for acct in gajim.connections:
|
||||||
#save buffers and close windows
|
# save buffers and close windows
|
||||||
buf1 = {}
|
buf1 = {}
|
||||||
buf2 = {}
|
buf2 = {}
|
||||||
saved_var = {}
|
saved_var = {}
|
||||||
|
@ -539,7 +540,7 @@ class PreferencesWindow:
|
||||||
buf2[jid] = window.message_textviews[jid].get_buffer()
|
buf2[jid] = window.message_textviews[jid].get_buffer()
|
||||||
saved_var[jid] = window.save_var(jid)
|
saved_var[jid] = window.save_var(jid)
|
||||||
window.window.destroy()
|
window.window.destroy()
|
||||||
#open new tabbed chat windows
|
# open new tabbed chat windows
|
||||||
for jid in jids:
|
for jid in jids:
|
||||||
if kind == 'chats':
|
if kind == 'chats':
|
||||||
c = gajim.get_contact_instance_with_highest_priority(acct, jid)
|
c = gajim.get_contact_instance_with_highest_priority(acct, jid)
|
||||||
|
@ -553,7 +554,7 @@ class PreferencesWindow:
|
||||||
|
|
||||||
def split_windows(self, kind):
|
def split_windows(self, kind):
|
||||||
for acct in gajim.connections:
|
for acct in gajim.connections:
|
||||||
#save buffers and close tabbed chat windows
|
# save buffers and close tabbed chat windows
|
||||||
buf1 = {}
|
buf1 = {}
|
||||||
buf2 = {}
|
buf2 = {}
|
||||||
saved_var = {}
|
saved_var = {}
|
||||||
|
@ -568,7 +569,7 @@ class PreferencesWindow:
|
||||||
buf2[jid] = window.message_textviews[jid].get_buffer()
|
buf2[jid] = window.message_textviews[jid].get_buffer()
|
||||||
saved_var[jid] = window.save_var(jid)
|
saved_var[jid] = window.save_var(jid)
|
||||||
windows['tabbed'].window.destroy()
|
windows['tabbed'].window.destroy()
|
||||||
#open new tabbed chat windows
|
# open new tabbed chat windows
|
||||||
for jid in jids:
|
for jid in jids:
|
||||||
if kind == 'chats':
|
if kind == 'chats':
|
||||||
c = gajim.get_contact_instance_with_highest_priority(acct, jid)
|
c = gajim.get_contact_instance_with_highest_priority(acct, jid)
|
||||||
|
|
137
src/disco.py
137
src/disco.py
|
@ -73,11 +73,11 @@ def _gen_agent_type_info():
|
||||||
return {
|
return {
|
||||||
# Defaults
|
# Defaults
|
||||||
(0, 0): (None, None),
|
(0, 0): (None, None),
|
||||||
|
|
||||||
# Jabber server
|
# Jabber server
|
||||||
('server', 'im'): (ToplevelAgentBrowser, 'jabber.png'),
|
('server', 'im'): (ToplevelAgentBrowser, 'jabber.png'),
|
||||||
('services', 'jabber'): (ToplevelAgentBrowser, 'jabber.png'),
|
('services', 'jabber'): (ToplevelAgentBrowser, 'jabber.png'),
|
||||||
|
|
||||||
# Services
|
# Services
|
||||||
('conference', 'text'): (MucBrowser, 'conference.png'),
|
('conference', 'text'): (MucBrowser, 'conference.png'),
|
||||||
('headline', 'rss'): (AgentBrowser, 'rss.png'),
|
('headline', 'rss'): (AgentBrowser, 'rss.png'),
|
||||||
|
@ -88,7 +88,7 @@ def _gen_agent_type_info():
|
||||||
('directory', 'user'): (None, 'jud.png'),
|
('directory', 'user'): (None, 'jud.png'),
|
||||||
('pubsub', 'generic'): (None, 'pubsub.png'),
|
('pubsub', 'generic'): (None, 'pubsub.png'),
|
||||||
('proxy', 'bytestreams'): (None, 'bytestreams.png'), # Socks5 FT proxy
|
('proxy', 'bytestreams'): (None, 'bytestreams.png'), # Socks5 FT proxy
|
||||||
|
|
||||||
# Transports
|
# Transports
|
||||||
('conference', 'irc'): (False, 'irc.png'),
|
('conference', 'irc'): (False, 'irc.png'),
|
||||||
('_jid', 'irc'): (False, 'irc.png'),
|
('_jid', 'irc'): (False, 'irc.png'),
|
||||||
|
@ -185,7 +185,7 @@ class Closure(object):
|
||||||
Weak references to methods immediatly die, even if the object is still
|
Weak references to methods immediatly die, even if the object is still
|
||||||
alive. Besides a handy way to store a callback, this provides a workaround
|
alive. Besides a handy way to store a callback, this provides a workaround
|
||||||
that keeps a reference to the object instead.
|
that keeps a reference to the object instead.
|
||||||
|
|
||||||
Userargs and removeargs must be tuples.'''
|
Userargs and removeargs must be tuples.'''
|
||||||
def __init__(self, cb, userargs = (), remove = None, removeargs = ()):
|
def __init__(self, cb, userargs = (), remove = None, removeargs = ()):
|
||||||
self.userargs = userargs
|
self.userargs = userargs
|
||||||
|
@ -235,7 +235,7 @@ class ServicesCache:
|
||||||
# Clean an empty list
|
# Clean an empty list
|
||||||
if not self._cbs[cbkey]:
|
if not self._cbs[cbkey]:
|
||||||
del self._cbs[cbkey]
|
del self._cbs[cbkey]
|
||||||
|
|
||||||
def get_icon(self, identities = []):
|
def get_icon(self, identities = []):
|
||||||
'''Return the icon for an agent.'''
|
'''Return the icon for an agent.'''
|
||||||
# Grab the first identity with an icon
|
# Grab the first identity with an icon
|
||||||
|
@ -264,7 +264,7 @@ class ServicesCache:
|
||||||
# Store in cache
|
# Store in cache
|
||||||
_icon_cache[filename] = pix
|
_icon_cache[filename] = pix
|
||||||
return pix
|
return pix
|
||||||
|
|
||||||
def get_browser(self, identities = [], features = []):
|
def get_browser(self, identities = [], features = []):
|
||||||
'''Return the browser class for an agent.'''
|
'''Return the browser class for an agent.'''
|
||||||
# Grab the first identity with a browser
|
# Grab the first identity with a browser
|
||||||
|
@ -365,7 +365,7 @@ class ServicesCache:
|
||||||
# clean_closure may have beaten us to it
|
# clean_closure may have beaten us to it
|
||||||
if self._cbs.has_key(cbkey):
|
if self._cbs.has_key(cbkey):
|
||||||
del self._cbs[cbkey]
|
del self._cbs[cbkey]
|
||||||
|
|
||||||
def agent_info_error(self, jid):
|
def agent_info_error(self, jid):
|
||||||
'''Callback for when a query fails. (even after the browse and agents
|
'''Callback for when a query fails. (even after the browse and agents
|
||||||
namespaces)'''
|
namespaces)'''
|
||||||
|
@ -379,7 +379,7 @@ class ServicesCache:
|
||||||
# clean_closure may have beaten us to it
|
# clean_closure may have beaten us to it
|
||||||
if self._cbs.has_key(cbkey):
|
if self._cbs.has_key(cbkey):
|
||||||
del self._cbs[cbkey]
|
del self._cbs[cbkey]
|
||||||
|
|
||||||
def agent_items_error(self, jid):
|
def agent_items_error(self, jid):
|
||||||
'''Callback for when a query fails. (even after the browse and agents
|
'''Callback for when a query fails. (even after the browse and agents
|
||||||
namespaces)'''
|
namespaces)'''
|
||||||
|
@ -404,12 +404,12 @@ class ServiceDiscoveryWindow:
|
||||||
if not jid:
|
if not jid:
|
||||||
jid = gajim.config.get_per('accounts', account, 'hostname')
|
jid = gajim.config.get_per('accounts', account, 'hostname')
|
||||||
node = ''
|
node = ''
|
||||||
|
|
||||||
self.jid = None
|
self.jid = None
|
||||||
self.browser = None
|
self.browser = None
|
||||||
self.children = []
|
self.children = []
|
||||||
self.dying = False
|
self.dying = False
|
||||||
|
|
||||||
# Check connection
|
# Check connection
|
||||||
if gajim.connections[account].connected < 2:
|
if gajim.connections[account].connected < 2:
|
||||||
dialogs.ErrorDialog(_('You are not connected to the server'),
|
dialogs.ErrorDialog(_('You are not connected to the server'),
|
||||||
|
@ -428,7 +428,8 @@ _('Without a connection, you can not browse available services')).get_response()
|
||||||
self.services_treeview = self.xml.get_widget('services_treeview')
|
self.services_treeview = self.xml.get_widget('services_treeview')
|
||||||
# This is more reliable than the cursor-changed signal.
|
# This is more reliable than the cursor-changed signal.
|
||||||
selection = self.services_treeview.get_selection()
|
selection = self.services_treeview.get_selection()
|
||||||
selection.connect_after('changed', self.on_services_treeview_selection_changed)
|
selection.connect_after('changed',
|
||||||
|
self.on_services_treeview_selection_changed)
|
||||||
self.services_scrollwin = self.xml.get_widget('services_scrollwin')
|
self.services_scrollwin = self.xml.get_widget('services_scrollwin')
|
||||||
self.progressbar = self.xml.get_widget('services_progressbar')
|
self.progressbar = self.xml.get_widget('services_progressbar')
|
||||||
self.progressbar.set_no_show_all(True)
|
self.progressbar.set_no_show_all(True)
|
||||||
|
@ -446,14 +447,16 @@ _('Without a connection, you can not browse available services')).get_response()
|
||||||
self.address_comboboxentry = None
|
self.address_comboboxentry = None
|
||||||
address_hbox = self.xml.get_widget('address_hbox')
|
address_hbox = self.xml.get_widget('address_hbox')
|
||||||
if address_entry:
|
if address_entry:
|
||||||
self.address_comboboxentry = self.xml.get_widget('address_comboboxentry')
|
self.address_comboboxentry = self.xml.get_widget(
|
||||||
|
'address_comboboxentry')
|
||||||
self.address_comboboxentry_entry = self.address_comboboxentry.child
|
self.address_comboboxentry_entry = self.address_comboboxentry.child
|
||||||
self.address_comboboxentry_entry.set_activates_default(True)
|
self.address_comboboxentry_entry.set_activates_default(True)
|
||||||
|
|
||||||
liststore = gtk.ListStore(str)
|
liststore = gtk.ListStore(str)
|
||||||
self.address_comboboxentry.set_model(liststore)
|
self.address_comboboxentry.set_model(liststore)
|
||||||
self.address_comboboxentry.set_text_column(0)
|
self.address_comboboxentry.set_text_column(0)
|
||||||
self.latest_addresses = gajim.config.get('latest_disco_addresses').split()
|
self.latest_addresses = gajim.config.get(
|
||||||
|
'latest_disco_addresses').split()
|
||||||
jid = gajim.get_hostname_from_account(self.account, use_srv = True)
|
jid = gajim.get_hostname_from_account(self.account, use_srv = True)
|
||||||
if jid in self.latest_addresses:
|
if jid in self.latest_addresses:
|
||||||
self.latest_addresses.remove(jid)
|
self.latest_addresses.remove(jid)
|
||||||
|
@ -472,17 +475,17 @@ _('Without a connection, you can not browse available services')).get_response()
|
||||||
self.xml.signal_autoconnect(self)
|
self.xml.signal_autoconnect(self)
|
||||||
self.travel(jid, node)
|
self.travel(jid, node)
|
||||||
self.window.show_all()
|
self.window.show_all()
|
||||||
|
|
||||||
def _get_account(self):
|
def _get_account(self):
|
||||||
return self._account
|
return self._account
|
||||||
|
|
||||||
def _set_account(self, value):
|
def _set_account(self, value):
|
||||||
self._account = value
|
self._account = value
|
||||||
self.cache.account = value
|
self.cache.account = value
|
||||||
if self.browser:
|
if self.browser:
|
||||||
self.browser.account = value
|
self.browser.account = value
|
||||||
account = property(_get_account, _set_account)
|
account = property(_get_account, _set_account)
|
||||||
|
|
||||||
def _initial_state(self):
|
def _initial_state(self):
|
||||||
'''Set some initial state on the window. Separated in a method because
|
'''Set some initial state on the window. Separated in a method because
|
||||||
it's handy to use within browser's cleanup method.'''
|
it's handy to use within browser's cleanup method.'''
|
||||||
|
@ -541,7 +544,7 @@ _('Without a connection, you can not browse available services')).get_response()
|
||||||
if chain and not self.parent.children:
|
if chain and not self.parent.children:
|
||||||
self.parent.destroy(chain = chain)
|
self.parent.destroy(chain = chain)
|
||||||
self.parent = None
|
self.parent = None
|
||||||
|
|
||||||
def travel(self, jid, node):
|
def travel(self, jid, node):
|
||||||
'''Travel to an agent within the current services window.'''
|
'''Travel to an agent within the current services window.'''
|
||||||
if self.browser:
|
if self.browser:
|
||||||
|
@ -558,7 +561,7 @@ _('Without a connection, you can not browse available services')).get_response()
|
||||||
self.jid = jid
|
self.jid = jid
|
||||||
self.node = node
|
self.node = node
|
||||||
self.cache.get_info(jid, node, self._travel)
|
self.cache.get_info(jid, node, self._travel)
|
||||||
|
|
||||||
def _travel(self, jid, node, identities, features, data):
|
def _travel(self, jid, node, identities, features, data):
|
||||||
'''Continuation of travel.'''
|
'''Continuation of travel.'''
|
||||||
if self.dying or jid != self.jid or node != self.node:
|
if self.dying or jid != self.jid or node != self.node:
|
||||||
|
@ -580,7 +583,7 @@ _('This type of service does not contain any items to browse.')).get_response()
|
||||||
self.browser = klass(self.account, jid, node)
|
self.browser = klass(self.account, jid, node)
|
||||||
self.browser.prepare_window(self)
|
self.browser.prepare_window(self)
|
||||||
self.browser.browse()
|
self.browser.browse()
|
||||||
|
|
||||||
def open(self, jid, node):
|
def open(self, jid, node):
|
||||||
'''Open an agent. By default, this happens in a new window.'''
|
'''Open an agent. By default, this happens in a new window.'''
|
||||||
try:
|
try:
|
||||||
|
@ -608,7 +611,7 @@ _('This type of service does not contain any items to browse.')).get_response()
|
||||||
# user selected one of the entries so do auto-visit
|
# user selected one of the entries so do auto-visit
|
||||||
jid = self.address_comboboxentry.child.get_text().decode('utf-8')
|
jid = self.address_comboboxentry.child.get_text().decode('utf-8')
|
||||||
self.travel(jid, '')
|
self.travel(jid, '')
|
||||||
|
|
||||||
def on_go_button_clicked(self, widget):
|
def on_go_button_clicked(self, widget):
|
||||||
jid = self.address_comboboxentry.child.get_text().decode('utf-8')
|
jid = self.address_comboboxentry.child.get_text().decode('utf-8')
|
||||||
if jid in self.latest_addresses:
|
if jid in self.latest_addresses:
|
||||||
|
@ -626,7 +629,7 @@ _('This type of service does not contain any items to browse.')).get_response()
|
||||||
|
|
||||||
def on_services_treeview_row_activated(self, widget, path, col = 0):
|
def on_services_treeview_row_activated(self, widget, path, col = 0):
|
||||||
self.browser.default_action()
|
self.browser.default_action()
|
||||||
|
|
||||||
def on_services_treeview_selection_changed(self, widget):
|
def on_services_treeview_selection_changed(self, widget):
|
||||||
self.browser.update_actions()
|
self.browser.update_actions()
|
||||||
|
|
||||||
|
@ -679,13 +682,13 @@ class AgentBrowser:
|
||||||
self.window.services_treeview.insert_column(col, -1)
|
self.window.services_treeview.insert_column(col, -1)
|
||||||
col.set_resizable(True)
|
col.set_resizable(True)
|
||||||
self.window.services_treeview.set_headers_visible(True)
|
self.window.services_treeview.set_headers_visible(True)
|
||||||
|
|
||||||
def _clean_treemodel(self):
|
def _clean_treemodel(self):
|
||||||
self.window.services_treeview.get_model().clear()
|
self.window.services_treeview.get_model().clear()
|
||||||
for col in self.window.services_treeview.get_columns():
|
for col in self.window.services_treeview.get_columns():
|
||||||
self.window.services_treeview.remove_column(col)
|
self.window.services_treeview.remove_column(col)
|
||||||
self.window.services_treeview.set_headers_visible(False)
|
self.window.services_treeview.set_headers_visible(False)
|
||||||
|
|
||||||
def _add_actions(self):
|
def _add_actions(self):
|
||||||
'''Add the action buttons to the buttonbox for actions the browser can
|
'''Add the action buttons to the buttonbox for actions the browser can
|
||||||
perform.'''
|
perform.'''
|
||||||
|
@ -706,7 +709,7 @@ class AgentBrowser:
|
||||||
if self.browse_button:
|
if self.browse_button:
|
||||||
self.browse_button.destroy()
|
self.browse_button.destroy()
|
||||||
self.browse_button = None
|
self.browse_button = None
|
||||||
|
|
||||||
def _set_title(self, jid, node, identities, features, data):
|
def _set_title(self, jid, node, identities, features, data):
|
||||||
'''Set the window title based on agent info.'''
|
'''Set the window title based on agent info.'''
|
||||||
# Set the banner and window title
|
# Set the banner and window title
|
||||||
|
@ -714,12 +717,12 @@ class AgentBrowser:
|
||||||
name = identities[0]['name']
|
name = identities[0]['name']
|
||||||
self.window.banner.set_markup('<span weight="heavy" size="large">'\
|
self.window.banner.set_markup('<span weight="heavy" size="large">'\
|
||||||
'%s</span>\n%s' % (self._get_agent_address(), name))
|
'%s</span>\n%s' % (self._get_agent_address(), name))
|
||||||
|
|
||||||
# Add an icon to the banner.
|
# Add an icon to the banner.
|
||||||
pix = self.cache.get_icon(identities)
|
pix = self.cache.get_icon(identities)
|
||||||
self.window.banner_icon.set_from_pixbuf(pix)
|
self.window.banner_icon.set_from_pixbuf(pix)
|
||||||
self.window.banner_icon.show()
|
self.window.banner_icon.show()
|
||||||
|
|
||||||
def _clean_title(self):
|
def _clean_title(self):
|
||||||
# Everything done here is done in window._initial_state
|
# Everything done here is done in window._initial_state
|
||||||
# This is for subclasses.
|
# This is for subclasses.
|
||||||
|
@ -730,37 +733,37 @@ class AgentBrowser:
|
||||||
up with a ServiceDiscoveryWindow instance.'''
|
up with a ServiceDiscoveryWindow instance.'''
|
||||||
self.window = window
|
self.window = window
|
||||||
self.cache = window.cache
|
self.cache = window.cache
|
||||||
|
|
||||||
self._set_initial_title()
|
self._set_initial_title()
|
||||||
self._create_treemodel()
|
self._create_treemodel()
|
||||||
self._add_actions()
|
self._add_actions()
|
||||||
|
|
||||||
# This is a hack. The buttonbox apparently doesn't care about pack_start
|
# This is a hack. The buttonbox apparently doesn't care about pack_start
|
||||||
# or pack_end, so we repack the close button here to make sure it's last
|
# or pack_end, so we repack the close button here to make sure it's last
|
||||||
close_button = self.window.xml.get_widget('close_button')
|
close_button = self.window.xml.get_widget('close_button')
|
||||||
self.window.action_buttonbox.remove(close_button)
|
self.window.action_buttonbox.remove(close_button)
|
||||||
self.window.action_buttonbox.pack_end(close_button)
|
self.window.action_buttonbox.pack_end(close_button)
|
||||||
close_button.show_all()
|
close_button.show_all()
|
||||||
|
|
||||||
self.update_actions()
|
self.update_actions()
|
||||||
|
|
||||||
self.active = True
|
self.active = True
|
||||||
self.cache.get_info(self.jid, self.node, self._set_title)
|
self.cache.get_info(self.jid, self.node, self._set_title)
|
||||||
|
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
'''Cleanup when the window intends to switch browsers.'''
|
'''Cleanup when the window intends to switch browsers.'''
|
||||||
self.active = False
|
self.active = False
|
||||||
|
|
||||||
self._clean_actions()
|
self._clean_actions()
|
||||||
self._clean_treemodel()
|
self._clean_treemodel()
|
||||||
self._clean_title()
|
self._clean_title()
|
||||||
|
|
||||||
self.window._initial_state()
|
self.window._initial_state()
|
||||||
|
|
||||||
def update_theme(self):
|
def update_theme(self):
|
||||||
'''Called when the default theme is changed.'''
|
'''Called when the default theme is changed.'''
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def on_browse_button_clicked(self, widget = None):
|
def on_browse_button_clicked(self, widget = None):
|
||||||
'''When we want to browse an agent:
|
'''When we want to browse an agent:
|
||||||
Open a new services window with a browser for the agent type.'''
|
Open a new services window with a browser for the agent type.'''
|
||||||
|
@ -784,7 +787,7 @@ class AgentBrowser:
|
||||||
node = model[iter][1].decode('utf-8')
|
node = model[iter][1].decode('utf-8')
|
||||||
if jid:
|
if jid:
|
||||||
self.cache.get_info(jid, node, self._update_actions, nofetch = True)
|
self.cache.get_info(jid, node, self._update_actions, nofetch = True)
|
||||||
|
|
||||||
def _update_actions(self, jid, node, identities, features, data):
|
def _update_actions(self, jid, node, identities, features, data):
|
||||||
'''Continuation of update_actions.'''
|
'''Continuation of update_actions.'''
|
||||||
if not identities or not self.browse_button:
|
if not identities or not self.browse_button:
|
||||||
|
@ -792,7 +795,7 @@ class AgentBrowser:
|
||||||
klass = self.cache.get_browser(identities, features)
|
klass = self.cache.get_browser(identities, features)
|
||||||
if klass:
|
if klass:
|
||||||
self.browse_button.set_sensitive(True)
|
self.browse_button.set_sensitive(True)
|
||||||
|
|
||||||
def default_action(self):
|
def default_action(self):
|
||||||
'''When we double-click a row:
|
'''When we double-click a row:
|
||||||
perform the default action on the selected item.'''
|
perform the default action on the selected item.'''
|
||||||
|
@ -803,7 +806,7 @@ class AgentBrowser:
|
||||||
node = model[iter][1].decode('utf-8')
|
node = model[iter][1].decode('utf-8')
|
||||||
if jid:
|
if jid:
|
||||||
self.cache.get_info(jid, node, self._default_action, nofetch = True)
|
self.cache.get_info(jid, node, self._default_action, nofetch = True)
|
||||||
|
|
||||||
def _default_action(self, jid, node, identities, features, data):
|
def _default_action(self, jid, node, identities, features, data):
|
||||||
'''Continuation of default_action.'''
|
'''Continuation of default_action.'''
|
||||||
if self.cache.get_browser(identities, features):
|
if self.cache.get_browser(identities, features):
|
||||||
|
@ -820,16 +823,16 @@ class AgentBrowser:
|
||||||
self.window.progressbar.pulse()
|
self.window.progressbar.pulse()
|
||||||
self.window.progressbar.show()
|
self.window.progressbar.show()
|
||||||
self._pulse_timeout = gobject.timeout_add(250, self._pulse_timeout_cb)
|
self._pulse_timeout = gobject.timeout_add(250, self._pulse_timeout_cb)
|
||||||
self.cache.get_items(self.jid, self.node, self._agent_items,
|
self.cache.get_items(self.jid, self.node, self._agent_items,
|
||||||
force = force, args = (force,))
|
force = force, args = (force,))
|
||||||
|
|
||||||
def _pulse_timeout_cb(self, *args):
|
def _pulse_timeout_cb(self, *args):
|
||||||
'''Simple callback to keep the progressbar pulsing.'''
|
'''Simple callback to keep the progressbar pulsing.'''
|
||||||
if not self.active:
|
if not self.active:
|
||||||
return False
|
return False
|
||||||
self.window.progressbar.pulse()
|
self.window.progressbar.pulse()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _find_item(self, jid, node):
|
def _find_item(self, jid, node):
|
||||||
'''Check if an item is already in the treeview. Return an iter to it
|
'''Check if an item is already in the treeview. Return an iter to it
|
||||||
if so, None otherwise.'''
|
if so, None otherwise.'''
|
||||||
|
@ -844,7 +847,7 @@ class AgentBrowser:
|
||||||
if iter:
|
if iter:
|
||||||
return iter
|
return iter
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _agent_items(self, jid, node, items, force):
|
def _agent_items(self, jid, node, items, force):
|
||||||
'''Callback for when we receive a list of agent items.'''
|
'''Callback for when we receive a list of agent items.'''
|
||||||
model = self.window.services_treeview.get_model()
|
model = self.window.services_treeview.get_model()
|
||||||
|
@ -870,7 +873,7 @@ _('This service does not contain any items to browse.')).get_response()
|
||||||
# Not in the treeview
|
# Not in the treeview
|
||||||
self._total_items += 1
|
self._total_items += 1
|
||||||
self._add_item(model, jid, node, item, force)
|
self._add_item(model, jid, node, item, force)
|
||||||
|
|
||||||
def _agent_info(self, jid, node, identities, features, data):
|
def _agent_info(self, jid, node, identities, features, data):
|
||||||
'''Callback for when we receive info about an agent's item.'''
|
'''Callback for when we receive info about an agent's item.'''
|
||||||
addr = get_agent_address(jid, node)
|
addr = get_agent_address(jid, node)
|
||||||
|
@ -904,7 +907,7 @@ _('This service does not contain any items to browse.')).get_response()
|
||||||
'''Called when an item should be updated in the model with further info.
|
'''Called when an item should be updated in the model with further info.
|
||||||
The result of a disco#info query.'''
|
The result of a disco#info query.'''
|
||||||
model[iter][2] = identities[0].get('name', '')
|
model[iter][2] = identities[0].get('name', '')
|
||||||
|
|
||||||
def _update_error(self, model, iter, jid, node):
|
def _update_error(self, model, iter, jid, node):
|
||||||
'''Called when a disco#info query failed for an item.'''
|
'''Called when a disco#info query failed for an item.'''
|
||||||
pass
|
pass
|
||||||
|
@ -933,7 +936,7 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
cell.set_property('pixbuf', pix)
|
cell.set_property('pixbuf', pix)
|
||||||
else:
|
else:
|
||||||
cell.set_property('visible', False)
|
cell.set_property('visible', False)
|
||||||
|
|
||||||
def _text_renderer_data_func(self, col, cell, model, iter):
|
def _text_renderer_data_func(self, col, cell, model, iter):
|
||||||
'''Callback for setting the text renderer's properties.'''
|
'''Callback for setting the text renderer's properties.'''
|
||||||
jid = model.get_value(iter, 0)
|
jid = model.get_value(iter, 0)
|
||||||
|
@ -985,7 +988,7 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
(position[0], position[1] + rect.y))
|
(position[0], position[1] + rect.y))
|
||||||
else:
|
else:
|
||||||
self.tooltip.hide_tooltip()
|
self.tooltip.hide_tooltip()
|
||||||
|
|
||||||
# These are all callbacks to make tooltips work
|
# These are all callbacks to make tooltips work
|
||||||
def on_treeview_leave_notify_event(self, widget, event):
|
def on_treeview_leave_notify_event(self, widget, event):
|
||||||
model = widget.get_model()
|
model = widget.get_model()
|
||||||
|
@ -1030,7 +1033,7 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
model.set_sort_column_id(4, gtk.SORT_ASCENDING)
|
model.set_sort_column_id(4, gtk.SORT_ASCENDING)
|
||||||
view = self.window.services_treeview
|
view = self.window.services_treeview
|
||||||
view.set_model(model)
|
view.set_model(model)
|
||||||
|
|
||||||
col = gtk.TreeViewColumn()
|
col = gtk.TreeViewColumn()
|
||||||
# Icon Renderer
|
# Icon Renderer
|
||||||
renderer = gtk.CellRendererPixbuf()
|
renderer = gtk.CellRendererPixbuf()
|
||||||
|
@ -1045,10 +1048,10 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
# Save this so we can go along with theme changes
|
# Save this so we can go along with theme changes
|
||||||
self._renderer = renderer
|
self._renderer = renderer
|
||||||
self.update_theme()
|
self.update_theme()
|
||||||
|
|
||||||
view.insert_column(col, -1)
|
view.insert_column(col, -1)
|
||||||
col.set_resizable(True)
|
col.set_resizable(True)
|
||||||
|
|
||||||
# Connect signals
|
# Connect signals
|
||||||
scrollwin = self.window.services_scrollwin
|
scrollwin = self.window.services_scrollwin
|
||||||
self._view_signals.append(view.connect('leave-notify-event',
|
self._view_signals.append(view.connect('leave-notify-event',
|
||||||
|
@ -1061,7 +1064,7 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
self.on_treeview_event_hide_tooltip))
|
self.on_treeview_event_hide_tooltip))
|
||||||
self._scroll_signal = scrollwin.connect('scroll-event',
|
self._scroll_signal = scrollwin.connect('scroll-event',
|
||||||
self.on_treeview_event_hide_tooltip)
|
self.on_treeview_event_hide_tooltip)
|
||||||
|
|
||||||
def _clean_treemodel(self):
|
def _clean_treemodel(self):
|
||||||
# Disconnect signals
|
# Disconnect signals
|
||||||
view = self.window.services_treeview
|
view = self.window.services_treeview
|
||||||
|
@ -1073,7 +1076,7 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
scrollwin.disconnect(self._scroll_signal)
|
scrollwin.disconnect(self._scroll_signal)
|
||||||
self._scroll_signal = None
|
self._scroll_signal = None
|
||||||
AgentBrowser._clean_treemodel(self)
|
AgentBrowser._clean_treemodel(self)
|
||||||
|
|
||||||
def _add_actions(self):
|
def _add_actions(self):
|
||||||
AgentBrowser._add_actions(self)
|
AgentBrowser._add_actions(self)
|
||||||
self.register_button = gtk.Button(label=_("Re_gister"),
|
self.register_button = gtk.Button(label=_("Re_gister"),
|
||||||
|
@ -1103,14 +1106,14 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
self.tooltip.hide_tooltip()
|
self.tooltip.hide_tooltip()
|
||||||
AgentBrowser.cleanup(self)
|
AgentBrowser.cleanup(self)
|
||||||
|
|
||||||
def update_theme(self):
|
def update_theme(self):
|
||||||
theme = gajim.config.get('roster_theme')
|
theme = gajim.config.get('roster_theme')
|
||||||
bgcolor = gajim.config.get_per('themes', theme, 'groupbgcolor')
|
bgcolor = gajim.config.get_per('themes', theme, 'groupbgcolor')
|
||||||
if bgcolor:
|
if bgcolor:
|
||||||
self._renderer.set_property('cell-background', bgcolor)
|
self._renderer.set_property('cell-background', bgcolor)
|
||||||
self.window.services_treeview.queue_draw()
|
self.window.services_treeview.queue_draw()
|
||||||
|
|
||||||
def on_register_button_clicked(self, widget = None):
|
def on_register_button_clicked(self, widget = None):
|
||||||
'''When we want to register an agent:
|
'''When we want to register an agent:
|
||||||
request information about registering with the agent and close the
|
request information about registering with the agent and close the
|
||||||
|
@ -1190,7 +1193,7 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
self.register_button.set_sensitive(True)
|
self.register_button.set_sensitive(True)
|
||||||
if self.join_button and xmpp.NS_MUC in features:
|
if self.join_button and xmpp.NS_MUC in features:
|
||||||
self.join_button.set_sensitive(True)
|
self.join_button.set_sensitive(True)
|
||||||
|
|
||||||
def _default_action(self, jid, node, identities, features, data):
|
def _default_action(self, jid, node, identities, features, data):
|
||||||
if AgentBrowser._default_action(self, jid, node, identities, features, data):
|
if AgentBrowser._default_action(self, jid, node, identities, features, data):
|
||||||
return True
|
return True
|
||||||
|
@ -1203,7 +1206,7 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
def browse(self, force = False):
|
def browse(self, force = False):
|
||||||
self._progress = 0
|
self._progress = 0
|
||||||
AgentBrowser.browse(self, force = force)
|
AgentBrowser.browse(self, force = force)
|
||||||
|
|
||||||
def _expand_all(self):
|
def _expand_all(self):
|
||||||
'''Expand all items in the treeview'''
|
'''Expand all items in the treeview'''
|
||||||
# GTK apparently screws up here occasionally. :/
|
# GTK apparently screws up here occasionally. :/
|
||||||
|
@ -1214,7 +1217,7 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
#self.expanding = True
|
#self.expanding = True
|
||||||
#gobject.idle_add(expand_all)
|
#gobject.idle_add(expand_all)
|
||||||
self.window.services_treeview.expand_all()
|
self.window.services_treeview.expand_all()
|
||||||
|
|
||||||
def _update_progressbar(self):
|
def _update_progressbar(self):
|
||||||
'''Update the progressbar.'''
|
'''Update the progressbar.'''
|
||||||
# Refresh this every update
|
# Refresh this every update
|
||||||
|
@ -1236,13 +1239,13 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
id = gobject.timeout_add(20000, self._hide_progressbar_cb)
|
id = gobject.timeout_add(20000, self._hide_progressbar_cb)
|
||||||
self._progressbar_sourceid = id
|
self._progressbar_sourceid = id
|
||||||
self.window.progressbar.set_fraction(fraction)
|
self.window.progressbar.set_fraction(fraction)
|
||||||
|
|
||||||
def _hide_progressbar_cb(self, *args):
|
def _hide_progressbar_cb(self, *args):
|
||||||
'''Simple callback to hide the progressbar a second after we finish.'''
|
'''Simple callback to hide the progressbar a second after we finish.'''
|
||||||
if self.active:
|
if self.active:
|
||||||
self.window.progressbar.hide()
|
self.window.progressbar.hide()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _friendly_category(self, category, type=None):
|
def _friendly_category(self, category, type=None):
|
||||||
'''Get the friendly category name and priority.'''
|
'''Get the friendly category name and priority.'''
|
||||||
cat = None
|
cat = None
|
||||||
|
@ -1258,13 +1261,13 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
except KeyError:
|
except KeyError:
|
||||||
cat, prio = _cat_to_descr['other']
|
cat, prio = _cat_to_descr['other']
|
||||||
return cat, prio
|
return cat, prio
|
||||||
|
|
||||||
def _create_category(self, cat, type=None):
|
def _create_category(self, cat, type=None):
|
||||||
'''Creates a category row.'''
|
'''Creates a category row.'''
|
||||||
model = self.window.services_treeview.get_model()
|
model = self.window.services_treeview.get_model()
|
||||||
cat, prio = self._friendly_category(cat, type)
|
cat, prio = self._friendly_category(cat, type)
|
||||||
return model.append(None, ('', '', None, cat, prio))
|
return model.append(None, ('', '', None, cat, prio))
|
||||||
|
|
||||||
def _find_category(self, cat, type=None):
|
def _find_category(self, cat, type=None):
|
||||||
'''Looks up a category row and returns the iterator to it, or None.'''
|
'''Looks up a category row and returns the iterator to it, or None.'''
|
||||||
model = self.window.services_treeview.get_model()
|
model = self.window.services_treeview.get_model()
|
||||||
|
@ -1277,7 +1280,7 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
if iter:
|
if iter:
|
||||||
return iter
|
return iter
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _find_item(self, jid, node):
|
def _find_item(self, jid, node):
|
||||||
model = self.window.services_treeview.get_model()
|
model = self.window.services_treeview.get_model()
|
||||||
iter = None
|
iter = None
|
||||||
|
@ -1340,7 +1343,7 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
descr = "<b>%s</b>\n%s" % (name, addr)
|
descr = "<b>%s</b>\n%s" % (name, addr)
|
||||||
else:
|
else:
|
||||||
descr = "<b>%s</b>" % addr
|
descr = "<b>%s</b>" % addr
|
||||||
|
|
||||||
# Update progress
|
# Update progress
|
||||||
self._progress += 1
|
self._progress += 1
|
||||||
self._update_progressbar()
|
self._update_progressbar()
|
||||||
|
@ -1365,13 +1368,13 @@ class ToplevelAgentBrowser(AgentBrowser):
|
||||||
return
|
return
|
||||||
# Not in the right category, move it.
|
# Not in the right category, move it.
|
||||||
model.remove(iter)
|
model.remove(iter)
|
||||||
|
|
||||||
# Check if the old category is empty
|
# Check if the old category is empty
|
||||||
if not model.iter_is_valid(old_cat_iter):
|
if not model.iter_is_valid(old_cat_iter):
|
||||||
old_cat_iter = self._find_category(old_cat)
|
old_cat_iter = self._find_category(old_cat)
|
||||||
if not model.iter_children(old_cat_iter):
|
if not model.iter_children(old_cat_iter):
|
||||||
model.remove(old_cat_iter)
|
model.remove(old_cat_iter)
|
||||||
|
|
||||||
cat_iter = self._find_category(cat, type)
|
cat_iter = self._find_category(cat, type)
|
||||||
if not cat_iter:
|
if not cat_iter:
|
||||||
cat_iter = self._create_category(cat, type)
|
cat_iter = self._create_category(cat, type)
|
||||||
|
@ -1389,7 +1392,7 @@ class MucBrowser(AgentBrowser):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
AgentBrowser.__init__(self, *args, **kwargs)
|
AgentBrowser.__init__(self, *args, **kwargs)
|
||||||
self.join_button = None
|
self.join_button = None
|
||||||
|
|
||||||
def _create_treemodel(self):
|
def _create_treemodel(self):
|
||||||
# JID, node, name, users, description, fetched
|
# JID, node, name, users, description, fetched
|
||||||
# This is rather long, I'd rather not use a data_func here though.
|
# This is rather long, I'd rather not use a data_func here though.
|
||||||
|
@ -1437,9 +1440,9 @@ class MucBrowser(AgentBrowser):
|
||||||
self.vadj.disconnect(self.vadj_cbid)
|
self.vadj.disconnect(self.vadj_cbid)
|
||||||
self.vadj_cbid = None
|
self.vadj_cbid = None
|
||||||
AgentBrowser._clean_treemodel(self)
|
AgentBrowser._clean_treemodel(self)
|
||||||
|
|
||||||
def _add_actions(self):
|
def _add_actions(self):
|
||||||
self.join_button = gtk.Button(label=_("_Join"), use_underline=True)
|
self.join_button = gtk.Button(label=_('_Join'), use_underline=True)
|
||||||
self.join_button.connect('clicked', self.on_join_button_clicked)
|
self.join_button.connect('clicked', self.on_join_button_clicked)
|
||||||
self.window.action_buttonbox.add(self.join_button)
|
self.window.action_buttonbox.add(self.join_button)
|
||||||
self.join_button.show_all()
|
self.join_button.show_all()
|
||||||
|
|
|
@ -185,7 +185,7 @@ class RosterWindow:
|
||||||
typestr = 'contact'
|
typestr = 'contact'
|
||||||
if g == _('Transports'):
|
if g == _('Transports'):
|
||||||
typestr = 'agent'
|
typestr = 'agent'
|
||||||
|
|
||||||
# we add some values here. see draw_contact for more
|
# we add some values here. see draw_contact for more
|
||||||
model.append(iterG, (None, user.name,
|
model.append(iterG, (None, user.name,
|
||||||
typestr, user.jid, account, False, None))
|
typestr, user.jid, account, False, None))
|
||||||
|
@ -351,15 +351,15 @@ class RosterWindow:
|
||||||
def on_delete_motd_menuitem_activate(self, widget, account):
|
def on_delete_motd_menuitem_activate(self, widget, account):
|
||||||
server = gajim.config.get_per('accounts', account, 'hostname')
|
server = gajim.config.get_per('accounts', account, 'hostname')
|
||||||
server += '/announce/motd/delete'
|
server += '/announce/motd/delete'
|
||||||
gajim.connections[account].send_motd(server)
|
gajim.connections[account].send_motd(server)
|
||||||
|
|
||||||
def on_online_users_menuitem_activate(self, widget, account):
|
def on_online_users_menuitem_activate(self, widget, account):
|
||||||
pass #FIXME: impement disco in users for 0.9
|
pass #FIXME: impement disco in users for 0.9
|
||||||
|
|
||||||
def get_and_connect_advanced_menuitem_menu(self, account):
|
def get_and_connect_advanced_menuitem_menu(self, account):
|
||||||
xml = gtk.glade.XML(GTKGUI_GLADE, 'advanced_menuitem_menu', APP)
|
xml = gtk.glade.XML(GTKGUI_GLADE, 'advanced_menuitem_menu', APP)
|
||||||
advanced_menuitem_menu = xml.get_widget('advanced_menuitem_menu')
|
advanced_menuitem_menu = xml.get_widget('advanced_menuitem_menu')
|
||||||
|
|
||||||
send_single_message_menuitem = xml.get_widget(
|
send_single_message_menuitem = xml.get_widget(
|
||||||
'send_single_message_menuitem')
|
'send_single_message_menuitem')
|
||||||
xml_console_menuitem = xml.get_widget('xml_console_menuitem')
|
xml_console_menuitem = xml.get_widget('xml_console_menuitem')
|
||||||
|
@ -370,7 +370,7 @@ class RosterWindow:
|
||||||
set_motd_menuitem = xml.get_widget('set_motd_menuitem')
|
set_motd_menuitem = xml.get_widget('set_motd_menuitem')
|
||||||
update_motd_menuitem = xml.get_widget('update_motd_menuitem')
|
update_motd_menuitem = xml.get_widget('update_motd_menuitem')
|
||||||
delete_motd_menuitem = xml.get_widget('delete_motd_menuitem')
|
delete_motd_menuitem = xml.get_widget('delete_motd_menuitem')
|
||||||
|
|
||||||
send_single_message_menuitem.connect('activate',
|
send_single_message_menuitem.connect('activate',
|
||||||
self.on_send_single_message_menuitem_activate, account)
|
self.on_send_single_message_menuitem_activate, account)
|
||||||
|
|
||||||
|
@ -391,12 +391,12 @@ class RosterWindow:
|
||||||
|
|
||||||
update_motd_menuitem.connect('activate',
|
update_motd_menuitem.connect('activate',
|
||||||
self.on_update_motd_menuitem_activate, account)
|
self.on_update_motd_menuitem_activate, account)
|
||||||
|
|
||||||
delete_motd_menuitem.connect('activate',
|
delete_motd_menuitem.connect('activate',
|
||||||
self.on_delete_motd_menuitem_activate, account)
|
self.on_delete_motd_menuitem_activate, account)
|
||||||
|
|
||||||
advanced_menuitem_menu.show_all()
|
advanced_menuitem_menu.show_all()
|
||||||
|
|
||||||
return advanced_menuitem_menu
|
return advanced_menuitem_menu
|
||||||
|
|
||||||
def make_menu(self):
|
def make_menu(self):
|
||||||
|
@ -409,7 +409,7 @@ class RosterWindow:
|
||||||
show_offline_contacts_menuitem = self.xml.get_widget(
|
show_offline_contacts_menuitem = self.xml.get_widget(
|
||||||
'show_offline_contacts_menuitem')
|
'show_offline_contacts_menuitem')
|
||||||
profile_avatar_menuitem = self.xml.get_widget('profile_avatar_menuitem')
|
profile_avatar_menuitem = self.xml.get_widget('profile_avatar_menuitem')
|
||||||
|
|
||||||
# make it sensitive. it is insensitive only if no accounts are *available*
|
# make it sensitive. it is insensitive only if no accounts are *available*
|
||||||
advanced_menuitem.set_sensitive(True)
|
advanced_menuitem.set_sensitive(True)
|
||||||
|
|
||||||
|
@ -423,12 +423,12 @@ class RosterWindow:
|
||||||
service_disco_menuitem.handler_disconnect(
|
service_disco_menuitem.handler_disconnect(
|
||||||
self.service_disco_handler_id)
|
self.service_disco_handler_id)
|
||||||
self.service_disco_handler_id = None
|
self.service_disco_handler_id = None
|
||||||
|
|
||||||
if self.new_message_menuitem_handler_id:
|
if self.new_message_menuitem_handler_id:
|
||||||
new_message_menuitem.handler_disconnect(
|
new_message_menuitem.handler_disconnect(
|
||||||
self.new_message_menuitem_handler_id)
|
self.new_message_menuitem_handler_id)
|
||||||
self.new_message_menuitem_handler_id = None
|
self.new_message_menuitem_handler_id = None
|
||||||
|
|
||||||
#remove the existing submenus
|
#remove the existing submenus
|
||||||
add_new_contact_menuitem.remove_submenu()
|
add_new_contact_menuitem.remove_submenu()
|
||||||
service_disco_menuitem.remove_submenu()
|
service_disco_menuitem.remove_submenu()
|
||||||
|
@ -460,7 +460,7 @@ class RosterWindow:
|
||||||
item.add(label)
|
item.add(label)
|
||||||
item.connect('state-changed', self.on_bm_header_changed_state)
|
item.connect('state-changed', self.on_bm_header_changed_state)
|
||||||
sub_menu.append(item)
|
sub_menu.append(item)
|
||||||
|
|
||||||
item = gtk.MenuItem(_('_Join New Room'))
|
item = gtk.MenuItem(_('_Join New Room'))
|
||||||
item.connect('activate', self.on_join_gc_activate, account)
|
item.connect('activate', self.on_join_gc_activate, account)
|
||||||
sub_menu.append(item)
|
sub_menu.append(item)
|
||||||
|
@ -475,7 +475,7 @@ class RosterWindow:
|
||||||
#and make sure it works
|
#and make sure it works
|
||||||
newitem = gtk.SeparatorMenuItem() # seperator
|
newitem = gtk.SeparatorMenuItem() # seperator
|
||||||
sub_menu.append(newitem)
|
sub_menu.append(newitem)
|
||||||
|
|
||||||
newitem = gtk.ImageMenuItem(_('Manage Bookmarks...'))
|
newitem = gtk.ImageMenuItem(_('Manage Bookmarks...'))
|
||||||
img = gtk.image_new_from_stock(gtk.STOCK_PREFERENCES,
|
img = gtk.image_new_from_stock(gtk.STOCK_PREFERENCES,
|
||||||
gtk.ICON_SIZE_MENU)
|
gtk.ICON_SIZE_MENU)
|
||||||
|
@ -496,7 +496,7 @@ class RosterWindow:
|
||||||
item.connect('activate', self.on_add_new_contact, account)
|
item.connect('activate', self.on_add_new_contact, account)
|
||||||
add_new_contact_menuitem.set_submenu(sub_menu)
|
add_new_contact_menuitem.set_submenu(sub_menu)
|
||||||
sub_menu.show_all()
|
sub_menu.show_all()
|
||||||
|
|
||||||
#disco
|
#disco
|
||||||
sub_menu = gtk.Menu()
|
sub_menu = gtk.Menu()
|
||||||
for account in gajim.connections:
|
for account in gajim.connections:
|
||||||
|
@ -510,7 +510,7 @@ class RosterWindow:
|
||||||
|
|
||||||
service_disco_menuitem.set_submenu(sub_menu)
|
service_disco_menuitem.set_submenu(sub_menu)
|
||||||
sub_menu.show_all()
|
sub_menu.show_all()
|
||||||
|
|
||||||
#new message
|
#new message
|
||||||
sub_menu = gtk.Menu()
|
sub_menu = gtk.Menu()
|
||||||
for account in gajim.connections:
|
for account in gajim.connections:
|
||||||
|
@ -519,12 +519,12 @@ class RosterWindow:
|
||||||
continue
|
continue
|
||||||
item = gtk.MenuItem(_('using account %s') % account)
|
item = gtk.MenuItem(_('using account %s') % account)
|
||||||
sub_menu.append(item)
|
sub_menu.append(item)
|
||||||
item.connect('activate', self.on_new_message_menuitem_activate,
|
item.connect('activate', self.on_new_message_menuitem_activate,
|
||||||
account)
|
account)
|
||||||
|
|
||||||
new_message_menuitem.set_submenu(sub_menu)
|
new_message_menuitem.set_submenu(sub_menu)
|
||||||
sub_menu.show_all()
|
sub_menu.show_all()
|
||||||
|
|
||||||
#Advanced Actions
|
#Advanced Actions
|
||||||
sub_menu = gtk.Menu()
|
sub_menu = gtk.Menu()
|
||||||
for account in gajim.connections:
|
for account in gajim.connections:
|
||||||
|
@ -533,10 +533,10 @@ class RosterWindow:
|
||||||
advanced_menuitem_menu = self.get_and_connect_advanced_menuitem_menu(
|
advanced_menuitem_menu = self.get_and_connect_advanced_menuitem_menu(
|
||||||
account)
|
account)
|
||||||
item.set_submenu(advanced_menuitem_menu)
|
item.set_submenu(advanced_menuitem_menu)
|
||||||
|
|
||||||
advanced_menuitem.set_submenu(sub_menu)
|
advanced_menuitem.set_submenu(sub_menu)
|
||||||
sub_menu.show_all()
|
sub_menu.show_all()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if len(gajim.connections) == 1: # user has only one account
|
if len(gajim.connections) == 1: # user has only one account
|
||||||
#add
|
#add
|
||||||
|
@ -545,13 +545,13 @@ class RosterWindow:
|
||||||
'activate', self.on_add_new_contact, gajim.connections.keys()[0])
|
'activate', self.on_add_new_contact, gajim.connections.keys()[0])
|
||||||
#disco
|
#disco
|
||||||
if not self.service_disco_handler_id:
|
if not self.service_disco_handler_id:
|
||||||
self.service_disco_handler_id = service_disco_menuitem.connect(
|
self.service_disco_handler_id = service_disco_menuitem.connect(
|
||||||
'activate', self.on_service_disco_menuitem_activate,
|
'activate', self.on_service_disco_menuitem_activate,
|
||||||
gajim.connections.keys()[0])
|
gajim.connections.keys()[0])
|
||||||
#new msg
|
#new msg
|
||||||
if not self.new_message_menuitem_handler_id:
|
if not self.new_message_menuitem_handler_id:
|
||||||
self.new_message_menuitem_handler_id = new_message_menuitem.\
|
self.new_message_menuitem_handler_id = new_message_menuitem.\
|
||||||
connect('activate', self.on_new_message_menuitem_activate,
|
connect('activate', self.on_new_message_menuitem_activate,
|
||||||
gajim.connections.keys()[0])
|
gajim.connections.keys()[0])
|
||||||
#new msg accel
|
#new msg accel
|
||||||
if not self.have_new_message_accel:
|
if not self.have_new_message_accel:
|
||||||
|
@ -559,7 +559,7 @@ class RosterWindow:
|
||||||
new_message_menuitem.add_accelerator('activate', ag,
|
new_message_menuitem.add_accelerator('activate', ag,
|
||||||
gtk.keysyms.n, gtk.gdk.CONTROL_MASK, gtk.ACCEL_VISIBLE)
|
gtk.keysyms.n, gtk.gdk.CONTROL_MASK, gtk.ACCEL_VISIBLE)
|
||||||
self.have_new_message_accel = True
|
self.have_new_message_accel = True
|
||||||
|
|
||||||
account = gajim.connections.keys()[0]
|
account = gajim.connections.keys()[0]
|
||||||
advanced_menuitem_menu = self.get_and_connect_advanced_menuitem_menu(
|
advanced_menuitem_menu = self.get_and_connect_advanced_menuitem_menu(
|
||||||
account)
|
account)
|
||||||
|
@ -567,11 +567,10 @@ class RosterWindow:
|
||||||
elif len(gajim.connections) == 0: # user has no accounts
|
elif len(gajim.connections) == 0: # user has no accounts
|
||||||
advanced_menuitem.set_sensitive(False)
|
advanced_menuitem.set_sensitive(False)
|
||||||
|
|
||||||
|
|
||||||
#FIXME: Gajim 0.9 should have this visible
|
#FIXME: Gajim 0.9 should have this visible
|
||||||
profile_avatar_menuitem.set_no_show_all(True)
|
profile_avatar_menuitem.set_no_show_all(True)
|
||||||
profile_avatar_menuitem.hide()
|
profile_avatar_menuitem.hide()
|
||||||
|
|
||||||
if at_least_one_account_connected:
|
if at_least_one_account_connected:
|
||||||
new_message_menuitem.set_sensitive(True)
|
new_message_menuitem.set_sensitive(True)
|
||||||
join_gc_menuitem.set_sensitive(True)
|
join_gc_menuitem.set_sensitive(True)
|
||||||
|
@ -704,7 +703,7 @@ class RosterWindow:
|
||||||
uf_show = helpers.get_uf_show(show)
|
uf_show = helpers.get_uf_show(show)
|
||||||
gajim.interface.instances[account]['chats'][jid].print_conversation(
|
gajim.interface.instances[account]['chats'][jid].print_conversation(
|
||||||
_('%s is now %s (%s)') % (name, uf_show, status), jid, 'status')
|
_('%s is now %s (%s)') % (name, uf_show, status), jid, 'status')
|
||||||
|
|
||||||
if contact == gajim.get_contact_instance_with_highest_priority(\
|
if contact == gajim.get_contact_instance_with_highest_priority(\
|
||||||
account, contact.jid):
|
account, contact.jid):
|
||||||
gajim.interface.instances[account]['chats'][jid].draw_name_banner(contact)
|
gajim.interface.instances[account]['chats'][jid].draw_name_banner(contact)
|
||||||
|
@ -773,12 +772,12 @@ class RosterWindow:
|
||||||
contacts = []
|
contacts = []
|
||||||
connection = gajim.connections[account]
|
connection = gajim.connections[account]
|
||||||
# get our current contact info
|
# get our current contact info
|
||||||
contact = Contact(jid = jid, name = account,
|
contact = Contact(jid = jid, name = account,
|
||||||
show = connection.get_status(),
|
show = connection.get_status(),
|
||||||
sub = 'both',
|
sub = 'both',
|
||||||
status = connection.status,
|
status = connection.status,
|
||||||
resource = gajim.config.get_per('accounts', connection.name,
|
resource = gajim.config.get_per('accounts', connection.name,
|
||||||
'resource'),
|
'resource'),
|
||||||
priority = gajim.config.get_per('accounts', connection.name,
|
priority = gajim.config.get_per('accounts', connection.name,
|
||||||
'priority'),
|
'priority'),
|
||||||
keyID = gajim.config.get_per('accounts', connection.name,
|
keyID = gajim.config.get_per('accounts', connection.name,
|
||||||
|
@ -794,9 +793,9 @@ class RosterWindow:
|
||||||
show = roster.getShow(jid+'/'+resource)
|
show = roster.getShow(jid+'/'+resource)
|
||||||
if not show:
|
if not show:
|
||||||
show = 'online'
|
show = 'online'
|
||||||
contact = Contact(jid=jid, name=account,
|
contact = Contact(jid=jid, name=account,
|
||||||
show=show,
|
show=show,
|
||||||
status=roster.getStatus(jid+'/'+resource), resource=resource,
|
status=roster.getStatus(jid+'/'+resource), resource=resource,
|
||||||
priority=roster.getPriority(jid+'/'+resource))
|
priority=roster.getPriority(jid+'/'+resource))
|
||||||
contacts.append(contact)
|
contacts.append(contact)
|
||||||
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
if self.tooltip.timeout == 0 or self.tooltip.id != props[0]:
|
||||||
|
@ -843,10 +842,10 @@ class RosterWindow:
|
||||||
# we then select Rename and focus-in
|
# we then select Rename and focus-in
|
||||||
# focus-in callback checks on this var and if is NOT None
|
# focus-in callback checks on this var and if is NOT None
|
||||||
# it redraws the selected contact resulting in stopping our rename
|
# it redraws the selected contact resulting in stopping our rename
|
||||||
# procedure. So set this to None to stop that
|
# procedure. So set this to None to stop that
|
||||||
self._last_selected_contact = None
|
self._last_selected_contact = None
|
||||||
model = self.tree.get_model()
|
model = self.tree.get_model()
|
||||||
|
|
||||||
row_type = model[iter][C_TYPE]
|
row_type = model[iter][C_TYPE]
|
||||||
jid = model[iter][C_JID].decode('utf-8')
|
jid = model[iter][C_JID].decode('utf-8')
|
||||||
account = model[iter][C_ACCOUNT].decode('utf-8')
|
account = model[iter][C_ACCOUNT].decode('utf-8')
|
||||||
|
@ -859,7 +858,7 @@ class RosterWindow:
|
||||||
|
|
||||||
model[iter][C_EDITABLE] = True # set 'editable' to True
|
model[iter][C_EDITABLE] = True # set 'editable' to True
|
||||||
self.tree.set_cursor(path, self.tree.get_column(0), True)
|
self.tree.set_cursor(path, self.tree.get_column(0), True)
|
||||||
|
|
||||||
def on_assign_pgp_key(self, widget, user, account):
|
def on_assign_pgp_key(self, widget, user, account):
|
||||||
attached_keys = gajim.config.get_per('accounts', account,
|
attached_keys = gajim.config.get_per('accounts', account,
|
||||||
'attached_gpg_keys').split()
|
'attached_gpg_keys').split()
|
||||||
|
@ -893,7 +892,7 @@ class RosterWindow:
|
||||||
def on_edit_groups(self, widget, user, account):
|
def on_edit_groups(self, widget, user, account):
|
||||||
dlg = dialogs.EditGroupsDialog(user, account)
|
dlg = dialogs.EditGroupsDialog(user, account)
|
||||||
dlg.run()
|
dlg.run()
|
||||||
|
|
||||||
def on_history(self, widget, contact, account):
|
def on_history(self, widget, contact, account):
|
||||||
'''When history menuitem is activated: call log window'''
|
'''When history menuitem is activated: call log window'''
|
||||||
if gajim.interface.instances['logs'].has_key(contact.jid):
|
if gajim.interface.instances['logs'].has_key(contact.jid):
|
||||||
|
@ -908,11 +907,11 @@ class RosterWindow:
|
||||||
dialogs.SingleMessageWindow(account, action = 'send')
|
dialogs.SingleMessageWindow(account, action = 'send')
|
||||||
else:
|
else:
|
||||||
dialogs.SingleMessageWindow(account, contact.jid, 'send')
|
dialogs.SingleMessageWindow(account, contact.jid, 'send')
|
||||||
|
|
||||||
def on_send_file_menuitem_activate(self, widget, account, contact):
|
def on_send_file_menuitem_activate(self, widget, account, contact):
|
||||||
gajim.interface.instances['file_transfers'].show_file_send_request(
|
gajim.interface.instances['file_transfers'].show_file_send_request(
|
||||||
account, contact)
|
account, contact)
|
||||||
|
|
||||||
def mk_menu_user(self, event, iter):
|
def mk_menu_user(self, event, iter):
|
||||||
'''Make contact's popup menu'''
|
'''Make contact's popup menu'''
|
||||||
model = self.tree.get_model()
|
model = self.tree.get_model()
|
||||||
|
@ -921,13 +920,13 @@ class RosterWindow:
|
||||||
account = model[iter][C_ACCOUNT].decode('utf-8')
|
account = model[iter][C_ACCOUNT].decode('utf-8')
|
||||||
contact = gajim.get_highest_prio_contact_from_contacts(
|
contact = gajim.get_highest_prio_contact_from_contacts(
|
||||||
gajim.contacts[account][jid])
|
gajim.contacts[account][jid])
|
||||||
|
|
||||||
xml = gtk.glade.XML(GTKGUI_GLADE, 'roster_contact_context_menu',
|
xml = gtk.glade.XML(GTKGUI_GLADE, 'roster_contact_context_menu',
|
||||||
APP)
|
APP)
|
||||||
roster_contact_context_menu = xml.get_widget(
|
roster_contact_context_menu = xml.get_widget(
|
||||||
'roster_contact_context_menu')
|
'roster_contact_context_menu')
|
||||||
childs = roster_contact_context_menu.get_children()
|
childs = roster_contact_context_menu.get_children()
|
||||||
|
|
||||||
start_chat_menuitem = childs[0]
|
start_chat_menuitem = childs[0]
|
||||||
send_single_message_menuitem = childs[1]
|
send_single_message_menuitem = childs[1]
|
||||||
rename_menuitem = childs[2]
|
rename_menuitem = childs[2]
|
||||||
|
@ -936,7 +935,7 @@ class RosterWindow:
|
||||||
assign_openpgp_separator = childs[4]
|
assign_openpgp_separator = childs[4]
|
||||||
send_file_menuitem = childs[5]
|
send_file_menuitem = childs[5]
|
||||||
assign_openpgp_key_menuitem = childs[6]
|
assign_openpgp_key_menuitem = childs[6]
|
||||||
|
|
||||||
#skip a seperator
|
#skip a seperator
|
||||||
send_auth_menuitem, ask_auth_menuitem, revoke_auth_menuitem =\
|
send_auth_menuitem, ask_auth_menuitem, revoke_auth_menuitem =\
|
||||||
childs[8].get_submenu().get_children()
|
childs[8].get_submenu().get_children()
|
||||||
|
@ -945,15 +944,15 @@ class RosterWindow:
|
||||||
#skip a seperator
|
#skip a seperator
|
||||||
information_menuitem = childs[12]
|
information_menuitem = childs[12]
|
||||||
history_menuitem = childs[13]
|
history_menuitem = childs[13]
|
||||||
|
|
||||||
|
|
||||||
if contact.resource:
|
if contact.resource:
|
||||||
send_file_menuitem.connect('activate',
|
send_file_menuitem.connect('activate',
|
||||||
self.on_send_file_menuitem_activate, account, contact)
|
self.on_send_file_menuitem_activate, account, contact)
|
||||||
else: # if we do not have resource we cannot send file
|
else: # if we do not have resource we cannot send file
|
||||||
send_file_menuitem.hide()
|
send_file_menuitem.hide()
|
||||||
send_file_menuitem.set_no_show_all(True)
|
send_file_menuitem.set_no_show_all(True)
|
||||||
|
|
||||||
start_chat_menuitem.connect('activate',
|
start_chat_menuitem.connect('activate',
|
||||||
self.on_roster_treeview_row_activated, path)
|
self.on_roster_treeview_row_activated, path)
|
||||||
send_single_message_menuitem.connect('activate',
|
send_single_message_menuitem.connect('activate',
|
||||||
|
@ -993,7 +992,7 @@ class RosterWindow:
|
||||||
else:
|
else:
|
||||||
revoke_auth_menuitem.connect('activate', self.revoke_auth, jid,
|
revoke_auth_menuitem.connect('activate', self.revoke_auth, jid,
|
||||||
account)
|
account)
|
||||||
|
|
||||||
else: # contact is in group 'not in the roster'
|
else: # contact is in group 'not in the roster'
|
||||||
add_to_roster_menuitem.set_no_show_all(False)
|
add_to_roster_menuitem.set_no_show_all(False)
|
||||||
edit_groups_menuitem.hide()
|
edit_groups_menuitem.hide()
|
||||||
|
@ -1003,7 +1002,7 @@ class RosterWindow:
|
||||||
assign_openpgp_separator.set_no_show_all(True)
|
assign_openpgp_separator.set_no_show_all(True)
|
||||||
assign_openpgp_key_menuitem.hide()
|
assign_openpgp_key_menuitem.hide()
|
||||||
assign_openpgp_key_menuitem.set_no_show_all(True)
|
assign_openpgp_key_menuitem.set_no_show_all(True)
|
||||||
|
|
||||||
add_to_roster_menuitem.connect('activate',
|
add_to_roster_menuitem.connect('activate',
|
||||||
self.on_add_to_roster, contact, account)
|
self.on_add_to_roster, contact, account)
|
||||||
|
|
||||||
|
@ -1017,7 +1016,7 @@ class RosterWindow:
|
||||||
'''Make group's popup menu'''
|
'''Make group's popup menu'''
|
||||||
model = self.tree.get_model()
|
model = self.tree.get_model()
|
||||||
path = model.get_path(iter)
|
path = model.get_path(iter)
|
||||||
|
|
||||||
menu = gtk.Menu()
|
menu = gtk.Menu()
|
||||||
|
|
||||||
rename_item = gtk.ImageMenuItem(_('Re_name'))
|
rename_item = gtk.ImageMenuItem(_('Re_name'))
|
||||||
|
@ -1028,10 +1027,10 @@ class RosterWindow:
|
||||||
rename_item.connect('activate', self.on_rename, iter, path)
|
rename_item.connect('activate', self.on_rename, iter, path)
|
||||||
|
|
||||||
event_button = self.get_possible_button_event(event)
|
event_button = self.get_possible_button_event(event)
|
||||||
|
|
||||||
menu.popup(None, None, None, event_button, event.time)
|
menu.popup(None, None, None, event_button, event.time)
|
||||||
menu.show_all()
|
menu.show_all()
|
||||||
|
|
||||||
def mk_menu_agent(self, event, iter):
|
def mk_menu_agent(self, event, iter):
|
||||||
'''Make agent's popup menu'''
|
'''Make agent's popup menu'''
|
||||||
model = self.tree.get_model()
|
model = self.tree.get_model()
|
||||||
|
@ -1040,7 +1039,7 @@ class RosterWindow:
|
||||||
account = model[iter][C_ACCOUNT].decode('utf-8')
|
account = model[iter][C_ACCOUNT].decode('utf-8')
|
||||||
user = gajim.get_contact_instance_with_highest_priority(account, jid)
|
user = gajim.get_contact_instance_with_highest_priority(account, jid)
|
||||||
menu = gtk.Menu()
|
menu = gtk.Menu()
|
||||||
|
|
||||||
item = gtk.ImageMenuItem(_('_Log on'))
|
item = gtk.ImageMenuItem(_('_Log on'))
|
||||||
icon = gtk.image_new_from_stock(gtk.STOCK_YES, gtk.ICON_SIZE_MENU)
|
icon = gtk.image_new_from_stock(gtk.STOCK_YES, gtk.ICON_SIZE_MENU)
|
||||||
item.set_image(icon)
|
item.set_image(icon)
|
||||||
|
@ -1085,14 +1084,14 @@ class RosterWindow:
|
||||||
else:
|
else:
|
||||||
gajim.interface.instances[account]['account_modification'] = \
|
gajim.interface.instances[account]['account_modification'] = \
|
||||||
config.AccountModificationWindow(account)
|
config.AccountModificationWindow(account)
|
||||||
|
|
||||||
def get_possible_button_event(self, event):
|
def get_possible_button_event(self, event):
|
||||||
'''mouse or keyboard caused the event?'''
|
'''mouse or keyboard caused the event?'''
|
||||||
if event.type == gtk.gdk.KEY_PRESS:
|
if event.type == gtk.gdk.KEY_PRESS:
|
||||||
event_button = 0 # no event.button so pass 0
|
event_button = 0 # no event.button so pass 0
|
||||||
else: # BUTTON_PRESS event, so pass event.button
|
else: # BUTTON_PRESS event, so pass event.button
|
||||||
event_button = event.button
|
event_button = event.button
|
||||||
|
|
||||||
return event_button
|
return event_button
|
||||||
|
|
||||||
def on_change_status_message_activate(self, widget, account):
|
def on_change_status_message_activate(self, widget, account):
|
||||||
|
@ -1116,7 +1115,7 @@ class RosterWindow:
|
||||||
xml = gtk.glade.XML(GTKGUI_GLADE, 'account_context_menu', APP)
|
xml = gtk.glade.XML(GTKGUI_GLADE, 'account_context_menu', APP)
|
||||||
account_context_menu = xml.get_widget('account_context_menu')
|
account_context_menu = xml.get_widget('account_context_menu')
|
||||||
childs = account_context_menu.get_children()
|
childs = account_context_menu.get_children()
|
||||||
|
|
||||||
status_menuitem = childs[0]
|
status_menuitem = childs[0]
|
||||||
# we skip the seperator
|
# we skip the seperator
|
||||||
# skip advanced_actions_menuitem, childs[2]
|
# skip advanced_actions_menuitem, childs[2]
|
||||||
|
@ -1129,7 +1128,7 @@ class RosterWindow:
|
||||||
add_contact_menuitem = childs[5]
|
add_contact_menuitem = childs[5]
|
||||||
join_group_chat_menuitem = childs[6]
|
join_group_chat_menuitem = childs[6]
|
||||||
new_message_menuitem = childs[7]
|
new_message_menuitem = childs[7]
|
||||||
|
|
||||||
sub_menu = gtk.Menu()
|
sub_menu = gtk.Menu()
|
||||||
status_menuitem.set_submenu(sub_menu)
|
status_menuitem.set_submenu(sub_menu)
|
||||||
|
|
||||||
|
@ -1312,7 +1311,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
self.tree.get_selection().select_path(path)
|
self.tree.get_selection().select_path(path)
|
||||||
|
|
||||||
self.show_appropriate_context_menu(event, iter)
|
self.show_appropriate_context_menu(event, iter)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def on_roster_treeview_button_press_event(self, widget, event):
|
def on_roster_treeview_button_press_event(self, widget, event):
|
||||||
|
@ -1320,7 +1319,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
self.tooltip.hide_tooltip()
|
self.tooltip.hide_tooltip()
|
||||||
if event.button == 3: # Right click
|
if event.button == 3: # Right click
|
||||||
try:
|
try:
|
||||||
path, column, x, y = self.tree.get_path_at_pos(int(event.x),
|
path, column, x, y = self.tree.get_path_at_pos(int(event.x),
|
||||||
int(event.y))
|
int(event.y))
|
||||||
except TypeError:
|
except TypeError:
|
||||||
self.tree.get_selection().unselect_all()
|
self.tree.get_selection().unselect_all()
|
||||||
|
@ -1330,10 +1329,10 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
iter = model.get_iter(path)
|
iter = model.get_iter(path)
|
||||||
self.show_appropriate_context_menu(event, iter)
|
self.show_appropriate_context_menu(event, iter)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if event.button == 2: # Middle click
|
if event.button == 2: # Middle click
|
||||||
try:
|
try:
|
||||||
path, column, x, y = self.tree.get_path_at_pos(int(event.x),
|
path, column, x, y = self.tree.get_path_at_pos(int(event.x),
|
||||||
int(event.y))
|
int(event.y))
|
||||||
except TypeError:
|
except TypeError:
|
||||||
self.tree.get_selection().unselect_all()
|
self.tree.get_selection().unselect_all()
|
||||||
|
@ -1373,10 +1372,10 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
current_show = gajim.SHOW_LIST[gajim.connections[acct].connected]
|
current_show = gajim.SHOW_LIST[gajim.connections[acct].connected]
|
||||||
self.send_status(acct, current_show, message)
|
self.send_status(acct, current_show, message)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if event.button == 1: # Left click
|
if event.button == 1: # Left click
|
||||||
try:
|
try:
|
||||||
path, column, x, y = self.tree.get_path_at_pos(int(event.x),
|
path, column, x, y = self.tree.get_path_at_pos(int(event.x),
|
||||||
int(event.y))
|
int(event.y))
|
||||||
except TypeError:
|
except TypeError:
|
||||||
self.tree.get_selection().unselect_all()
|
self.tree.get_selection().unselect_all()
|
||||||
|
@ -1411,9 +1410,9 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
user1 = Contact(jid = user.jid, name = user.name,
|
user1 = Contact(jid = user.jid, name = user.name,
|
||||||
groups = [_('not in the roster')], show = 'not in the roster',
|
groups = [_('not in the roster')], show = 'not in the roster',
|
||||||
status = '', ask = 'none', keyID = user.keyID)
|
status = '', ask = 'none', keyID = user.keyID)
|
||||||
gajim.contacts[account][user.jid] = [user1]
|
gajim.contacts[account][user.jid] = [user1]
|
||||||
self.add_contact_to_roster(user.jid, account)
|
self.add_contact_to_roster(user.jid, account)
|
||||||
|
|
||||||
def forget_gpg_passphrase(self, keyid):
|
def forget_gpg_passphrase(self, keyid):
|
||||||
if self.gpg_passphrase.has_key(keyid):
|
if self.gpg_passphrase.has_key(keyid):
|
||||||
del self.gpg_passphrase[keyid]
|
del self.gpg_passphrase[keyid]
|
||||||
|
@ -1439,7 +1438,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
passphrase = ''
|
passphrase = ''
|
||||||
w = dialogs.PassphraseDialog(
|
w = dialogs.PassphraseDialog(
|
||||||
_('Password Required'),
|
_('Password Required'),
|
||||||
_('Enter your password for account %s') % account,
|
_('Enter your password for account %s') % account,
|
||||||
_('Save password'))
|
_('Save password'))
|
||||||
passphrase, save = w.run()
|
passphrase, save = w.run()
|
||||||
if passphrase == -1:
|
if passphrase == -1:
|
||||||
|
@ -1460,12 +1459,12 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
if use_gpg_agent:
|
if use_gpg_agent:
|
||||||
save_gpg_pass = False
|
save_gpg_pass = False
|
||||||
else:
|
else:
|
||||||
save_gpg_pass = gajim.config.get_per('accounts', account,
|
save_gpg_pass = gajim.config.get_per('accounts', account,
|
||||||
'savegpgpass')
|
'savegpgpass')
|
||||||
keyid = gajim.config.get_per('accounts', account, 'keyid')
|
keyid = gajim.config.get_per('accounts', account, 'keyid')
|
||||||
if keyid and gajim.connections[account].connected < 2 and \
|
if keyid and gajim.connections[account].connected < 2 and \
|
||||||
gajim.config.get('usegpg'):
|
gajim.config.get('usegpg'):
|
||||||
|
|
||||||
if use_gpg_agent:
|
if use_gpg_agent:
|
||||||
self.gpg_passphrase[keyid] = None
|
self.gpg_passphrase[keyid] = None
|
||||||
else:
|
else:
|
||||||
|
@ -1478,7 +1477,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
else:
|
else:
|
||||||
w = dialogs.PassphraseDialog(
|
w = dialogs.PassphraseDialog(
|
||||||
_('Passphrase Required'),
|
_('Passphrase Required'),
|
||||||
_('Enter GPG key passphrase for account %s') % account,
|
_('Enter GPG key passphrase for account %s') % account,
|
||||||
_('Save passphrase'))
|
_('Save passphrase'))
|
||||||
passphrase, save = w.run()
|
passphrase, save = w.run()
|
||||||
if passphrase == -1:
|
if passphrase == -1:
|
||||||
|
@ -1488,14 +1487,14 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
gobject.timeout_add(30000, self.forget_gpg_passphrase, keyid)
|
gobject.timeout_add(30000, self.forget_gpg_passphrase, keyid)
|
||||||
if save:
|
if save:
|
||||||
gajim.config.set_per('accounts', account, 'savegpgpass', True)
|
gajim.config.set_per('accounts', account, 'savegpgpass', True)
|
||||||
gajim.config.set_per('accounts', account, 'gpgpassword',
|
gajim.config.set_per('accounts', account, 'gpgpassword',
|
||||||
passphrase)
|
passphrase)
|
||||||
gajim.connections[account].gpg_passphrase(passphrase)
|
gajim.connections[account].gpg_passphrase(passphrase)
|
||||||
|
|
||||||
for room_jid in gajim.interface.instances[account]['gc']:
|
for room_jid in gajim.interface.instances[account]['gc']:
|
||||||
if room_jid != 'tabbed':
|
if room_jid != 'tabbed':
|
||||||
nick = gajim.interface.instances[account]['gc'][room_jid].nicks[room_jid]
|
nick = gajim.interface.instances[account]['gc'][room_jid].nicks[room_jid]
|
||||||
gajim.connections[account].send_gc_status(nick, room_jid, status,
|
gajim.connections[account].send_gc_status(nick, room_jid, status,
|
||||||
txt)
|
txt)
|
||||||
gajim.connections[account].change_status(status, txt, sync, auto)
|
gajim.connections[account].change_status(status, txt, sync, auto)
|
||||||
if status == 'online' and gajim.interface.sleeper.getState() != \
|
if status == 'online' and gajim.interface.sleeper.getState() != \
|
||||||
|
@ -1573,7 +1572,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
bug_user = False
|
bug_user = False
|
||||||
for acct in accounts:
|
for acct in accounts:
|
||||||
if not one_connected or gajim.connections[acct].connected > 1:
|
if not one_connected or gajim.connections[acct].connected > 1:
|
||||||
if not gajim.config.get_per('accounts', acct,
|
if not gajim.config.get_per('accounts', acct,
|
||||||
'sync_with_global_status'):
|
'sync_with_global_status'):
|
||||||
continue
|
continue
|
||||||
# We're going to change our status to invisible
|
# We're going to change our status to invisible
|
||||||
|
@ -1599,7 +1598,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
if not one_connected or gajim.connections[acct].connected > 1:
|
if not one_connected or gajim.connections[acct].connected > 1:
|
||||||
self.send_status(acct, status, message)
|
self.send_status(acct, status, message)
|
||||||
self.update_status_combobox()
|
self.update_status_combobox()
|
||||||
|
|
||||||
def update_status_combobox(self):
|
def update_status_combobox(self):
|
||||||
# table to change index in connection.connected to index in combobox
|
# table to change index in connection.connected to index in combobox
|
||||||
table = {'offline':9, 'connecting':9, 'online':0, 'chat':1, 'away':2,
|
table = {'offline':9, 'connecting':9, 'online':0, 'chat':1, 'away':2,
|
||||||
|
@ -1633,7 +1632,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
self.chg_contact_status(user, 'offline', 'Disconnected', account)
|
self.chg_contact_status(user, 'offline', 'Disconnected', account)
|
||||||
self.update_status_combobox()
|
self.update_status_combobox()
|
||||||
self.make_menu()
|
self.make_menu()
|
||||||
|
|
||||||
def new_chat(self, contact, account):
|
def new_chat(self, contact, account):
|
||||||
chats = gajim.interface.instances[account]['chats']
|
chats = gajim.interface.instances[account]['chats']
|
||||||
if gajim.config.get('usetabbedchat'):
|
if gajim.config.get('usetabbedchat'):
|
||||||
|
@ -1661,7 +1660,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
groups = [_('not in the roster')], show = 'not in the roster',
|
groups = [_('not in the roster')], show = 'not in the roster',
|
||||||
status = '', sub = 'none', keyID = keyID)
|
status = '', sub = 'none', keyID = keyID)
|
||||||
gajim.contacts[account][jid] = [contact]
|
gajim.contacts[account][jid] = [contact]
|
||||||
self.add_contact_to_roster(contact.jid, account)
|
self.add_contact_to_roster(contact.jid, account)
|
||||||
|
|
||||||
if not gajim.interface.instances[account]['chats'].has_key(jid):
|
if not gajim.interface.instances[account]['chats'].has_key(jid):
|
||||||
self.new_chat(contact, account)
|
self.new_chat(contact, account)
|
||||||
|
@ -1693,7 +1692,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
user1 = Contact(jid = jid, name = jid.split('@')[0],
|
user1 = Contact(jid = jid, name = jid.split('@')[0],
|
||||||
groups = [_('not in the roster')], show = 'not in the roster',
|
groups = [_('not in the roster')], show = 'not in the roster',
|
||||||
status = '', ask = 'none', keyID = keyID, resource = resource)
|
status = '', ask = 'none', keyID = keyID, resource = resource)
|
||||||
gajim.contacts[account][jid] = [user1]
|
gajim.contacts[account][jid] = [user1]
|
||||||
self.add_contact_to_roster(jid, account)
|
self.add_contact_to_roster(jid, account)
|
||||||
|
|
||||||
iters = self.get_contact_iter(jid, account)
|
iters = self.get_contact_iter(jid, account)
|
||||||
|
@ -1721,7 +1720,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
action = 'receive', from_whom = jid, subject = subject,
|
action = 'receive', from_whom = jid, subject = subject,
|
||||||
message = msg, resource = resource)
|
message = msg, resource = resource)
|
||||||
return
|
return
|
||||||
|
|
||||||
# We print if window is opened and it's not a single message
|
# We print if window is opened and it's not a single message
|
||||||
if gajim.interface.instances[account]['chats'].has_key(jid) and \
|
if gajim.interface.instances[account]['chats'].has_key(jid) and \
|
||||||
msg_type != 'normal':
|
msg_type != 'normal':
|
||||||
|
@ -1792,10 +1791,10 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
|
|
||||||
def on_new_message_menuitem_activate(self, widget, account):
|
def on_new_message_menuitem_activate(self, widget, account):
|
||||||
dialogs.NewMessageDialog(account)
|
dialogs.NewMessageDialog(account)
|
||||||
|
|
||||||
def on_contents_menuitem_activate(self, widget):
|
def on_contents_menuitem_activate(self, widget):
|
||||||
helpers.launch_browser_mailer('url', 'http://trac.gajim.org/wiki')
|
helpers.launch_browser_mailer('url', 'http://trac.gajim.org/wiki')
|
||||||
|
|
||||||
def on_faq_menuitem_activate(self, widget):
|
def on_faq_menuitem_activate(self, widget):
|
||||||
helpers.launch_browser_mailer('url', 'http://trac.gajim.org/wiki/GajimFaq')
|
helpers.launch_browser_mailer('url', 'http://trac.gajim.org/wiki/GajimFaq')
|
||||||
|
|
||||||
|
@ -1806,7 +1805,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
if gajim.interface.instances.has_key('accounts'):
|
if gajim.interface.instances.has_key('accounts'):
|
||||||
gajim.interface.instances['accounts'].window.present()
|
gajim.interface.instances['accounts'].window.present()
|
||||||
else:
|
else:
|
||||||
gajim.interface.instances['accounts'] = config.AccountsWindow()
|
gajim.interface.instances['accounts'] = config.AccountsWindow()
|
||||||
|
|
||||||
def on_file_transfers_menuitem_activate(self, widget):
|
def on_file_transfers_menuitem_activate(self, widget):
|
||||||
if gajim.interface.instances['file_transfers'].window.get_property('visible'):
|
if gajim.interface.instances['file_transfers'].window.get_property('visible'):
|
||||||
|
@ -1824,7 +1823,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
self.close_all(w)
|
self.close_all(w)
|
||||||
else:
|
else:
|
||||||
w.window.destroy()
|
w.window.destroy()
|
||||||
|
|
||||||
def on_roster_window_delete_event(self, widget, event):
|
def on_roster_window_delete_event(self, widget, event):
|
||||||
'''When we want to close the window'''
|
'''When we want to close the window'''
|
||||||
if gajim.interface.systray_enabled and not gajim.config.get('quit_on_roster_x_button'):
|
if gajim.interface.systray_enabled and not gajim.config.get('quit_on_roster_x_button'):
|
||||||
|
@ -1854,7 +1853,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
if gtk.gtk_version >= (2, 8, 0) and gtk.pygtk_version >= (2, 8, 0):
|
if gtk.gtk_version >= (2, 8, 0) and gtk.pygtk_version >= (2, 8, 0):
|
||||||
if widget.props.urgency_hint:
|
if widget.props.urgency_hint:
|
||||||
widget.props.urgency_hint = False
|
widget.props.urgency_hint = False
|
||||||
|
|
||||||
# if a contact row is selected, update colors (eg. for status msg)
|
# if a contact row is selected, update colors (eg. for status msg)
|
||||||
# because gtk engines may differ in bg when window is selected
|
# because gtk engines may differ in bg when window is selected
|
||||||
# or not
|
# or not
|
||||||
|
@ -1942,7 +1941,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
return
|
return
|
||||||
|
|
||||||
if recent:
|
if recent:
|
||||||
dialog = dialogs.ConfirmationDialog(_('You have unread messages'),
|
dialog = dialogs.ConfirmationDialog(_('You have unread messages'),
|
||||||
_('Messages will only be available for reading them later if you have history enabled.'))
|
_('Messages will only be available for reading them later if you have history enabled.'))
|
||||||
if dialog.get_response() != gtk.RESPONSE_OK:
|
if dialog.get_response() != gtk.RESPONSE_OK:
|
||||||
return
|
return
|
||||||
|
@ -2060,7 +2059,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
''' start editing a cell in the tree '''
|
''' start editing a cell in the tree '''
|
||||||
path = self.tree.get_cursor()[0]
|
path = self.tree.get_cursor()[0]
|
||||||
self.editing_path = path
|
self.editing_path = path
|
||||||
|
|
||||||
def on_editing_canceled(self, cell):
|
def on_editing_canceled(self, cell):
|
||||||
'''editing has been canceled'''
|
'''editing has been canceled'''
|
||||||
path = self.tree.get_cursor()[0]
|
path = self.tree.get_cursor()[0]
|
||||||
|
@ -2121,10 +2120,10 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
user.groups.remove(old_name)
|
user.groups.remove(old_name)
|
||||||
user.groups.append(new_text)
|
user.groups.append(new_text)
|
||||||
self.add_contact_to_roster(user.jid, account)
|
self.add_contact_to_roster(user.jid, account)
|
||||||
gajim.connections[account].update_contact(user.jid, user.name,
|
gajim.connections[account].update_contact(user.jid, user.name,
|
||||||
user.groups)
|
user.groups)
|
||||||
model.set_value(iter, 5, False)
|
model.set_value(iter, 5, False)
|
||||||
|
|
||||||
def on_service_disco_menuitem_activate(self, widget, account):
|
def on_service_disco_menuitem_activate(self, widget, account):
|
||||||
server_jid = gajim.config.get_per('accounts', account, 'hostname')
|
server_jid = gajim.config.get_per('accounts', account, 'hostname')
|
||||||
if gajim.interface.instances[account]['disco'].has_key(server_jid):
|
if gajim.interface.instances[account]['disco'].has_key(server_jid):
|
||||||
|
@ -2142,7 +2141,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
'dnd', 'invisible', 'offline', 'error', 'requested',
|
'dnd', 'invisible', 'offline', 'error', 'requested',
|
||||||
'message', 'opened', 'closed', 'not in the roster',
|
'message', 'opened', 'closed', 'not in the roster',
|
||||||
'muc_active'):
|
'muc_active'):
|
||||||
|
|
||||||
# try to open a pixfile with the correct method
|
# try to open a pixfile with the correct method
|
||||||
state_file = state.replace(' ', '_')
|
state_file = state.replace(' ', '_')
|
||||||
files = []
|
files = []
|
||||||
|
@ -2185,7 +2184,8 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
# Update opened chat windows
|
# Update opened chat windows
|
||||||
for jid in gajim.interface.instances[account]['chats']:
|
for jid in gajim.interface.instances[account]['chats']:
|
||||||
if jid != 'tabbed':
|
if jid != 'tabbed':
|
||||||
gajim.interface.instances[account]['chats'][jid].set_state_image(jid)
|
gajim.interface.instances[account]['chats'][jid].set_state_image(
|
||||||
|
jid)
|
||||||
# Update opened groupchat windows
|
# Update opened groupchat windows
|
||||||
gcs = gajim.interface.instances[account]['gc']
|
gcs = gajim.interface.instances[account]['gc']
|
||||||
if gcs.has_key('tabbed'):
|
if gcs.has_key('tabbed'):
|
||||||
|
@ -2244,7 +2244,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
renderer.set_property('cell-background', None)
|
renderer.set_property('cell-background', None)
|
||||||
renderer.set_property('xalign', 1)
|
renderer.set_property('xalign', 1)
|
||||||
renderer.set_property('width', 20)
|
renderer.set_property('width', 20)
|
||||||
|
|
||||||
def nameCellDataFunc(self, column, renderer, model, iter, data = None):
|
def nameCellDataFunc(self, column, renderer, model, iter, data = None):
|
||||||
'''When a row is added, set properties for name renderer'''
|
'''When a row is added, set properties for name renderer'''
|
||||||
theme = gajim.config.get('roster_theme')
|
theme = gajim.config.get('roster_theme')
|
||||||
|
@ -2259,7 +2259,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
renderer.set_property('cell-background', color)
|
renderer.set_property('cell-background', color)
|
||||||
else:
|
else:
|
||||||
renderer.set_property('cell-background', None)
|
renderer.set_property('cell-background', None)
|
||||||
renderer.set_property('font',
|
renderer.set_property('font',
|
||||||
gtkgui_helpers.get_theme_font_for_option(theme, 'accountfont'))
|
gtkgui_helpers.get_theme_font_for_option(theme, 'accountfont'))
|
||||||
renderer.set_property('xpad', 0)
|
renderer.set_property('xpad', 0)
|
||||||
renderer.set_property('width', 3)
|
renderer.set_property('width', 3)
|
||||||
|
@ -2468,7 +2468,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
elif self.nb_unread == 1:
|
elif self.nb_unread == 1:
|
||||||
start = '* '
|
start = '* '
|
||||||
self.window.set_title(start + 'Gajim')
|
self.window.set_title(start + 'Gajim')
|
||||||
|
|
||||||
gtkgui_helpers.set_unset_urgency_hint(self.window, self.nb_unread)
|
gtkgui_helpers.set_unset_urgency_hint(self.window, self.nb_unread)
|
||||||
|
|
||||||
def iter_is_separator(self, model, iter):
|
def iter_is_separator(self, model, iter):
|
||||||
|
@ -2520,7 +2520,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
self.tree = self.xml.get_widget('roster_treeview')
|
self.tree = self.xml.get_widget('roster_treeview')
|
||||||
self.tree.get_selection().connect('changed',
|
self.tree.get_selection().connect('changed',
|
||||||
self._on_treeview_selection_changed)
|
self._on_treeview_selection_changed)
|
||||||
|
|
||||||
self._last_selected_contact = None # None or holds jid, account tupple
|
self._last_selected_contact = None # None or holds jid, account tupple
|
||||||
self.nb_unread = 0
|
self.nb_unread = 0
|
||||||
self.last_save_dir = None
|
self.last_save_dir = None
|
||||||
|
@ -2551,14 +2551,14 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
model.set_sort_column_id(1, gtk.SORT_ASCENDING)
|
model.set_sort_column_id(1, gtk.SORT_ASCENDING)
|
||||||
self.tree.set_model(model)
|
self.tree.set_model(model)
|
||||||
self.make_jabber_state_images()
|
self.make_jabber_state_images()
|
||||||
|
|
||||||
#FIXME: why do we init this dict of dicts here?
|
#FIXME: why do we init this dict of dicts here?
|
||||||
#for loop below does it. maybe so we're sure we always have the keys?
|
#for loop below does it. maybe so we're sure we always have the keys?
|
||||||
#eventhough childs can be empty? I don't get it
|
#eventhough childs can be empty? I don't get it
|
||||||
self.transports_state_images = { 'aim': {}, 'gadugadu': {}, 'irc': {},
|
self.transports_state_images = { 'aim': {}, 'gadugadu': {}, 'irc': {},
|
||||||
'icq': {}, 'msn': {}, 'sms': {}, 'tlen': {}, 'weather': {},
|
'icq': {}, 'msn': {}, 'sms': {}, 'tlen': {}, 'weather': {},
|
||||||
'yahoo': {} }
|
'yahoo': {} }
|
||||||
|
|
||||||
path = os.path.join(gajim.DATA_DIR, 'iconsets', 'transports')
|
path = os.path.join(gajim.DATA_DIR, 'iconsets', 'transports')
|
||||||
folders = os.listdir(path)
|
folders = os.listdir(path)
|
||||||
for transport in folders:
|
for transport in folders:
|
||||||
|
@ -2574,7 +2574,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
|
|
||||||
cell = cell_renderer_image.CellRendererImage()
|
cell = cell_renderer_image.CellRendererImage()
|
||||||
self.status_combobox.pack_start(cell, False)
|
self.status_combobox.pack_start(cell, False)
|
||||||
|
|
||||||
# img to show is in in 2nd column of liststore
|
# img to show is in in 2nd column of liststore
|
||||||
self.status_combobox.add_attribute(cell, 'image', 1)
|
self.status_combobox.add_attribute(cell, 'image', 1)
|
||||||
# if it will be sensitive or not it is in the fourth column
|
# if it will be sensitive or not it is in the fourth column
|
||||||
|
@ -2610,15 +2610,15 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
uf_show = helpers.get_uf_show('offline')
|
uf_show = helpers.get_uf_show('offline')
|
||||||
liststore.append([uf_show, self.jabber_state_images['offline'],
|
liststore.append([uf_show, self.jabber_state_images['offline'],
|
||||||
'offline', True])
|
'offline', True])
|
||||||
|
|
||||||
status_combobox_items = ['online', 'chat', 'away', 'xa', 'dnd', 'invisible',
|
status_combobox_items = ['online', 'chat', 'away', 'xa', 'dnd', 'invisible',
|
||||||
'separator1', 'change_status_msg', 'separator2', 'offline']
|
'separator1', 'change_status_msg', 'separator2', 'offline']
|
||||||
self.status_combobox.set_model(liststore)
|
self.status_combobox.set_model(liststore)
|
||||||
|
|
||||||
# default to offline
|
# default to offline
|
||||||
number_of_menuitem = status_combobox_items.index('offline')
|
number_of_menuitem = status_combobox_items.index('offline')
|
||||||
self.status_combobox.set_active(number_of_menuitem)
|
self.status_combobox.set_active(number_of_menuitem)
|
||||||
|
|
||||||
# holds index to previously selected item so if "change status message..."
|
# holds index to previously selected item so if "change status message..."
|
||||||
# is selected we can fallback to previously selected item and not stay
|
# is selected we can fallback to previously selected item and not stay
|
||||||
# with that item selected
|
# with that item selected
|
||||||
|
@ -2629,10 +2629,10 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
showOffline)
|
showOffline)
|
||||||
|
|
||||||
# columns
|
# columns
|
||||||
|
|
||||||
# this col has two cells: first one img, second one text
|
# this col has two cells: first one img, second one text
|
||||||
col = gtk.TreeViewColumn()
|
col = gtk.TreeViewColumn()
|
||||||
|
|
||||||
render_image = cell_renderer_image.CellRendererImage() # show img or +-
|
render_image = cell_renderer_image.CellRendererImage() # show img or +-
|
||||||
col.pack_start(render_image, expand = False)
|
col.pack_start(render_image, expand = False)
|
||||||
col.add_attribute(render_image, 'image', C_IMG)
|
col.add_attribute(render_image, 'image', C_IMG)
|
||||||
|
@ -2646,7 +2646,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
col.add_attribute(render_text, 'markup', C_NAME) # where we hold the name
|
col.add_attribute(render_text, 'markup', C_NAME) # where we hold the name
|
||||||
col.add_attribute(render_text, 'editable', C_EDITABLE) # where we hold if the row is editable
|
col.add_attribute(render_text, 'editable', C_EDITABLE) # where we hold if the row is editable
|
||||||
col.set_cell_data_func(render_text, self.nameCellDataFunc, None)
|
col.set_cell_data_func(render_text, self.nameCellDataFunc, None)
|
||||||
|
|
||||||
render_pixbuf = gtk.CellRendererPixbuf() # tls or avatar img
|
render_pixbuf = gtk.CellRendererPixbuf() # tls or avatar img
|
||||||
col.pack_start(render_pixbuf, expand = False)
|
col.pack_start(render_pixbuf, expand = False)
|
||||||
col.add_attribute(render_pixbuf, 'pixbuf', C_SECPIXBUF)
|
col.add_attribute(render_pixbuf, 'pixbuf', C_SECPIXBUF)
|
||||||
|
@ -2654,7 +2654,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
None)
|
None)
|
||||||
|
|
||||||
self.tree.append_column(col)
|
self.tree.append_column(col)
|
||||||
|
|
||||||
#do not show gtk arrows workaround
|
#do not show gtk arrows workaround
|
||||||
col = gtk.TreeViewColumn()
|
col = gtk.TreeViewColumn()
|
||||||
render_pixbuf = gtk.CellRendererPixbuf()
|
render_pixbuf = gtk.CellRendererPixbuf()
|
||||||
|
|
|
@ -296,7 +296,8 @@ class SystrayWin32(systray.Systray):
|
||||||
self.systray_winapi.notify_icon.set_tooltip(text)
|
self.systray_winapi.notify_icon.set_tooltip(text)
|
||||||
|
|
||||||
def set_img(self):
|
def set_img(self):
|
||||||
self.tray_ico_imgs = self.load_icos()
|
self.tray_ico_imgs = self.load_icos() #FIXME: do not do this here
|
||||||
|
# see gajim.interface.roster.reload_jabber_state_images() to merge
|
||||||
self.systray_winapi.remove_notify_icon()
|
self.systray_winapi.remove_notify_icon()
|
||||||
if len(self.jids) > 0:
|
if len(self.jids) > 0:
|
||||||
state = 'message'
|
state = 'message'
|
||||||
|
|
Loading…
Reference in New Issue