mirror of
https://github.com/Hopiu/RandomWallpaperGnome3.git
synced 2026-05-03 21:04:43 +00:00
improve loading indicator
This commit is contained in:
parent
7be6bb5f09
commit
fab357a20b
3 changed files with 13 additions and 8 deletions
|
|
@ -94,6 +94,7 @@ const StatusElement = new Lang.Class({
|
|||
stopLoading: function() {
|
||||
this.isLoading = false;
|
||||
Tweener.removeTweens(this);
|
||||
this.opacity = 255;
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
};
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue