Daniel Brötzmann pushed to branch mainwindow at gajim / gajim
Commits: 691e2f3c by wurstsalat at 2021-09-25T13:37:21+02:00 Sidebar: Use selection sidebar throughout all sidebar elements - - - - - 3 changed files: - gajim/gtk/account_side_bar.py - gajim/gtk/app_side_bar.py - gajim/gtk/main.py Changes: ===================================== gajim/gtk/account_side_bar.py ===================================== @@ -24,6 +24,7 @@ def __init__(self): Gtk.ListBox.__init__(self) self.set_vexpand(True) self.set_valign(Gtk.Align.END) + self.set_selection_mode(Gtk.SelectionMode.SINGLE) self.get_style_context().add_class('account-sidebar') self.connect('row-activated', self._on_row_activated) @@ -56,7 +57,6 @@ class Account(Gtk.ListBoxRow): def __init__(self, account): Gtk.ListBoxRow.__init__(self) self.get_style_context().add_class('account-sidebar-item') - self.set_selectable(False) self.account = account self._account_class = None ===================================== gajim/gtk/app_side_bar.py ===================================== @@ -12,6 +12,7 @@ # You should have received a copy of the GNU General Public License # along with Gajim. If not, see <http://www.gnu.org/licenses/>. +from gi.repository import GLib from gi.repository import Gtk from gajim.common import app @@ -22,8 +23,8 @@ class AppSideBar(Gtk.ListBox): def __init__(self, app_page): Gtk.ListBox.__init__(self) - self.set_selection_mode(Gtk.SelectionMode.NONE) self.set_valign(Gtk.Align.START) + self.set_selection_mode(Gtk.SelectionMode.SINGLE) self.get_style_context().add_class('workspace-sidebar') self.connect('row-activated', self._on_app_row_activated) @@ -35,6 +36,9 @@ def __init__(self, app_page): self.show_all() + # Use idle_add to unselect listbox selection on startup + GLib.idle_add(self.unselect_all) + @staticmethod def _on_app_row_activated(_listbox, _row): app.window.show_app_page() ===================================== gajim/gtk/main.py ===================================== @@ -307,6 +307,8 @@ def _set_startup_finished(self): self._chat_page.set_startup_finished() def show_account_page(self, account): + self._app_side_bar.unselect_all() + self._workspace_side_bar.unselect_all() self._account_side_bar.activate_account_page(account) self._main_stack.show_account(account) @@ -359,6 +361,8 @@ def _activate_workspace(self, _action, param): self.activate_workspace(workspace_id) def activate_workspace(self, workspace_id): + self._app_side_bar.unselect_all() + self._account_side_bar.unselect_all() self._main_stack.show_chats(workspace_id) self._workspace_side_bar.activate_workspace(workspace_id) @@ -397,6 +401,8 @@ def add_private_chat(self, account, jid, select=False): select=select) def select_chat(self, account, jid): + self._app_side_bar.unselect_all() + self._account_side_bar.unselect_all() self._main_stack.show_chat_page() self._chat_page.select_chat(account, jid) @@ -418,6 +424,8 @@ def _add_to_roster(_action, param): open_window('AddContact', account=account, jid=jid) def show_app_page(self): + self._account_side_bar.unselect_all() + self._workspace_side_bar.unselect_all() self._main_stack.show_app_page() def add_app_message(self, category, message=None): View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/691e2f3cdd66d5fdafe80e4fbad4c895a43bfc30 -- View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/691e2f3cdd66d5fdafe80e4fbad4c895a43bfc30 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