Philipp Hörist pushed to branch mainwindow at gajim / gajim
Commits:
7 changed files:
- gajim/chat_control.py
- gajim/common/helpers.py
- gajim/common/modules/chatstates.py
- gajim/groupchat_control.py
- gajim/gtk/chat_list_stack.py
- gajim/gui_interface.py
- gajim/gui_menu_builder.py
Changes:
| ... | ... | @@ -1106,6 +1106,7 @@ def shutdown(self): |
| 1106 | 1106 |
# Remove contact instance if contact has been removed
|
| 1107 | 1107 |
|
| 1108 | 1108 |
super(ChatControl, self).shutdown()
|
| 1109 |
+ app.check_finalize(self)
|
|
| 1109 | 1110 |
|
| 1110 | 1111 |
def minimizable(self):
|
| 1111 | 1112 |
return False
|
| ... | ... | @@ -1299,14 +1299,14 @@ def disconnect(self, object_): |
| 1299 | 1299 |
for qualifier, handlers in qualifiers.items():
|
| 1300 | 1300 |
for handler in list(handlers):
|
| 1301 | 1301 |
func = handler()
|
| 1302 |
- if func is None or func.__self__ == object_:
|
|
| 1302 |
+ if func is None or func.__self__ is object_:
|
|
| 1303 | 1303 |
self._callbacks[signal_name][qualifier].remove(handler)
|
| 1304 | 1304 |
|
| 1305 | 1305 |
def connect(self, signal_name, func, qualifiers=None):
|
| 1306 |
- if inspect.ismethod(func):
|
|
| 1307 |
- weak_func = weakref.WeakMethod(func)
|
|
| 1308 |
- elif inspect.isfunction(func):
|
|
| 1309 |
- weak_func = weakref.ref(func)
|
|
| 1306 |
+ if not inspect.ismethod(func):
|
|
| 1307 |
+ raise ValueError('Only bound methods allowed')
|
|
| 1308 |
+ |
|
| 1309 |
+ weak_func = weakref.WeakMethod(func)
|
|
| 1310 | 1310 |
|
| 1311 | 1311 |
self._callbacks[signal_name][qualifiers].append(weak_func)
|
| 1312 | 1312 |
|
| ... | ... | @@ -120,8 +120,9 @@ def _presence_received(self, |
| 120 | 120 |
self._log.info('Reset chatstate for %s', jid)
|
| 121 | 121 |
|
| 122 | 122 |
contact = self._get_contact(jid)
|
| 123 |
- if contact is None:
|
|
| 123 |
+ if contact.is_groupchat:
|
|
| 124 | 124 |
return
|
| 125 |
+ |
|
| 125 | 126 |
contact.notify('chatstate-update')
|
| 126 | 127 |
|
| 127 | 128 |
def _process_chatstate(self, _con, _stanza, properties):
|
| ... | ... | @@ -307,7 +307,6 @@ def add_actions(self): |
| 307 | 307 |
('rename-groupchat-', None, self._on_rename_groupchat),
|
| 308 | 308 |
('change-subject-', None, self._on_change_subject),
|
| 309 | 309 |
('change-nickname-', None, self._on_change_nick),
|
| 310 |
- ('disconnect-', None, self._on_disconnect),
|
|
| 311 | 310 |
('destroy-', None, self._on_destroy_room),
|
| 312 | 311 |
('configure-', None, self._on_configure_room),
|
| 313 | 312 |
('request-voice-', None, self._on_request_voice),
|
| ... | ... | @@ -476,9 +475,6 @@ def _on_muc_disco_update(self, _event): |
| 476 | 475 |
self.draw_banner_text()
|
| 477 | 476 |
|
| 478 | 477 |
# Actions
|
| 479 |
- def _on_disconnect(self, _action, _param):
|
|
| 480 |
- self.leave()
|
|
| 481 |
- |
|
| 482 | 478 |
def _on_information(self, _action, _param):
|
| 483 | 479 |
self._muc_info_box.set_from_disco_info(self.disco_info)
|
| 484 | 480 |
if self._subject_data is not None:
|
| ... | ... | @@ -1006,12 +1002,6 @@ def got_disconnected(self): |
| 1006 | 1002 |
|
| 1007 | 1003 |
self.update_actions()
|
| 1008 | 1004 |
|
| 1009 |
- def leave(self, reason=None):
|
|
| 1010 |
- self.got_disconnected()
|
|
| 1011 |
- self._close_control(reason=reason)
|
|
| 1012 |
- app.connections[self.account].get_module('MUC').leave(
|
|
| 1013 |
- self.room_jid, reason=reason)
|
|
| 1014 |
- |
|
| 1015 | 1005 |
def rejoin(self):
|
| 1016 | 1006 |
app.connections[self.account].get_module('MUC').join(self._muc_data)
|
| 1017 | 1007 |
|
| ... | ... | @@ -1390,6 +1380,8 @@ def shutdown(self, reason=None): |
| 1390 | 1380 |
app.settings.disconnect_signals(self)
|
| 1391 | 1381 |
self.contact.disconnect(self)
|
| 1392 | 1382 |
|
| 1383 |
+ client = app.get_client(self.account)
|
|
| 1384 |
+ client.get_module('MUC').get_manager().disconnect(self)
|
|
| 1393 | 1385 |
# PluginSystem: removing GUI extension points connected with
|
| 1394 | 1386 |
# GrouphatControl instance object
|
| 1395 | 1387 |
app.plugin_manager.remove_gui_extension_point(
|
| ... | ... | @@ -1411,6 +1403,7 @@ def shutdown(self, reason=None): |
| 1411 | 1403 |
self.remove_actions()
|
| 1412 | 1404 |
|
| 1413 | 1405 |
super(GroupchatControl, self).shutdown()
|
| 1406 |
+ app.check_finalize(self)
|
|
| 1414 | 1407 |
|
| 1415 | 1408 |
def safe_shutdown(self):
|
| 1416 | 1409 |
# whether to ask for confirmation before closing muc
|
| ... | ... | @@ -100,7 +100,7 @@ def add_chat_list(self, workspace_id): |
| 100 | 100 |
def remove_chat_list(self, workspace_id):
|
| 101 | 101 |
chat_list = self._chat_lists[workspace_id]
|
| 102 | 102 |
self.remove(chat_list)
|
| 103 |
- for account, jid, _ in chat_list.get_open_chats():
|
|
| 103 |
+ for account, jid, _, _ in chat_list.get_open_chats():
|
|
| 104 | 104 |
self.remove_chat(workspace_id, account, jid)
|
| 105 | 105 |
|
| 106 | 106 |
self._chat_lists.pop(workspace_id)
|
| ... | ... | @@ -1363,8 +1363,7 @@ def show_add_join_groupchat(self, account, jid, nickname=None): |
| 1363 | 1363 |
|
| 1364 | 1364 |
app.window.add_group_chat(account, str(jid), select=True)
|
| 1365 | 1365 |
|
| 1366 |
- @staticmethod
|
|
| 1367 |
- def _on_muc_added(_muc_manger, _signal_name, account, jid):
|
|
| 1366 |
+ def _on_muc_added(self, _muc_manger, _signal_name, account, jid):
|
|
| 1368 | 1367 |
if app.window.chat_exists(account, jid):
|
| 1369 | 1368 |
return
|
| 1370 | 1369 |
|
| ... | ... | @@ -586,7 +586,6 @@ def get_groupchat_menu(control_id, account, jid): |
| 586 | 586 |
('win.request-voice-', _('Request Voice')),
|
| 587 | 587 |
('win.execute-command-', _('Execute Command…')),
|
| 588 | 588 |
('app.browse-history', _('History')),
|
| 589 |
- ('win.disconnect-', _('Leave')),
|
|
| 590 | 589 |
]
|
| 591 | 590 |
|
| 592 | 591 |
def build_menu(preset):
|