remember the size and position of roster window if user want so

This commit is contained in:
Yann Leboulanger 2004-10-13 21:46:10 +00:00
parent 1b7a501518
commit 15efcf97da
3 changed files with 550 additions and 463 deletions

View File

@ -205,6 +205,12 @@ class preference_Window:
ist = self.combo_iconstyle.entry.get_text()
self.plugin.config['iconstyle'] = ist
self.plugin.roster.mkpixbufs()
#save position
chk = self.xml.get_widget('save_position_checkbutton')
if chk.get_active():
self.plugin.config['saveposition'] = 1
else:
self.plugin.config['saveposition'] = 0
#autopopup
if self.chk_autopp.get_active():
self.plugin.config['autopopup'] = 1
@ -306,6 +312,10 @@ class preference_Window:
self.combo_iconstyle.set_popdown_strings(l)
if self.plugin.config['iconstyle'] in l:
self.combo_iconstyle.entry.set_text(self.plugin.config['iconstyle'])
#Save position
st = self.plugin.config['saveposition']
self.xml.get_widget('save_position_checkbutton').set_active(st)
#Autopopup
st = self.plugin.config['autopopup']

File diff suppressed because it is too large Load Diff

View File

@ -1776,11 +1776,30 @@ class roster_Window:
context.finish(True, True, etime)
return
def on_unrealize(self, widget, data=None):
if self.plugin.config.has_key('saveposition'):
if self.plugin.config['saveposition']:
self.plugin.config['x-position'], self.plugin.config['y-position']=\
widget.get_position()
self.plugin.config['width'], self.plugin.config['height'] = \
widget.get_size()
def __init__(self, plugin):
# FIXME : handle no file ...
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'Gajim', APP)
self.tree = self.xml.get_widget('treeview')
self.plugin = plugin
window = self.xml.get_widget('Gajim')
if self.plugin.config.has_key('saveposition'):
if self.plugin.config['saveposition']:
if self.plugin.config.has_key('x-position') and \
self.plugin.config.has_key('y-position'):
window.move(self.plugin.config['x-position'], \
self.plugin.config['y-position'])
if self.plugin.config.has_key('width') and \
self.plugin.config.has_key('height'):
window.resize(self.plugin.config['width'], \
self.plugin.config['height'])
self.groups = {}
self.contacts = {}
for a in self.plugin.accounts.keys():
@ -1830,6 +1849,7 @@ class roster_Window:
self.tree.connect("drag_data_get", self.drag_data_get_data)
self.tree.connect("drag_data_received", self.drag_data_received_data)
self.xml.signal_connect('gtk_main_quit', self.on_quit)
self.xml.signal_connect('on_Gajim_unrealize', self.on_unrealize)
self.xml.signal_connect('on_preferences_activate', self.on_prefs)
self.xml.signal_connect('on_accounts_activate', self.on_accounts)
self.xml.signal_connect('on_show_offline_activate', self.on_show_off)
@ -2380,7 +2400,12 @@ class plugin:
'groupfont': 'Sans Italic 10',\
'usertextcolor': '#000000',\
'userbgcolor': '#ffffff',\
'userfont': 'Sans 10'}))
'userfont': 'Sans 10',\
'saveposition': 0,\
'x-position': 0,\
'y-position': 0,\
'width': 150,\
'height': 400}))
self.config = self.wait('CONFIG')
self.send('ASK_CONFIG', None, ('GtkGui', 'accounts'))
self.accounts = self.wait('CONFIG')