Daniel Brötzmann pushed to branch gtk4 at gajim / gajim
Commits:
2062335f by wurstsalat at 2024-10-06T10:50:19+02:00
fix chat filter bar
- - - - -
2 changed files:
- gajim/gtk/chat_filter.py
- gajim/gtk/chat_page.py
Changes:
=====================================
gajim/gtk/chat_filter.py
=====================================
@@ -19,16 +19,13 @@ class ChatFilter(Gtk.Box):
}
def __init__(self, icons: bool = False) -> None:
- Gtk.Box.__init__(self)
- self.set_halign(Gtk.Align.CENTER)
+ Gtk.Box.__init__(self, halign=Gtk.Align.CENTER)
- return # GTK4 TODO
- toolbar = Gtk.Toolbar()
- toolbar.set_icon_size(Gtk.IconSize.MENU)
+ toolbar = Gtk.Box(css_classes=['toolbar'])
if icons:
- toolbar.get_style_context().add_class('chat-filter-icons')
+ toolbar.add_css_class('chat-filter-icons')
- self._all_button = Gtk.RadioToolButton.new_from_widget(None)
+ self._all_button = Gtk.ToggleButton()
if icons:
self._all_button.set_icon_name('feather-home-symbolic')
self._all_button.set_tooltip_text(_('All'))
@@ -36,9 +33,9 @@ def __init__(self, icons: bool = False) -> None:
self._all_button.set_label(_('All'))
self._all_button.set_name('all')
self._all_button.connect('clicked', self._on_button_clicked)
- toolbar.insert(self._all_button, 1)
+ toolbar.append(self._all_button)
- chats_button = Gtk.RadioToolButton.new_from_widget(self._all_button)
+ chats_button = Gtk.ToggleButton(group=self._all_button)
if icons:
chats_button.set_icon_name('feather-user-symbolic')
chats_button.set_tooltip_text(_('Chats'))
@@ -46,10 +43,9 @@ def __init__(self, icons: bool = False) -> None:
chats_button.set_label(_('Chats'))
chats_button.set_name('chats')
chats_button.connect('clicked', self._on_button_clicked)
- toolbar.insert(chats_button, 2)
+ toolbar.append(chats_button)
- group_chats_button = Gtk.RadioToolButton.new_from_widget(
- self._all_button)
+ group_chats_button = Gtk.ToggleButton(group=self._all_button)
if icons:
group_chats_button.set_icon_name('feather-users-symbolic')
group_chats_button.set_tooltip_text(_('Group Chats'))
@@ -57,16 +53,14 @@ def __init__(self, icons: bool = False) -> None:
group_chats_button.set_label(_('Group Chats'))
group_chats_button.set_name('group_chats')
group_chats_button.connect('clicked', self._on_button_clicked)
- toolbar.insert(group_chats_button, 3)
+ toolbar.append(group_chats_button)
- self.add(toolbar)
- self.show_all()
+ self.append(toolbar)
def _on_button_clicked(self, button: Any) -> None:
if button.get_active():
self.emit('filter-changed', button.get_name())
def reset(self) -> None:
- return # GTK4 TODO
self._all_button.set_active(True)
self.emit('filter-changed', 'all')
=====================================
gajim/gtk/chat_page.py
=====================================
@@ -70,9 +70,8 @@ def __init__(self):
section_hover_controller.connect('leave', self._on_section_label_leave)
self._ui.section_label_eventbox.add_controller(section_hover_controller)
- # TODO GTK4
self._chat_filter = ChatFilter(icons=True)
- self._ui.filter_bar.append(self._chat_filter)
+ self._ui.filter_bar.prepend(self._chat_filter)
self._ui.filter_bar_toggle.connect(
'toggled', self._on_filter_revealer_toggled)
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/2062335f59406bf28cb74d692ed2e41b0d104526
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/2062335f59406bf28cb74d692ed2e41b0d104526
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]