From aa931580b4d0f048c7c281333182c2a4f63579b3 Mon Sep 17 00:00:00 2001
From: lovetox <philipp@hoerist.com>
Date: Sun, 26 Apr 2020 20:45:43 +0200
Subject: [PATCH] Roster: Show correct status after status change

Fixes #10077
---
 gajim/roster_window.py | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/gajim/roster_window.py b/gajim/roster_window.py
index 9178891cdf..efcac8e451 100644
--- a/gajim/roster_window.py
+++ b/gajim/roster_window.py
@@ -2243,13 +2243,22 @@ def on_response(message, pep_dict):
 
     def update_status_combobox(self):
         # table to change index in connection.connected to index in combobox
-        table = {'offline':8, 'connecting':8, 'error': 8, 'online':0, 'chat':1, 'away':2,
-            'xa':3, 'dnd':4}
+        table = {
+            'offline':8,
+            'connecting':8,
+            'error': 8,
+            'online':0,
+            'chat':1,
+            'away':2,
+            'xa':3,
+            'dnd':4
+        }
 
         liststore = self.status_combobox.get_model()
-        # we check if there are more options in the combobox that it should
-        # if yes, we remove the first ones
-        while len(liststore) > len(table)+2:
+
+        # Check if a desync'ed status entry and separator is currently
+        # in the liststore remove it. 
+        while len(liststore) > 9:
             titer = liststore.get_iter_first()
             liststore.remove(titer)
 
-- 
GitLab