rebuild history list on history change

This commit is contained in:
Wolfgang Rumpler 2018-08-03 17:01:43 +02:00
parent b96eab2f34
commit f282c53bd9
2 changed files with 7 additions and 4 deletions

View file

@ -152,8 +152,6 @@ var RandomWallpaperEntry = new Lang.Class({
});
this.menu.actor.connect('show', function () {
wallpaperController.update();
this.setHistoryList(); // TODO: move this call to a new background changed hook (because overhead on close)
this.newWallpaperItem.show();
}.bind(this));
@ -167,6 +165,7 @@ var RandomWallpaperEntry = new Lang.Class({
wallpaperController.resetWallpaper();
});
settings.observe('history', this.setHistoryList.bind(this));
},
setCurrentBackgroundElement: function () {
@ -182,6 +181,7 @@ var RandomWallpaperEntry = new Lang.Class({
},
setHistoryList: function () {
wallpaperController.update();
this.setCurrentBackgroundElement();
this.historySection.removeAll();

View file

@ -245,13 +245,16 @@ var RandomWallpaperSettings = new Lang.Class({
_bindButtons: function () {
let newWallpaperButton = this._builder.get_object('request-new-wallpaper');
let origNewWallpaperText = newWallpaperButton.get_label();
newWallpaperButton.connect('clicked', () => {
let text = newWallpaperButton.get_label();
newWallpaperButton.set_label("Loading ...");
newWallpaperButton.set_sensitive(false);
this._wallpaperController.update();
this._wallpaperController.fetchNewWallpaper(()=>{
this._wallpaperController.update();
newWallpaperButton.set_label(text);
newWallpaperButton.set_label(origNewWallpaperText);
newWallpaperButton.set_sensitive(true);
});
});