[kaylan] Remember size and position of history window. Closes #2824.

This commit is contained in:
js 2008-11-23 19:17:58 +00:00
parent 917f6fc3a5
commit 2c7c345a7c
2 changed files with 24 additions and 0 deletions

View File

@ -156,6 +156,10 @@ class Config:
'roster_y-position': [ opt_int, 0 ],
'roster_width': [ opt_int, 200 ],
'roster_height': [ opt_int, 400 ],
'history_window_width': [ opt_int, 650 ],
'history_window_height': [ opt_int, 450 ],
'history_window_x-position': [ opt_int, 0 ],
'history_window_y-position': [ opt_int, 0 ],
'latest_disco_addresses': [ opt_str, '' ],
'recently_groupchat': [ opt_str, '' ],
'time_stamp': [ opt_str, '[%X] ', _('This option let you customize timestamp that is printed in conversation. For exemple "[%H:%M] " will show "[hour:minute] ". See python doc on strftime for full documentation: http://docs.python.org/lib/module-time.html') ],

View File

@ -119,6 +119,13 @@ class HistoryWindow:
if jid:
self.jid_entry.set_text(jid)
gtkgui_helpers.resize_window(self.window,
gajim.config.get('history_window_width'),
gajim.config.get('history_window_height'))
gtkgui_helpers.move_window(self.window,
gajim.config.get('history_window_x-position'),
gajim.config.get('history_window_y-position'))
xml.signal_autoconnect(self)
self.window.show_all()
@ -217,9 +224,11 @@ class HistoryWindow:
def on_history_window_key_press_event(self, widget, event):
if event.keyval == gtk.keysyms.Escape:
self.save_state()
self.window.destroy()
def on_close_button_clicked(self, widget):
self.save_state()
self.window.destroy()
def on_jid_entry_activate(self, widget):
@ -588,4 +597,15 @@ class HistoryWindow:
self._load_history(jid, account)
self.results_window.set_property('visible', False)
def save_state(self):
x,y = self.window.window.get_root_origin()
width, height = self.window.get_size()
gajim.config.set('history_window_x-position', x)
gajim.config.set('history_window_y-position', y)
gajim.config.set('history_window_width', width);
gajim.config.set('history_window_height', height);
gajim.interface.save_config()
# vim: se ts=3: