in ChooseGPGKeyDialog, put None iter on top. Fixes #2390
This commit is contained in:
parent
282c8d3f33
commit
56c01ceace
2 changed files with 14 additions and 2 deletions
|
@ -1499,7 +1499,7 @@ class AccountModificationWindow:
|
|||
dialogs.ErrorDialog(_('Failed to get secret keys'),
|
||||
_('There was a problem retrieving your OpenPGP secret keys.'))
|
||||
return
|
||||
secret_keys['None'] = 'None'
|
||||
secret_keys[_('None')] = _('None')
|
||||
instance = dialogs.ChooseGPGKeyDialog(_('OpenPGP Key Selection'),
|
||||
_('Choose your OpenPGP key'), secret_keys)
|
||||
keyID = instance.run()
|
||||
|
@ -1508,7 +1508,7 @@ class AccountModificationWindow:
|
|||
checkbutton = self.xml.get_widget('gpg_save_password_checkbutton')
|
||||
gpg_key_label = self.xml.get_widget('gpg_key_label')
|
||||
gpg_name_label = self.xml.get_widget('gpg_name_label')
|
||||
if keyID[0] == 'None':
|
||||
if keyID[0] == _('None'):
|
||||
gpg_key_label.set_text(_('No key selected'))
|
||||
gpg_name_label.set_text('')
|
||||
checkbutton.set_sensitive(False)
|
||||
|
|
|
@ -254,6 +254,7 @@ class ChooseGPGKeyDialog:
|
|||
prompt_label = xml.get_widget('prompt_label')
|
||||
prompt_label.set_text(prompt_text)
|
||||
model = gtk.ListStore(str, str)
|
||||
model.set_sort_func(1, self.sort_keys)
|
||||
model.set_sort_column_id(1, gtk.SORT_ASCENDING)
|
||||
self.keys_treeview.set_model(model)
|
||||
#columns
|
||||
|
@ -266,6 +267,17 @@ class ChooseGPGKeyDialog:
|
|||
self.fill_tree(secret_keys, selected)
|
||||
self.window.show_all()
|
||||
|
||||
def sort_keys(self, model, iter1, iter2):
|
||||
value1 = model[iter1][1]
|
||||
value2 = model[iter2][1]
|
||||
if value1 == _('None'):
|
||||
return -1
|
||||
elif value2 == _('None'):
|
||||
return 1
|
||||
elif value1 < value2:
|
||||
return -1
|
||||
return 1
|
||||
|
||||
def run(self):
|
||||
rep = self.window.run()
|
||||
if rep == gtk.RESPONSE_OK:
|
||||
|
|
Loading…
Add table
Reference in a new issue