Philipp Hörist pushed to branch master at gajim / gajim
Commits:
e675df18 by Philipp Hörist at 2017-07-16T23:58:54+02:00
Fix activity timers for groupchat
- Dont add timers when we autojoin minimized
- Remove timers when the chatcontrol gets minimized
- Send inactive chatstate when the chatcontrol gets minimized
- Add timers when the chatcontrol gets maximized
- - - - -
2 changed files:
- gajim/chat_control_base.py
- gajim/groupchat_control.py
Changes:
=====================================
gajim/chat_control_base.py
=====================================
--- a/gajim/chat_control_base.py
+++ b/gajim/chat_control_base.py
@@ -376,7 +376,8 @@ class ChatControlBase(MessageControl, ChatCommandProcessor,
CommandTools):
# chatstate timers and state
self.reset_kbd_mouse_timeout_vars()
- self._schedule_activity_timers()
+ self.possible_paused_timeout_id = None
+ self.possible_inactive_timeout_id = None
message_tv_buffer = self.msg_textview.get_buffer()
id_ = message_tv_buffer.connect('changed',
self._on_message_tv_buffer_changed)
@@ -385,6 +386,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor,
CommandTools):
id_ = parent_win.window.connect('motion-notify-event',
self._on_window_motion_notify)
self.handlers[id_] = parent_win.window
+ self._schedule_activity_timers()
self.encryption = self.get_encryption_state()
if self.parent_win:
@@ -836,6 +838,10 @@ class ChatControlBase(MessageControl,
ChatCommandProcessor, CommandTools):
return True # loop forever
def _schedule_activity_timers(self):
+ if self.possible_paused_timeout_id:
+ GLib.source_remove(self.possible_paused_timeout_id)
+ if self.possible_inactive_timeout_id:
+ GLib.source_remove(self.possible_inactive_timeout_id)
self.possible_paused_timeout_id = GLib.timeout_add_seconds(5,
self.check_for_possible_paused_chatstate, None)
self.possible_inactive_timeout_id = GLib.timeout_add_seconds(30,
@@ -1143,8 +1149,6 @@ class ChatControlBase(MessageControl,
ChatCommandProcessor, CommandTools):
else:
self.send_chatstate('active', self.contact)
self.reset_kbd_mouse_timeout_vars()
- GLib.source_remove(self.possible_paused_timeout_id)
- GLib.source_remove(self.possible_inactive_timeout_id)
self._schedule_activity_timers()
else:
self.send_chatstate('inactive', self.contact)
=====================================
gajim/groupchat_control.py
=====================================
--- a/gajim/groupchat_control.py
+++ b/gajim/groupchat_control.py
@@ -529,6 +529,7 @@ class GroupchatControl(ChatControlBase):
self.set_tooltip()
self.add_window_actions()
self.set_lock_image()
+ self._schedule_activity_timers()
def set_tooltip(self):
widget = self.xml.get_object('list_treeview')
@@ -2085,8 +2086,11 @@ class GroupchatControl(ChatControlBase):
control = win.notebook.get_nth_page(ctrl_page)
win.notebook.remove_page(ctrl_page)
+ GLib.source_remove(self.possible_paused_timeout_id)
+ GLib.source_remove(self.possible_inactive_timeout_id)
control.unparent()
ctrl.parent_win = None
+ self.send_chatstate('inactive', self.contact)
gajim.interface.roster.add_groupchat(self.contact.jid, self.account,
status = self.subject)
View it on GitLab:
https://dev.gajim.org/gajim/gajim/commit/e675df1803fbf3241d8ba36910f91d754e182c63
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits