improve loading indicator

This commit is contained in:
Wolfgang R 2014-10-22 15:24:55 +02:00
parent 7be6bb5f09
commit fab357a20b
3 changed files with 13 additions and 8 deletions

View file

@ -94,6 +94,7 @@ const StatusElement = new Lang.Class({
stopLoading: function() {
this.isLoading = false;
Tweener.removeTweens(this);
this.opacity = 255;
}
});

View file

@ -64,8 +64,8 @@ let RandomWallpaperEntry = new Lang.Class({
newWallpaperItem.actor.connect('button-press-event', function() {
_this.statusIcon.startLoading();
wallpaperController.fetchNewWallpaper(function() {
_this.statusIcon.stopLoading();
_this.setHistoryList();
_this.statusIcon.stopLoading();
});
});

View file

@ -107,7 +107,7 @@ let WallpaperController = new Lang.Class({
return false;
},
_setBackground: function(path){
_setBackground: function(path, callback){
let background_setting = new Gio.Settings({schema: "org.gnome.desktop.background"});
/*
@ -119,6 +119,10 @@ let WallpaperController = new Lang.Class({
// Set a new Background-Image (should show up immediately):
if (background_setting.set_string("picture-uri", "file://"+path) ){
Gio.Settings.sync(); // Necessary: http://stackoverflow.com/questions/9985140
// call callback if given
if (callback) {
callback();
};
} else {
global.log("FAAILLEEDD");
}
@ -184,12 +188,12 @@ let WallpaperController = new Lang.Class({
// insert file into history
_this.history.unshift(historyid);
_this._setBackground(_this.wallpaperlocation + historyid);
// call callback if given
if (callback) {
callback();
};
_this._setBackground(_this.wallpaperlocation + historyid, function(){
// call callback if given
if (callback) {
callback();
};
});
});
});
},