Refactor restoring roster position
This commit is contained in:
parent
a9efde136b
commit
7a5d791beb
|
@ -32,7 +32,7 @@ from gajim.common.helpers import save_roster_position
|
|||
|
||||
from gajim.gtk.util import get_builder
|
||||
from gajim.gtk.util import get_icon_name
|
||||
from gajim.gtk.util import move_window
|
||||
from gajim.gtk.util import restore_roster_position
|
||||
from gajim.gtk.single_message import SingleMessageWindow
|
||||
from gajim.gtk.tooltips import NotificationAreaTooltip
|
||||
|
||||
|
@ -380,10 +380,7 @@ class StatusIcon:
|
|||
win.hide() # else we hide it from VD that was visible in
|
||||
else:
|
||||
win.show_all()
|
||||
if app.config.get('save-roster-position'):
|
||||
move_window(win,
|
||||
app.config.get('roster_x-position'),
|
||||
app.config.get('roster_y-position'))
|
||||
restore_roster_position(win)
|
||||
if not app.config.get('roster_window_skip_taskbar'):
|
||||
win.set_property('skip-taskbar-hint', False)
|
||||
win.present_with_time(Gtk.get_current_event_time())
|
||||
|
@ -395,11 +392,9 @@ class StatusIcon:
|
|||
if not event:
|
||||
return
|
||||
win = app.interface.roster.window
|
||||
if not win.get_property('visible') and app.config.get(
|
||||
'save-roster-position'):
|
||||
move_window(win,
|
||||
app.config.get('roster_x-position'),
|
||||
app.config.get('roster_y-position'))
|
||||
if not win.get_property('visible'):
|
||||
# Needed if we are in one window mode
|
||||
restore_roster_position(win)
|
||||
app.interface.handle_event(account, jid, event.type_)
|
||||
|
||||
def on_middle_click(self):
|
||||
|
|
|
@ -40,6 +40,7 @@ from gajim.common.i18n import _
|
|||
from gajim.common.const import MOODS
|
||||
from gajim.common.const import ACTIVITIES
|
||||
from gajim.common.const import LOCATION_DATA
|
||||
from gajim.common.const import Display
|
||||
|
||||
from gajim.gtk.const import GajimIconSet
|
||||
|
||||
|
@ -308,6 +309,16 @@ def move_window(window: Gtk.Window, pos_x: int, pos_y: int) -> None:
|
|||
window.move(pos_x, pos_y)
|
||||
|
||||
|
||||
def restore_roster_position(window):
|
||||
if not app.config.get('save-roster-position'):
|
||||
return
|
||||
if app.is_display(Display.WAYLAND):
|
||||
return
|
||||
move_window(window,
|
||||
app.config.get('roster_x-position'),
|
||||
app.config.get('roster_y-position'))
|
||||
|
||||
|
||||
def get_completion_liststore(entry: Gtk.Entry) -> Gtk.ListStore:
|
||||
"""
|
||||
Create a completion model for entry widget completion list consists of
|
||||
|
|
|
@ -84,7 +84,7 @@ from gajim.gtk.tooltips import RosterTooltip
|
|||
from gajim.gtk.adhoc_commands import CommandWindow
|
||||
from gajim.gtk.util import get_icon_name
|
||||
from gajim.gtk.util import resize_window
|
||||
from gajim.gtk.util import move_window
|
||||
from gajim.gtk.util import restore_roster_position
|
||||
from gajim.gtk.util import get_metacontact_surface
|
||||
from gajim.gtk.util import get_builder
|
||||
from gajim.gtk.util import set_urgency_hint
|
||||
|
@ -5618,10 +5618,7 @@ class RosterWindow:
|
|||
resize_window(self.window,
|
||||
app.config.get('roster_width'),
|
||||
app.config.get('roster_height'))
|
||||
if app.config.get('save-roster-position'):
|
||||
move_window(self.window,
|
||||
app.config.get('roster_x-position'),
|
||||
app.config.get('roster_y-position'))
|
||||
restore_roster_position(self.window)
|
||||
|
||||
# Remove contact from roster when last event opened
|
||||
# { (contact, account): { backend: boolean }
|
||||
|
|
Loading…
Reference in New Issue