keep instances of chat2muc dialogs so garbage collector don't destroy them too early

This commit is contained in:
Yann Leboulanger 2007-11-20 22:45:13 +00:00
parent a2b799f6bf
commit 420246c26a
2 changed files with 7 additions and 0 deletions

View File

@ -7,6 +7,7 @@
<property name="border_width">5</property>
<property name="title" translatable="yes">Invite Friends !</property>
<signal name="key_press_event" handler="on_chat_to_muc_window_key_press_event"/>
<signal name="destroy" handler="on_chat_to_muc_window_destroy"/>
<child>
<widget class="GtkVBox" id="general_vbox">
<property name="visible">True</property>

View File

@ -3356,10 +3356,13 @@ class AdvancedNotificationsWindow:
self.window.destroy()
class TransformChatToMUC:
# Keep a reference on windows so garbage collector don't restroy them
instances = []
def __init__(self, account, jids, preselected = None):
'''This window is used to trasform a one-to-one chat to a MUC.
We do 2 things: first select the server and then make a guests list.'''
self.instances.append(self)
self.account = account
self.auto_jids = jids
self.preselected_jids = preselected
@ -3446,6 +3449,9 @@ class TransformChatToMUC:
self.xml.signal_autoconnect(self)
def on_chat_to_muc_window_destroy(self, widget):
self.instances.remove(self)
def on_chat_to_muc_window_key_press_event(self, widget, event):
if event.keyval == gtk.keysyms.Escape: # ESCAPE
self.window.destroy()