diff options
author | Philipp Hörist <philipp@hoerist.com> | 2022-10-02 21:06:54 +0300 |
---|---|---|
committer | Philipp Hörist <philipp@hoerist.com> | 2022-10-02 21:06:54 +0300 |
commit | e17cb70d070ea7d5026f2c25e33bdef7181d4352 (patch) | |
tree | 5a31f57f4f3387bcb1c2cc515b9efc5bbeeaa4d6 | |
parent | 66a6d633f6061e9b967d629703fd56f43da658ea (diff) |
refactor: ChatListRow: Define signal handlers in builder xml
-rw-r--r-- | gajim/data/gui/chat_list_row.ui | 4 | ||||
-rw-r--r-- | gajim/gtk/chat_list_row.py | 11 |
2 files changed, 8 insertions, 7 deletions
diff --git a/gajim/data/gui/chat_list_row.ui b/gajim/data/gui/chat_list_row.ui index bb1f15110..55b8bb3d5 100644 --- a/gajim/data/gui/chat_list_row.ui +++ b/gajim/data/gui/chat_list_row.ui @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.38.2 --> +<!-- Generated with glade 3.40.0 --> <interface> <requires lib="gtk+" version="3.24"/> <object class="GtkEventBox" id="eventbox"> <property name="visible">True</property> <property name="can-focus">False</property> + <signal name="button-press-event" handler="_on_row_button_press_event" swapped="no"/> <child> <object class="GtkBox"> <property name="visible">True</property> @@ -231,6 +232,7 @@ <property name="receives-default">True</property> <property name="valign">center</property> <property name="margin-end">6</property> + <signal name="clicked" handler="_on_close_button_clicked" swapped="no"/> <child> <object class="GtkImage"> <property name="visible">True</property> diff --git a/gajim/gtk/chat_list_row.py b/gajim/gtk/chat_list_row.py index 72766abd6..a57800b70 100644 --- a/gajim/gtk/chat_list_row.py +++ b/gajim/gtk/chat_list_row.py @@ -118,12 +118,11 @@ class ChatListRow(Gtk.ListBoxRow): self.get_style_context().add_class('chatlist-row') self._ui = get_builder('chat_list_row.ui') + self._ui.connect_signals(self) self.add(self._ui.eventbox) self.connect('state-flags-changed', self._on_state_flags_changed) self.connect('destroy', self._on_destroy) - self._ui.eventbox.connect('button-press-event', self._on_button_press) - self._ui.close_button.connect('clicked', self._on_close_button_clicked) # Drag and Drop entries = [Gtk.TargetEntry.new( @@ -416,10 +415,10 @@ class ChatListRow(Gtk.ListBoxRow): 'remove-chat', GLib.Variant('as', [self.account, str(self.jid)])) - def _on_button_press(self, - _widget: Gtk.Widget, - event: Gdk.EventButton - ) -> None: + def _on_row_button_press_event(self, + _widget: Gtk.EventBox, + event: Gdk.EventButton + ) -> None: if event.button == 3: # right click self._popup_menu(event) elif event.button == 2: # middle click |