Daniel Brötzmann pushed to branch mainwindow at gajim / gajim
Commits: 06663860 by wurstsalat at 2021-05-23T18:39:43+02:00 StatusIcon: Improve behaviour - - - - - 3 changed files: - gajim/common/helpers.py - gajim/gtk/status_icon.py - gajim/gtk/util.py Changes: ===================================== gajim/common/helpers.py ===================================== @@ -872,17 +872,6 @@ def copy(self): return copy.deepcopy(self) -def save_roster_position(window): - if not app.settings.get('save-roster-position'): - return - if app.is_display(Display.WAYLAND): - return - x_pos, y_pos = window.get_position() - log.debug('Save roster position: %s %s', x_pos, y_pos) - app.settings.set('roster_x-position', x_pos) - app.settings.set('roster_y-position', y_pos) - - class Singleton(type): _instances = {} # type: Dict[Any, Any] def __call__(cls, *args, **kwargs): ===================================== gajim/gtk/status_icon.py ===================================== @@ -30,11 +30,11 @@ from gajim.common.i18n import _ from gajim.common.helpers import get_global_show from gajim.common.helpers import get_uf_show -from gajim.common.helpers import save_roster_position from gajim.common.nec import EventHelper from .util import get_builder from .util import get_icon_name +from .util import save_roster_position from .util import restore_roster_position from .util import open_window @@ -169,7 +169,7 @@ def _on_popup_menu(self, _status_icon, button, activate_time): if button == 1: self._on_activate() elif button == 2: - self._on_toggle_window() + self._on_activate() elif button == 3: self._build_menu(activate_time) @@ -244,14 +244,7 @@ def _on_sounds_mute(widget): def _on_toggle_window(self, *args): # When using Gtk.StatusIcon, app.window will never return True for # 'has-toplevel-focus' while clicking the menu item - GLib.idle_add(self._toggle_window) - - @staticmethod - def _toggle_window(): - if app.window.get_property('has-toplevel-focus'): - app.window.hide() - else: - app.window.present() + GLib.idle_add(self._on_activate) @staticmethod def _on_preferences(_widget): @@ -285,10 +278,8 @@ def _handle_first_event(): account, jid, event = app.events.get_first_systray_event() if not event: return - win = app.window if not app.window.get_property('visible'): - # Needed if we are in one window mode - restore_roster_position(win) + restore_roster_position(app.window) app.interface.handle_event(account, jid, event.type_) @staticmethod ===================================== gajim/gtk/util.py ===================================== @@ -336,6 +336,17 @@ def move_window(window: Gtk.Window, pos_x: int, pos_y: int) -> None: window.move(pos_x, pos_y) +def save_roster_position(window): + if not app.settings.get('save-roster-position'): + return + if app.is_display(Display.WAYLAND): + return + x_pos, y_pos = window.get_position() + log.debug('Save roster position: %s %s', x_pos, y_pos) + app.settings.set('roster_x-position', x_pos) + app.settings.set('roster_y-position', y_pos) + + def restore_roster_position(window): if not app.settings.get('save-roster-position'): return View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/06663860ae5dc2435a04453951f3f63d9f2f947e -- View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/06663860ae5dc2435a04453951f3f63d9f2f947e You're receiving this email because of your account on dev.gajim.org.
_______________________________________________ Commits mailing list Commits@gajim.org https://lists.gajim.org/cgi-bin/listinfo/commits