Daniel Brötzmann pushed to branch master at gajim / gajim
Commits:
f86abe1a by wurstsalat at 2025-08-16T19:00:56+02:00
fix: Account side bar: Display hint for connectivity issues
Fixes #12262
- - - - -
2 changed files:
- gajim/gtk/app_side_bar.py
- gajim/gtk/avatar.py
Changes:
=====================================
gajim/gtk/app_side_bar.py
=====================================
@@ -114,10 +114,21 @@ def _update_account_row(self, *args: Any) -> None:
account = None
texture = app.app.avatar_storage.get_account_button_texture(
- account, AvatarSize.ACCOUNT_SIDE_BAR, self.get_scale_factor()
+ account,
+ AvatarSize.ACCOUNT_SIDE_BAR,
+ self.get_scale_factor(),
+ self._has_connectivity_issues(),
)
self._account_row.set_from_paintable(texture)
+ @staticmethod
+ def _has_connectivity_issues() -> bool:
+ for account in app.settings.get_active_accounts():
+ client = app.get_client(account)
+ if client.state.is_disconnected or
client.state.is_reconnect_scheduled:
+ return True
+ return False
+
def _on_account_clicked(
self,
_popover: AccountPopover,
@@ -297,10 +308,21 @@ def __init__(self, account: str = "") -> None:
label = app.settings.get_account_setting(account, "account_label")
self._label.set_text(label)
+ client = app.get_client(account)
+ connectivity_issues = bool(
+ client.state.is_disconnected or client.state.is_reconnect_scheduled
+ )
texture = app.app.avatar_storage.get_account_button_texture(
- account, AvatarSize.ACCOUNT_SIDE_BAR, self.get_scale_factor()
+ account,
+ AvatarSize.ACCOUNT_SIDE_BAR,
+ self.get_scale_factor(),
+ connectivity_issues,
)
self._avatar.set_from_paintable(texture)
+ if connectivity_issues:
+ self._avatar.set_tooltip_text(_("There are connectivity issues"))
+ else:
+ self._avatar.set_tooltip_text("")
def do_unroot(self) -> None:
Gtk.ListBoxRow.do_unroot(self)
=====================================
gajim/gtk/avatar.py
=====================================
@@ -569,10 +569,28 @@ def get_workspace_texture(
@staticmethod
def get_account_button_texture(
- account: str | None,
- size: int,
- scale: int,
+ account: str | None, size: int, scale: int, connectivity_issues: bool
) -> Gdk.Texture:
+ width = size * scale
+ height = width
+
+ if connectivity_issues:
+ surface = cairo.ImageSurface(cairo.Format.ARGB32, width, height)
+ context = cairo.Context(surface)
+
+ context.set_source_rgb(0.75, 0.75, 0.75)
+ context.rectangle(0, 0, width, height)
+ context.fill()
+ icon_surface = load_icon_surface("dialog-warning", int(size *
0.7), scale)
+ if icon_surface is not None:
+ pos = (width - width * 0.7) / 2
+ context.set_source_surface(icon_surface, pos, pos)
+ context.paint_with_alpha(0.6)
+
+ surface.set_device_scale(scale, scale)
+ surface = clip_circle(context.get_target())
+ return convert_surface_to_texture(surface)
+
if account is not None:
jid = app.get_jid_from_account(account)
client = app.get_client(account)
@@ -583,9 +601,6 @@ def get_account_button_texture(
)
# Paint default avatar on grey background (incl. show)
- width = size * scale
- height = width
-
surface = cairo.ImageSurface(cairo.Format.ARGB32, width, height)
context = cairo.Context(surface)
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/f86abe1a4bb88a69c62aaa9ac69ad1845bc96fb3
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/f86abe1a4bb88a69c62aaa9ac69ad1845bc96fb3
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]