Keep custom buffer ordering across restarts and changes in settings

This commit is contained in:
Manuel Cortez 2018-11-18 06:33:33 -06:00
parent 4c1cad7f61
commit c5e9e97c84
2 changed files with 9 additions and 4 deletions

View File

@ -2,6 +2,7 @@
## changes in this version ## changes in this version
* Custom buffer ordering will not be reseted every time the application restarts after an account setting has been modified.
* When adding or removing an user from a list, it is possible to press enter in the focused list instead of having to search for the "add" or "delete" button. * When adding or removing an user from a list, it is possible to press enter in the focused list instead of having to search for the "add" or "delete" button.
* Quoted and long tweets are displayed properly in the sent tweets buffer after being send. ([#253](https://github.com/manuelcortez/TWBlue/issues/253)) * Quoted and long tweets are displayed properly in the sent tweets buffer after being send. ([#253](https://github.com/manuelcortez/TWBlue/issues/253))
* Fixed an issue that was making the list manager keystroke unable to be shown in the keystroke editor. Now the keystroke is listed properly. ([#260](https://github.com/manuelcortez/TWBlue/issues/260)) * Fixed an issue that was making the list manager keystroke unable to be shown in the keystroke editor. Now the keystroke is listed properly. ([#260](https://github.com/manuelcortez/TWBlue/issues/260))

View File

@ -211,7 +211,7 @@ class accountSettingsController(globalSettingsController):
else: else:
self.config["general"]["retweet_mode"] = "comment" self.config["general"]["retweet_mode"] = "comment"
buffers_list = self.dialog.buffers.get_list() buffers_list = self.dialog.buffers.get_list()
if set(self.config["general"]["buffer_order"]) != set(buffers_list) or buffers_list != self.config["general"]["buffer_order"]: if buffers_list != self.config["general"]["buffer_order"]:
self.needs_restart = True self.needs_restart = True
self.config["general"]["buffer_order"] = buffers_list self.config["general"]["buffer_order"] = buffers_list
self.config["reporting"]["speech_reporting"] = self.dialog.get_value("reporting", "speech_reporting") self.config["reporting"]["speech_reporting"] = self.dialog.get_value("reporting", "speech_reporting")
@ -291,10 +291,14 @@ class accountSettingsController(globalSettingsController):
all_buffers['muted']=_(u"Muted users") all_buffers['muted']=_(u"Muted users")
list_buffers = [] list_buffers = []
hidden_buffers=[] hidden_buffers=[]
for i in all_buffers.keys(): all_buffers_keys = all_buffers.keys()
if i in self.config["general"]["buffer_order"]: # Check buffers shown first.
for i in self.config["general"]["buffer_order"]:
if i in all_buffers_keys:
list_buffers.append((i, all_buffers[i], True)) list_buffers.append((i, all_buffers[i], True))
else: # This second pass will retrieve all hidden buffers.
for i in all_buffers_keys:
if i not in self.config["general"]["buffer_order"]:
hidden_buffers.append((i, all_buffers[i], False)) hidden_buffers.append((i, all_buffers[i], False))
list_buffers.extend(hidden_buffers) list_buffers.extend(hidden_buffers)
return list_buffers return list_buffers