now sensitivity on/off for change status menuitem works ok
This commit is contained in:
parent
fbc668841e
commit
f5089a8c69
2 changed files with 21 additions and 19 deletions
24
src/gajim.py
24
src/gajim.py
|
@ -230,16 +230,20 @@ class Interface:
|
||||||
def allow_notif(self, account):
|
def allow_notif(self, account):
|
||||||
gajim.allow_notifications[account] = True
|
gajim.allow_notifications[account] = True
|
||||||
|
|
||||||
|
|
||||||
def handle_event_status(self, account, status): # OUR status
|
def handle_event_status(self, account, status): # OUR status
|
||||||
#('STATUS', account, status)
|
#('STATUS', account, status)
|
||||||
if status != 'offline':
|
model = self.roster.status_combobox.get_model()
|
||||||
gobject.timeout_add(30000, self.allow_notif, account)
|
if status == 'offline':
|
||||||
else:
|
model[self.roster.status_message_menuitem_iter][3] = False # sensitivity for this menuitem
|
||||||
gajim.allow_notifications[account] = False
|
gajim.allow_notifications[account] = False
|
||||||
# we are disconnected from all gc
|
# we are disconnected from all gc
|
||||||
for room_jid in gajim.gc_connected[account]:
|
for room_jid in gajim.gc_connected[account]:
|
||||||
if self.windows[account]['gc'].has_key(room_jid):
|
if self.windows[account]['gc'].has_key(room_jid):
|
||||||
self.windows[account]['gc'][room_jid].got_disconnected(room_jid)
|
self.windows[account]['gc'][room_jid].got_disconnected(room_jid)
|
||||||
|
else:
|
||||||
|
gobject.timeout_add(30000, self.allow_notif, account)
|
||||||
|
model[self.roster.status_message_menuitem_iter][3] = True # sensitivity for this menuitem
|
||||||
self.roster.on_status_changed(account, status)
|
self.roster.on_status_changed(account, status)
|
||||||
if self.remote and self.remote.is_enabled():
|
if self.remote and self.remote.is_enabled():
|
||||||
self.remote.raise_signal('AccountPresence', (status, account))
|
self.remote.raise_signal('AccountPresence', (status, account))
|
||||||
|
@ -262,11 +266,11 @@ class Interface:
|
||||||
resource = ''
|
resource = ''
|
||||||
priority = array[4]
|
priority = array[4]
|
||||||
if jid.find('@') <= 0:
|
if jid.find('@') <= 0:
|
||||||
#It must be an agent
|
# It must be an agent
|
||||||
ji = jid.replace('@', '')
|
ji = jid.replace('@', '')
|
||||||
else:
|
else:
|
||||||
ji = jid
|
ji = jid
|
||||||
#Update user
|
# Update contact
|
||||||
if gajim.contacts[account].has_key(ji):
|
if gajim.contacts[account].has_key(ji):
|
||||||
luser = gajim.contacts[account][ji]
|
luser = gajim.contacts[account][ji]
|
||||||
user1 = None
|
user1 = None
|
||||||
|
@ -318,17 +322,17 @@ class Interface:
|
||||||
user1.priority = priority
|
user1.priority = priority
|
||||||
user1.keyID = keyID
|
user1.keyID = keyID
|
||||||
if jid.find('@') <= 0:
|
if jid.find('@') <= 0:
|
||||||
#It must be an agent
|
# It must be an agent
|
||||||
if gajim.contacts[account].has_key(ji):
|
if gajim.contacts[account].has_key(ji):
|
||||||
#Update existing iter
|
# Update existing iter
|
||||||
self.roster.draw_contact(ji, account)
|
self.roster.draw_contact(ji, account)
|
||||||
elif jid == gajim.get_jid_from_account(account):
|
elif jid == gajim.get_jid_from_account(account):
|
||||||
#It's another of our resources. We don't need to see that!
|
# It's another of our resources. We don't need to see that!
|
||||||
return
|
return
|
||||||
elif gajim.contacts[account].has_key(ji):
|
elif gajim.contacts[account].has_key(ji):
|
||||||
#It isn't an agent
|
# It isn't an agent
|
||||||
self.roster.chg_contact_status(user1, array[1], array[2], account)
|
self.roster.chg_contact_status(user1, array[1], array[2], account)
|
||||||
#play sound
|
# play sound
|
||||||
if old_show < 2 and new_show > 1:
|
if old_show < 2 and new_show > 1:
|
||||||
if gajim.config.get_per('soundevents', 'contact_connected',
|
if gajim.config.get_per('soundevents', 'contact_connected',
|
||||||
'enabled'):
|
'enabled'):
|
||||||
|
|
|
@ -1437,7 +1437,7 @@ _('If "%s" accepts this request you will know his status.') %jid)
|
||||||
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 ti change our status to invisible
|
# We're going to change our status to invisible
|
||||||
if self.connected_rooms(acct):
|
if self.connected_rooms(acct):
|
||||||
bug_user = True
|
bug_user = True
|
||||||
break
|
break
|
||||||
|
@ -1454,22 +1454,19 @@ _('If "%s" accepts this request you will know his status.') %jid)
|
||||||
for acct in accounts:
|
for acct in accounts:
|
||||||
if not gajim.config.get_per('accounts', acct, 'sync_with_global_status'):
|
if not gajim.config.get_per('accounts', acct, 'sync_with_global_status'):
|
||||||
continue
|
continue
|
||||||
# FIXME: not here why?
|
# we are connected or we want to connect
|
||||||
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)
|
||||||
|
|
||||||
model = self.status_combobox.get_model()
|
|
||||||
model[self.status_message_menuitem_iter][3] = True # sensitivity for this menuitem
|
|
||||||
|
|
||||||
def update_status_comboxbox(self):
|
def update_status_comboxbox(self):
|
||||||
#table to change index in plugin.connected to index in combobox
|
# table to change index in plugin.connected to index in combobox
|
||||||
table = {0:9, 1:9, 2:0, 3:1, 4:2, 5:3, 6:4, 7:5}
|
table = {0:9, 1:9, 2:0, 3:1, 4:2, 5:3, 6:4, 7:5}
|
||||||
maxi = 0
|
maxi = 0
|
||||||
for account in gajim.connections:
|
for account in gajim.connections:
|
||||||
if gajim.connections[account].connected > maxi:
|
if gajim.connections[account].connected > maxi:
|
||||||
maxi = gajim.connections[account].connected
|
maxi = gajim.connections[account].connected
|
||||||
#temporarily block signal in order not to send status that we show
|
# temporarily block signal in order not to send status that we show
|
||||||
#in the combobox
|
# in the combobox
|
||||||
self.status_combobox.handler_block(self.id_signal_cb)
|
self.status_combobox.handler_block(self.id_signal_cb)
|
||||||
self.status_combobox.set_active(table[maxi])
|
self.status_combobox.set_active(table[maxi])
|
||||||
self.status_combobox.handler_unblock(self.id_signal_cb)
|
self.status_combobox.handler_unblock(self.id_signal_cb)
|
||||||
|
@ -1645,7 +1642,7 @@ _('If "%s" accepts this request you will know his status.') %jid)
|
||||||
if self.plugin.windows[account].has_key('join_gc'):
|
if self.plugin.windows[account].has_key('join_gc'):
|
||||||
self.plugin.windows[account]['join_gc'].window.present()
|
self.plugin.windows[account]['join_gc'].window.present()
|
||||||
else:
|
else:
|
||||||
#FIXME: Why this try/except?
|
# c http://nkour.blogspot.com/2005/05/pythons-init-return-none-doesnt-return.html
|
||||||
try:
|
try:
|
||||||
self.plugin.windows[account]['join_gc'] = dialogs.JoinGroupchatWindow(self.plugin, account)
|
self.plugin.windows[account]['join_gc'] = dialogs.JoinGroupchatWindow(self.plugin, account)
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
|
@ -1938,6 +1935,7 @@ _('If "%s" accepts this request you will know his status.') %jid)
|
||||||
if self.plugin.windows[account].has_key('disco'):
|
if self.plugin.windows[account].has_key('disco'):
|
||||||
self.plugin.windows[account]['disco'].window.present()
|
self.plugin.windows[account]['disco'].window.present()
|
||||||
else:
|
else:
|
||||||
|
# c http://nkour.blogspot.com/2005/05/pythons-init-return-none-doesnt-return.html
|
||||||
try:
|
try:
|
||||||
self.plugin.windows[account]['disco'] = \
|
self.plugin.windows[account]['disco'] = \
|
||||||
config.ServiceDiscoveryWindow(self.plugin, account)
|
config.ServiceDiscoveryWindow(self.plugin, account)
|
||||||
|
|
Loading…
Add table
Reference in a new issue