Philipp Hörist pushed to branch master at gajim / gajim

Commits:
309e844b by Philipp Hörist at 2017-11-11T17:10:31+01:00
Escape account label in roster and menus

- - - - -


2 changed files:

- gajim/gui_menu_builder.py
- gajim/roster_window.py


Changes:

=====================================
gajim/gui_menu_builder.py
=====================================
--- a/gajim/gui_menu_builder.py
+++ b/gajim/gui_menu_builder.py
@@ -780,7 +780,8 @@ def build_accounts_menu():
         return
     if len(accounts_list) > 1:
         for acc in accounts_list:
-            label = app.config.get_per('accounts', acc, 'account_label')
+            label = escape_mnemonic(
+                app.config.get_per('accounts', acc, 'account_label'))
             acc_menu.append_submenu(
                 label or acc, get_account_menu(acc))
     else:
@@ -806,8 +807,8 @@ def build_bookmark_menu(account):
     if acc_menu.get_item_link(0, 'submenu'):
         for i in range(acc_menu.get_n_items()):
             label = acc_menu.get_item_attribute_value(i, 'label')
-            account_label = app.config.get_per('accounts', account,
-                                               'account_label')
+            account_label = escape_mnemonic(
+                app.config.get_per('accounts', account, 'account_label'))
             if label.get_string() in (account_label, account):
                 menu = acc_menu.get_item_link(i, 'submenu')
     else:
@@ -835,3 +836,11 @@ def get_encryption_menu(control_id, type_id):
     if menu.get_n_items() == 1:
         return None
     return menu
+
+
+def escape_mnemonic(label):
+    if label is None:
+        return
+    # Underscore inside a label means the next letter is a keyboard
+    # shortcut. To show an underscore we have to use double underscore
+    return label.replace('_', '__')


=====================================
gajim/roster_window.py
=====================================
--- a/gajim/roster_window.py
+++ b/gajim/roster_window.py
@@ -1069,7 +1069,7 @@ class RosterWindow:
                     accounts = accounts)
             account_name += ' (%s/%s)' % (repr(nbr_on), repr(nbr_total))
 
-        self.model[child_iter][Column.NAME] = account_name
+        self.model[child_iter][Column.NAME] = 
GLib.markup_escape_text(account_name)
 
         pep_dict = app.connections[account].pep
         if app.config.get('show_mood_in_roster') and 'mood' in pep_dict:



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/commit/309e844b4ee853c1dbb17108e517ff38e920b109

---
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/commit/309e844b4ee853c1dbb17108e517ff38e920b109
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to