Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornicoco <nicoco@nicoco.fr>2023-09-28 03:27:28 +0300
committerPhilipp Hörist <philipp@hoerist.com>2023-11-28 23:17:52 +0300
commit83adf75c3246615de5ba9a3e8785b8054f117882 (patch)
treee5aa56a0d9a063f0789eac23056b857f20dad57e
parent1a3af4ac6398f3461d9a4f7acf3c4c09d00ad353 (diff)
feat: StartChat: Show roster groups
References: https://dev.gajim.org/gajim/gajim/-/issues/11625
-rw-r--r--gajim/data/style/gajim.css12
-rw-r--r--gajim/gtk/start_chat.py7
-rw-r--r--gajim/gtk/util.py17
3 files changed, 36 insertions, 0 deletions
diff --git a/gajim/data/style/gajim.css b/gajim/data/style/gajim.css
index 7a7cd7705..afe2f8cfc 100644
--- a/gajim/data/style/gajim.css
+++ b/gajim/data/style/gajim.css
@@ -224,6 +224,18 @@ infobar.error > revealer > box {
font-weight: lighter;
}
+.group {
+ color: rgb(242, 242, 242);
+ padding-left: 6px;
+ padding-right: 6px;
+ padding-top: 2px;
+ padding-bottom: 2px;
+ border-radius: 4px;
+ font-size: 80%;
+ font-weight: bold;
+ background-color: rgb(128, 128, 128);
+}
+
.link-button { min-height: 0px; }
.floating-overlay-box {
diff --git a/gajim/gtk/start_chat.py b/gajim/gtk/start_chat.py
index 37dc8e4db..abdbc3a0f 100644
--- a/gajim/gtk/start_chat.py
+++ b/gajim/gtk/start_chat.py
@@ -59,6 +59,7 @@ from gajim.gtk.tooltips import ContactTooltip
from gajim.gtk.util import AccountBadge
from gajim.gtk.util import GajimPopover
from gajim.gtk.util import get_icon_name
+from gajim.gtk.util import GroupBadge
from gajim.gtk.util import IdleBadge
ContactT = BareContact | GroupchatContact
@@ -819,6 +820,12 @@ class ContactRow(Gtk.ListBoxRow):
idle_badge = IdleBadge(idle)
name_box.add(idle_badge)
+ if contact and not contact.is_groupchat and not contact.is_pm_contact:
+ groups = contact.groups
+ for group in groups:
+ account_badge = GroupBadge(group)
+ name_box.add(account_badge)
+
box.add(name_box)
if contact and not contact.is_groupchat and (status := contact.status):
diff --git a/gajim/gtk/util.py b/gajim/gtk/util.py
index 5ce5c1d2f..22e9b2a51 100644
--- a/gajim/gtk/util.py
+++ b/gajim/gtk/util.py
@@ -796,6 +796,23 @@ def wrap_with_event_box(klass: Any) -> Any:
return klass_wrapper
+class GroupBadge(Gtk.Label):
+ def __init__(self, group: str) -> None:
+ Gtk.Label.__init__(
+ self,
+ ellipsize=Pango.EllipsizeMode.END,
+ no_show_all=True,
+ halign=Gtk.Align.END,
+ valign=Gtk.Align.START,
+ hexpand=True,
+ tooltip_text=group,
+ )
+ self.set_size_request(50, -1)
+ self.get_style_context().add_class('group')
+ self.set_text(group)
+ self.show()
+
+
class IdleBadge(Gtk.Label):
def __init__(self, idle: datetime | None = None) -> None:
Gtk.Label.__init__(