keep references on single message windows, so garbage collector don't destroy them. fixes #3557
This commit is contained in:
parent
310bc41d7a
commit
508b411e80
|
@ -8,6 +8,7 @@
|
||||||
<property name="default_height">280</property>
|
<property name="default_height">280</property>
|
||||||
<signal name="key_press_event" handler="on_single_message_window_key_press_event"/>
|
<signal name="key_press_event" handler="on_single_message_window_key_press_event"/>
|
||||||
<signal name="delete_event" handler="on_single_message_window_delete_event"/>
|
<signal name="delete_event" handler="on_single_message_window_delete_event"/>
|
||||||
|
<signal name="destroy" handler="on_single_message_window_destroy"/>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkVBox" id="vbox97">
|
<widget class="GtkVBox" id="vbox97">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
|
|
@ -1829,8 +1829,11 @@ class SingleMessageWindow:
|
||||||
singled message depending on action argument which can be 'send'
|
singled message depending on action argument which can be 'send'
|
||||||
or 'receive'.
|
or 'receive'.
|
||||||
'''
|
'''
|
||||||
|
# Keep a reference on windows so garbage collector don't restroy them
|
||||||
|
instances = []
|
||||||
def __init__(self, account, to='', action='', from_whom='', subject='',
|
def __init__(self, account, to='', action='', from_whom='', subject='',
|
||||||
message='', resource='', session=None, form_node=None):
|
message='', resource='', session=None, form_node=None):
|
||||||
|
self.instances.append(self)
|
||||||
self.account = account
|
self.account = account
|
||||||
self.action = action
|
self.action = action
|
||||||
|
|
||||||
|
@ -1929,12 +1932,14 @@ class SingleMessageWindow:
|
||||||
gajim.config.get('single-msg-height'))
|
gajim.config.get('single-msg-height'))
|
||||||
self.window.show_all()
|
self.window.show_all()
|
||||||
|
|
||||||
|
def on_single_message_window_destroy(self, widget):
|
||||||
|
self.instances.remove(self)
|
||||||
|
|
||||||
def set_cursor_to_end(self):
|
def set_cursor_to_end(self):
|
||||||
end_iter = self.message_tv_buffer.get_end_iter()
|
end_iter = self.message_tv_buffer.get_end_iter()
|
||||||
self.message_tv_buffer.place_cursor(end_iter)
|
self.message_tv_buffer.place_cursor(end_iter)
|
||||||
|
|
||||||
def save_pos(self):
|
def save_pos(self):
|
||||||
print 'save_pos'
|
|
||||||
if gajim.config.get('saveposition'):
|
if gajim.config.get('saveposition'):
|
||||||
# save the window size and position
|
# save the window size and position
|
||||||
x, y = self.window.get_position()
|
x, y = self.window.get_position()
|
||||||
|
@ -1946,7 +1951,6 @@ class SingleMessageWindow:
|
||||||
gajim.interface.save_config()
|
gajim.interface.save_config()
|
||||||
|
|
||||||
def on_single_message_window_delete_event(self, window, ev):
|
def on_single_message_window_delete_event(self, window, ev):
|
||||||
print 'delete_event'
|
|
||||||
self.save_pos()
|
self.save_pos()
|
||||||
|
|
||||||
def prepare_widgets_for(self, action):
|
def prepare_widgets_for(self, action):
|
||||||
|
@ -2023,7 +2027,6 @@ class SingleMessageWindow:
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
def on_close_button_clicked(self, widget):
|
def on_close_button_clicked(self, widget):
|
||||||
print 'close'
|
|
||||||
self.save_pos()
|
self.save_pos()
|
||||||
self.window.destroy()
|
self.window.destroy()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue