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


Commits:
1be6e94e by wurstsalat at 2022-08-12T10:03:26+02:00
fix: ChatBanner: Display account badge again

- - - - -


3 changed files:

- gajim/data/gui/chat_banner.ui
- gajim/gtk/chat_banner.py
- gajim/gtk/chat_stack.py


Changes:

=====================================
gajim/data/gui/chat_banner.ui
=====================================
@@ -126,10 +126,11 @@
         </child>
         <child>
           <object class="GtkBox" id="account_badge_box">
+            <property name="visible">True</property>
             <property name="can-focus">False</property>
-            <property name="no-show-all">True</property>
             <property name="halign">end</property>
             <property name="valign">center</property>
+            <property name="margin-end">6</property>
             <property name="orientation">vertical</property>
             <child>
               <placeholder/>


=====================================
gajim/gtk/chat_banner.py
=====================================
@@ -80,24 +80,20 @@ def clear(self) -> None:
         self._contact = None
         self._client = None
 
-    def switch_contact(self,
-                       account: str,
-                       jid: JID
-                       ) -> None:
-
-        self._update_account_badge(account)
+    def switch_contact(self, contact: types.ChatContactT) -> None:
+        self._update_account_badge(contact.account)
 
         if self._client is not None:
             self._client.disconnect_all_from_obj(self)
 
-        self._client = app.get_client(account)
+        self._client = app.get_client(contact.account)
         self._client.connect_signal('state-changed',
                                     self._on_client_state_changed)
 
         if self._contact is not None:
             self._contact.disconnect_all_from_obj(self)
 
-        self._contact = self._client.get_module('Contacts').get_contact(jid)
+        self._contact = contact
         self._contact.multi_connect({
             'chatstate-update': self._on_chatstate_update,
             'nickname-update': self._on_nickname_update,
@@ -221,7 +217,10 @@ def _on_muc_disco_update(self, event: MucDiscoUpdate) -> 
None:
         self._update_content()
 
     def _on_account_changed(self, event: AccountEnabled) -> None:
-        self._update_account_badge(event.account)
+        if self._contact is None:
+            return
+
+        self._update_account_badge(self._contact.account)
 
     def _on_message_received(self, event: MessageReceived) -> None:
         if not event.msgtxt:


=====================================
gajim/gtk/chat_stack.py
=====================================
@@ -165,7 +165,7 @@ def show_chat(self, account: str, jid: JID) -> None:
         client = app.get_client(account)
         self._current_contact = client.get_module('Contacts').get_contact(jid)
 
-        self._chat_banner.switch_contact(account, jid)
+        self._chat_banner.switch_contact(self._current_contact)
         self._chat_control.switch_contact(self._current_contact)
         self._message_action_box.switch_contact(self._current_contact)
 



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/1be6e94ee44ba0636e6d7bbe5a1537d1af052c47

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/1be6e94ee44ba0636e6d7bbe5a1537d1af052c47
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