Fixes #1495
This commit is contained in:
parent
029d4838b8
commit
44700c12da
|
@ -680,6 +680,14 @@ class ChatControlBase(MessageControl):
|
|||
widget.set_no_show_all(False)
|
||||
widget.show_all()
|
||||
|
||||
def got_connected(self):
|
||||
self.msg_textview.set_sensitive(True)
|
||||
self.xml.get_widget('send_button').set_sensitive(True)
|
||||
|
||||
def got_disconnected(self):
|
||||
self.msg_textview.set_sensitive(False)
|
||||
self.xml.get_widget('send_button').set_sensitive(False)
|
||||
|
||||
################################################################################
|
||||
class ChatControl(ChatControlBase):
|
||||
'''A control for standard 1-1 chat'''
|
||||
|
@ -1454,3 +1462,10 @@ class ChatControl(ChatControlBase):
|
|||
def _on_toggle_gpg_menuitem_activate(self, widget):
|
||||
tb = self.xml.get_widget('gpg_togglebutton')
|
||||
tb.set_active(not tb.get_active())
|
||||
|
||||
def got_connected(self):
|
||||
ChatControlBase.got_connected(self)
|
||||
# Refreshing contact
|
||||
self.contact = gajim.contacts.get_contact_with_highest_priority(self.account,
|
||||
self.contact.jid)
|
||||
self.draw_banner()
|
||||
|
|
27
src/gajim.py
27
src/gajim.py
|
@ -270,19 +270,26 @@ class Interface:
|
|||
#('STATUS', account, status)
|
||||
model = self.roster.status_combobox.get_model()
|
||||
if status == 'offline':
|
||||
model[self.roster.status_message_menuitem_iter][3] = False # sensitivity for this menuitem
|
||||
# sensitivity for this menuitem
|
||||
model[self.roster.status_message_menuitem_iter][3] = False
|
||||
gajim.allow_notifications[account] = False
|
||||
# we are disconnected from all gc
|
||||
if not gajim.gc_connected.has_key(account):
|
||||
return
|
||||
for room_jid in gajim.gc_connected[account]:
|
||||
gc_control = gajim.interface.msg_win_mgr.get_control(room_jid, account)
|
||||
if gc_control:
|
||||
gc_control.got_disconnected()
|
||||
gc_control.parent_win.redraw_tab(gc_control)
|
||||
|
||||
else:
|
||||
gobject.timeout_add(30000, self.allow_notif, account)
|
||||
model[self.roster.status_message_menuitem_iter][3] = True # sensitivity for this menuitem
|
||||
# sensitivity for this menuitem
|
||||
model[self.roster.status_message_menuitem_iter][3] = True
|
||||
|
||||
# Inform all controls for this account of the connection state change
|
||||
for ctrl in gajim.interface.msg_win_mgr.controls():
|
||||
if ctrl.account == account:
|
||||
if status == 'offline':
|
||||
ctrl.got_disconnected()
|
||||
else:
|
||||
# Other code rejoins all GCs, so we don't do it here
|
||||
if not ctrl.type_id == message_control.TYPE_GC:
|
||||
ctrl.got_connected()
|
||||
ctrl.parent_win.redraw_tab(ctrl)
|
||||
|
||||
self.roster.on_status_changed(account, status)
|
||||
if account in self.show_vcard_when_connect:
|
||||
jid = gajim.get_jid_from_account(account)
|
||||
|
|
|
@ -534,26 +534,22 @@ class GroupchatControl(ChatControlBase):
|
|||
|
||||
def got_connected(self):
|
||||
gajim.gc_connected[self.account][self.room_jid] = True
|
||||
self.msg_textview.set_sensitive(True)
|
||||
self.xml.get_widget('send_button').set_sensitive(True)
|
||||
ChatControlBase.got_connected(self)
|
||||
|
||||
def got_disconnected(self):
|
||||
model = self.list_treeview.get_model()
|
||||
model.clear()
|
||||
self.list_treeview.get_model().clear()
|
||||
nick_list = gajim.contacts.get_nick_list(self.account, self.room_jid)
|
||||
for nick in nick_list:
|
||||
gc_contact = gajim.contacts.get_gc_contact(self.account, self.room_jid,
|
||||
nick)
|
||||
gajim.contacts.remove_gc_contact(self.account, gc_contact)
|
||||
gajim.gc_connected[self.account][self.room_jid] = False
|
||||
self.msg_textview.set_sensitive(False)
|
||||
self.xml.get_widget('send_button').set_sensitive(False)
|
||||
# Note, since this method is called during initialization it is NOT safe
|
||||
# to call self.parent_win.redraw_tab here
|
||||
ChatControlBase.got_disconnected(self)
|
||||
|
||||
def draw_roster(self):
|
||||
model = self.list_treeview.get_model()
|
||||
model.clear()
|
||||
self.list_treeview.get_model().clear()
|
||||
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)
|
||||
self.add_contact_to_roster(nick, gc_contact.show, gc_contact.role,
|
||||
|
|
|
@ -115,6 +115,11 @@ class MessageControl:
|
|||
# NOTE: Derived classes MAY implement this
|
||||
self.compact_view_current = state
|
||||
|
||||
def got_connected(self):
|
||||
pass
|
||||
def got_disconnected(self):
|
||||
pass
|
||||
|
||||
def get_specific_unread(self):
|
||||
n = 0
|
||||
if gajim.awaiting_events[self.account].has_key(self.contact.jid):
|
||||
|
|
Loading…
Reference in New Issue