Daniel Brötzmann pushed to branch mainwindow at gajim / gajim


Commits:
3ff47301 by Daniel Brötzmann at 2021-02-02T19:24:16+01:00
Paned: Improve ChatList resizing

- - - - -
517424b8 by Daniel Brötzmann at 2021-02-02T19:25:11+01:00
ChatList: Use groupchat name, improve ellipsizing

- - - - -


2 changed files:

- gajim/data/gui/main.ui
- gajim/gtk/chat_list.py


Changes:

=====================================
gajim/data/gui/main.ui
=====================================
@@ -317,8 +317,8 @@
                 </style>
               </object>
               <packing>
-                <property name="resize">True</property>
-                <property name="shrink">True</property>
+                <property name="resize">False</property>
+                <property name="shrink">False</property>
               </packing>
             </child>
             <child>


=====================================
gajim/gtk/chat_list.py
=====================================
@@ -8,6 +8,7 @@
 from gajim.common.const import AvatarSize
 from gajim.common.const import KindConstant
 from gajim.common.i18n import _
+from gajim.common.helpers import get_groupchat_name
 from gajim.common.helpers import get_uf_relative_time
 
 log = logging.getLogger('gajim.gtk.chatlist')
@@ -118,32 +119,39 @@ def __init__(self, workspace_id, account, jid, type_):
 
         contact = app.contacts.get_contact(account, jid)
 
-        if contact and not contact.is_groupchat:
-            avatar = app.contacts.get_avatar(account,
-                                             contact.jid,
-                                             AvatarSize.ROSTER,
-                                             self.get_scale_factor(),
-                                             contact.show)
-            name = contact.get_shown_name()
+        scale = self.get_scale_factor()
+        if contact:
+            if contact.is_groupchat:
+                avatar = app.contacts.get_avatar(account,
+                                                jid,
+                                                AvatarSize.ROSTER,
+                                                scale)
+                con = app.connections[account]
+                name = get_groupchat_name(con, jid)
+            else:
+                avatar = app.contacts.get_avatar(account,
+                                                 contact.jid,
+                                                 AvatarSize.ROSTER,
+                                                 scale,
+                                                 contact.show)
+                name = contact.get_shown_name()
         else:
             avatar = app.contacts.get_avatar(account,
                                              jid,
                                              AvatarSize.ROSTER,
-                                             self.get_scale_factor())
+                                             scale)
             name = jid
 
         avatar_image = Gtk.Image.new_from_surface(avatar)
         chat_name_label = Gtk.Label()
         chat_name_label.set_halign(Gtk.Align.START)
         chat_name_label.set_xalign(0)
-        chat_name_label.set_max_width_chars(18)
         chat_name_label.set_ellipsize(Pango.EllipsizeMode.END)
         chat_name_label.set_text(name)
 
         last_message_label = Gtk.Label()
         last_message_label.set_halign(Gtk.Align.START)
         last_message_label.set_xalign(0)
-        last_message_label.set_max_width_chars(20)
         last_message_label.set_ellipsize(Pango.EllipsizeMode.END)
         last_message_label.get_style_context().add_class('small-label')
 



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/3b4d96a92acfa73fafa512656ba4a06c304c569c...517424b825c6b7c0dbc1577811edd7811dbab1d7

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/3b4d96a92acfa73fafa512656ba4a06c304c569c...517424b825c6b7c0dbc1577811edd7811dbab1d7
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
Commits@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to