add advanced option to allow not saving roster position. Fixes #5712

This commit is contained in:
Yann Leboulanger 2011-04-21 20:52:14 +02:00
parent 82f77772a3
commit c2ea566b12
3 changed files with 17 additions and 11 deletions

View file

@ -147,6 +147,7 @@ class Config:
'single-msg-y-position': [opt_int, 0],
'single-msg-width': [opt_int, 400],
'single-msg-height': [opt_int, 280],
'save-roster-position': [opt_bool, True, _('If true, Gajim will save roster position when hiding roster, and restore it when showing roster.')],
'roster_x-position': [ opt_int, 0 ],
'roster_y-position': [ opt_int, 0 ],
'roster_width': [ opt_int, 200 ],

View file

@ -2337,6 +2337,7 @@ class RosterWindow:
# in case show_roster_on_start is False and roster is never shown
# window.window is None
if self.window.window is not None:
if gajim.config.get('save-roster-position'):
x, y = self.window.window.get_root_origin()
gajim.config.set('roster_x-position', x)
gajim.config.set('roster_y-position', y)
@ -6150,6 +6151,7 @@ class RosterWindow:
gtkgui_helpers.resize_window(self.window,
gajim.config.get('roster_width'),
gajim.config.get('roster_height'))
if gajim.config.get('save-roster-position'):
gtkgui_helpers.move_window(self.window,
gajim.config.get('roster_x-position'),
gajim.config.get('roster_y-position'))

View file

@ -396,7 +396,8 @@ class StatusIcon:
# we could be in another VD right now. eg vd2
# and we want to show it in vd2
if not gtkgui_helpers.possibly_move_window_in_current_desktop(win):
if not gtkgui_helpers.possibly_move_window_in_current_desktop(
win) and gajim.config.get('save-roster-position'):
x, y = win.get_position()
gajim.config.set('roster_x-position', x)
gajim.config.set('roster_y-position', y)
@ -404,6 +405,7 @@ class StatusIcon:
else:
if not win.get_property('visible'):
win.show_all()
if gajim.config.get('save-roster-position'):
gtkgui_helpers.move_window(win,
gajim.config.get('roster_x-position'),
gajim.config.get('roster_y-position'))
@ -418,7 +420,8 @@ class StatusIcon:
if not event:
return
win = gajim.interface.roster.window
if not win.get_property('visible'):
if not win.get_property('visible') and gajim.config.get(
'save-roster-position'):
gtkgui_helpers.move_window(win,
gajim.config.get('roster_x-position'),
gajim.config.get('roster_y-position'))