Trying to fix PM regression since merge

This commit is contained in:
Travis Shirk 2006-01-08 07:50:26 +00:00
parent bafcaace1e
commit e53e786182
6 changed files with 36 additions and 21 deletions

View File

@ -155,5 +155,11 @@ tags:
-rm tags -rm tags
exuberant-ctags -R exuberant-ctags -R
sloccount:
if test -n "`which sloccount`"; then\
sloccount ./src;\
sloccount --cached --details ./src;\
fi
.PHONY: all translation trayicon gtkspell idle clean dist install help\ .PHONY: all translation trayicon gtkspell idle clean dist install help\
uninstall tags uninstall tags sloccount

View File

@ -744,9 +744,8 @@ class ChatControl(ChatControlBase):
ChatControlBase.draw_widgets(self) ChatControlBase.draw_widgets(self)
def _update_banner_state_image(self): def _update_banner_state_image(self):
# FIXME: The cyling of contact_list ... is this necessary if I have the contact contact = gajim.contacts.get_contact_with_highest_priority(self.account,
# This will need to be triumphant when sending directly to a resource self.contact.jid)
contact = self.contact
show = contact.show show = contact.show
jid = contact.jid jid = contact.jid
@ -1030,7 +1029,9 @@ class ChatControl(ChatControlBase):
if num_unread and gajim.config.get('show_unread_tab_icon'): if num_unread and gajim.config.get('show_unread_tab_icon'):
tab_img = img_16['message'] tab_img = img_16['message']
else: else:
tab_img = img_16[self.contact.show] contact = gajim.contacts.get_contact_with_highest_priority(self.account,
self.contact.jid)
tab_img = img_16[contact.show]
return tab_img return tab_img
@ -1407,7 +1408,6 @@ class ChatControl(ChatControlBase):
gajim.interface.roster.on_info(widget, self.contact, self.account) gajim.interface.roster.on_info(widget, self.contact, self.account)
def on_toggle_gpg_menuitem_activate(self, widget): def on_toggle_gpg_menuitem_activate(self, widget):
print "toggling"
jid = self.get_active_jid() jid = self.get_active_jid()
tb = self.xml.get_widget('gpg_togglebutton') tb = self.xml.get_widget('gpg_togglebutton')
tb.set_active(not tb.get_active()) tb.set_active(not tb.get_active())

View File

