Philipp Hörist pushed to branch contactpopover at gajim / gajim
Commits:
cc76624a by Philipp Hörist at 2025-09-06T09:31:23+02:00
fix: Fix leaks
- - - - -
2 changed files:
- gajim/data/gui/contact_popover.ui
- gajim/gtk/contact_popover.py
Changes:
=====================================
gajim/data/gui/contact_popover.ui
=====================================
@@ -127,10 +127,9 @@
</object>
</child>
<child>
- <object class="GtkButton">
+ <object class="GtkButton" id="_contact_details_button">
<property name="label" translatable="yes">Contact
Details</property>
<property name="halign">center</property>
- <signal name="clicked" handler="_on_contact_details_clicked"/>
</object>
</child>
</object>
=====================================
gajim/gtk/contact_popover.py
=====================================
@@ -22,7 +22,6 @@
from gajim.common import app
from gajim.common.const import AvatarSize
-from gajim.common.ged import EventHelper
from gajim.common.i18n import _
from gajim.common.iana import get_zone_data
from gajim.common.modules.contacts import BareContact
@@ -37,7 +36,7 @@
@Gtk.Template(string=get_ui_string("contact_popover.ui"))
-class ContactPopover(Gtk.Popover, EventHelper, SignalManager):
+class ContactPopover(Gtk.Popover, SignalManager):
__gtype_name__ = "ContactPopover"
_avatar: Gtk.Image = Gtk.Template.Child()
@@ -52,10 +51,10 @@ class ContactPopover(Gtk.Popover, EventHelper,
SignalManager):
_email: ContactPopoverInfoRow = Gtk.Template.Child()
_tel: ContactPopoverInfoRow = Gtk.Template.Child()
_timezone: ContactPopoverInfoRow = Gtk.Template.Child()
+ _contact_details_button: Gtk.Button = Gtk.Template.Child()
def __init__(self, contact: BareContact) -> None:
Gtk.Popover.__init__(self)
- EventHelper.__init__(self)
SignalManager.__init__(self)
self._contact = contact
@@ -99,6 +98,10 @@ def __init__(self, contact: BareContact) -> None:
self._xmpp_address.set_label(str(self._contact.jid),
link_scheme="xmpp")
+ self._connect(
+ self._contact_details_button, "clicked",
self._on_contact_details_clicked
+ )
+
client = app.get_client(contact.account)
vcard = client.get_module("VCard4").request_vcard(
jid=self._contact.jid, callback=self._on_vcard_received,
use_cache=True
@@ -154,7 +157,6 @@ def _get_timezone_label(self, prop: TzProperty) -> str:
return f"{remote_dt_str} ({data.full_name})"
- @Gtk.Template.Callback()
def _on_contact_details_clicked(self, _button: Gtk.Button) -> None:
self.popdown()
account_jid_params = AccountJidParam(
@@ -164,6 +166,11 @@ def _on_contact_details_clicked(self, _button: Gtk.Button)
-> None:
"win.chat-contact-info", account_jid_params.to_variant()
)
+ def do_unroot(self) -> None:
+ self._disconnect_all()
+ app.check_finalize(self)
+ Gtk.Popover.do_unroot(self)
+
@Gtk.Template(string=get_ui_string("contact_popover_info_row.ui"))
class ContactPopoverInfoRow(Gtk.ListBoxRow):
@@ -233,6 +240,11 @@ def set_label(self, text: str, link_scheme: str | None =
None) -> None:
self._label.set_tooltip_text(text)
@Gtk.Template.Callback()
- def _on_activate_link(self, label: Gtk.Label, *args: Any) -> int:
+ @staticmethod
+ def _on_activate_link(label: Gtk.Label, *args: Any) -> int:
open_uri(label.get_current_uri() or label.get_text())
return Gdk.EVENT_STOP
+
+ def do_unroot(self) -> None:
+ Gtk.ListBoxRow.do_unroot(self)
+ app.check_finalize(self)
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/cc76624a6ee49f7f876297bd837d4387eee33a05
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/cc76624a6ee49f7f876297bd837d4387eee33a05
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]