@ -99,6 +99,7 @@ class Contacts:
def create_contact(self, jid='', name='', groups=[], show='', status='', def create_contact(self, jid='', name='', groups=[], show='', status='',
sub='', ask='', resource='', priority=5, keyID='', our_chatstate=None, sub='', ask='', resource='', priority=5, keyID='', our_chatstate=None,
chatstate=None): chatstate=None):
print "Creating contact:", jid
return Contact(jid, name, groups, show, status, sub, ask, resource, return Contact(jid, name, groups, show, status, sub, ask, resource,
priority, keyID, our_chatstate, chatstate) priority, keyID, our_chatstate, chatstate)
@ -110,6 +111,7 @@ class Contacts:
our_chatstate = contact.our_chatstate, chatstate = contact.chatstate) our_chatstate = contact.our_chatstate, chatstate = contact.chatstate)
def add_contact(self, account, contact): def add_contact(self, account, contact):
print "Adding contact:", contact.jid
# No such account before ? # No such account before ?
if not self._contacts.has_key(account): if not self._contacts.has_key(account):
self._contacts[account] = {contact.jid : [contact]} self._contacts[account] = {contact.jid : [contact]}
@ -130,6 +132,7 @@ class Contacts:
contacts.append(contact) contacts.append(contact)
def remove_contact(self, account, contact): def remove_contact(self, account, contact):
print "Removing contact:", contact.jid
if not self._contacts.has_key(account): if not self._contacts.has_key(account):
return return
if not self._contacts[account].has_key(contact.jid): if not self._contacts[account].has_key(contact.jid):
@ -138,6 +141,7 @@ class Contacts:
self._contacts[account][contact.jid].remove(contact) self._contacts[account][contact.jid].remove(contact)
def remove_jid(self, account, jid): def remove_jid(self, account, jid):
print "Adding jid:", jid
'''Removes all contacts for a given jid''' '''Removes all contacts for a given jid'''
if not self._contacts.has_key(account): if not self._contacts.has_key(account):
return return
@ -165,7 +169,7 @@ class Contacts:
def get_contacts_from_jid(self, account, jid): def get_contacts_from_jid(self, account, jid):
''' we may have two or more resources on that jid ''' ''' we may have two or more resources on that jid '''
if jid in self._contacts[account]: if jid in self._contacts[account].keys():
contacts_instances = self._contacts[account][jid] contacts_instances = self._contacts[account][jid]
return contacts_instances return contacts_instances
return [] return []
@ -175,12 +179,14 @@ class Contacts:
return None return None
prim_contact = contacts[0] prim_contact = contacts[0]
for contact in contacts[1:]: for contact in contacts[1:]:
print "checking priority of", contact.jid
if int(contact.priority) > int(prim_contact.priority): if int(contact.priority) > int(prim_contact.priority):
prim_contact = contact prim_contact = contact
return prim_contact return prim_contact
def get_contact_with_highest_priority(self, account, jid): def get_contact_with_highest_priority(self, account, jid):
contacts = self.get_contacts_from_jid(account, jid) contacts = self.get_contacts_from_jid(account, jid)
print "contacts:", contacts
return self.get_highest_prio_contact_from_contacts(contacts) return self.get_highest_prio_contact_from_contacts(contacts)
def get_first_contact_from_jid(self, account, jid): def get_first_contact_from_jid(self, account, jid):
@ -235,10 +241,12 @@ class Contacts:
def create_gc_contact(self, room_jid='', name='', show='', status='', def create_gc_contact(self, room_jid='', name='', show='', status='',
role='', affiliation='', jid='', resource=''): role='', affiliation='', jid='', resource=''):
print "Creating GC contact:", room_jid, jid
return GC_Contact(room_jid, name, show, status, role, affiliation, jid, return GC_Contact(room_jid, name, show, status, role, affiliation, jid,
resource) resource)
def add_gc_contact(self, account, gc_contact): def add_gc_contact(self, account, gc_contact):
print "Adding GC contact:", gc_contact.room_jid
# No such account before ? # No such account before ?
if not self._gc_contacts.has_key(account): if not self._gc_contacts.has_key(account):
self._contacts[account] = {gc_contact.room_jid : {gc_contact.name: \ self._contacts[account] = {gc_contact.room_jid : {gc_contact.name: \
@ -253,6 +261,7 @@ class Contacts:
gc_contact gc_contact
def remove_gc_contact(self, account, gc_contact): def remove_gc_contact(self, account, gc_contact):
print "Adding GC contact:", gc_contact.room_jid
if not self._gc_contacts.has_key(account): if not self._gc_contacts.has_key(account):
return return
if not self._gc_contacts[account].has_key(gc_contact.room_jid): if not self._gc_contacts[account].has_key(gc_contact.room_jid):
@ -266,6 +275,7 @@ class Contacts:
del self._gc_contacts[account][gc_contact.room_jid] del self._gc_contacts[account][gc_contact.room_jid]
def remove_room(self, account, room_jid): def remove_room(self, account, room_jid):
print "Removing room:", room_jid
if not self._gc_contacts.has_key(account): if not self._gc_contacts.has_key(account):
return return
if not self._gc_contacts[account].has_key(room_jid): if not self._gc_contacts[account].has_key(room_jid):

View File

@ -560,7 +560,6 @@ class GroupchatControl(ChatControlBase):
def draw_roster(self): def draw_roster(self):
model = self.list_treeview.get_model() model = self.list_treeview.get_model()
model.clear() model.clear()
print "draw_roster"
for nick in gajim.contacts.get_nick_list(self.account, self.room_jid): for nick in gajim.contacts.get_nick_list(self.account, self.room_jid):
gc_contact = gajim.contacts.get_gc_contact(self.account, self.room_jid, nick) gc_contact = gajim.contacts.get_gc_contact(self.account, self.room_jid, nick)
self.add_contact_to_roster(nick, gc_contact.show, gc_contact.role, self.add_contact_to_roster(nick, gc_contact.show, gc_contact.role,

View File

@ -381,9 +381,9 @@ class MessageWindow:
def popup_menu(self, event): def popup_menu(self, event):
menu = self.get_active_control().prepare_context_menu() menu = self.get_active_control().prepare_context_menu()
# common menuitems (tab switches) # common menuitems (tab switches)
if len(self.controls) > 1: # if there is more than one tab if len(self._controls) > 1: # if there is more than one tab
menu.append(gtk.SeparatorMenuItem()) # seperator menu.append(gtk.SeparatorMenuItem()) # seperator
for ctl in self.controls.values(): for ctl in self._controls.values():
jid = ctl.contact.jid jid = ctl.contact.jid
if jid != self.get_active_jid(): if jid != self.get_active_jid():
item = gtk.ImageMenuItem(_('Switch to %s') %\ item = gtk.ImageMenuItem(_('Switch to %s') %\

View File

@ -2102,7 +2102,7 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
self.collapsed_rows.append(account) self.collapsed_rows.append(account)
def on_editing_started(self, cell, event, row): def on_editing_started(self, cell, event, row):
''' 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