Skip to content

Commit ea3a5ec

Browse files
committed
add notifications for file errors
1 parent df8805a commit ea3a5ec

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

extension.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ class BingWallpaperIndicator extends Button {
286286

287287
let toggles = [ /*{key: 'set-background', toggle: this.toggleSetBackground},*/
288288
{key: 'revert-to-current-image', toggle: this.toggleSelectNew},
289-
{key: 'notify', toggle: this.toggleNotifications},
289+
/*{key: 'notify', toggle: this.toggleNotifications},*/
290290
/*{key: 'show-count-in-image-title', toggle: this.toggleImageCount},*/
291291
{key: 'random-mode-enabled', toggle: this.toggleShuffle},
292292
{key: 'random-mode-include-only-favourites', toggle: this.toggleShuffleOnlyFaves},
@@ -317,17 +317,17 @@ class BingWallpaperIndicator extends Button {
317317

318318
_setBooleanSetting(key, state) {
319319
let success = this._settings.set_boolean(key, state);
320-
log('key '+key+' set to ' + (state?'true':'false') + ' returned ' + (success?'true':'false'));
320+
log('key '+key+' set to ' + (state?'true':'false') + ' (returned ' + (success?'true':'false')+')');
321321
}
322322

323323
_setStringSetting(key, value) {
324324
let success = this._settings.set_string(key, value);
325-
log('key '+key+' set to ' + value + ' returned ' + (success?'true':'false'));
325+
log('key '+key+' set to ' + value + ' (returned ' + (success?'true':'false')+')');
326326
}
327327

328328
_setIntSetting(key, value) {
329329
let success = this._settings.set_int(key, value);
330-
log('key '+key+' set to ' + value + ' returned ' + (success?'true':'false'));
330+
log('key '+key+' set to ' + value + ' (returned ' + (success?'true':'false')+')');
331331
}
332332

333333
_onDestroy() {
@@ -1063,7 +1063,9 @@ class BingWallpaperIndicator extends Button {
10631063
let BingWallpaperDir = Utils.getWallpaperDir(this._settings);
10641064
let dir = Gio.file_new_for_path(BingWallpaperDir);
10651065
if (!dir.query_exists(null)) {
1066-
dir.make_directory_with_parents(null);
1066+
//dir.make_directory_with_parents(null);
1067+
notifyError('Download folder '+BingWallpaperDir+' does not exist or is not writable');
1068+
return;
10671069
}
10681070
log("Downloading " + url + " to " + file.get_uri());
10691071
let request = Soup.Message.new('GET', url);
@@ -1107,6 +1109,7 @@ class BingWallpaperIndicator extends Button {
11071109
}
11081110
catch(e) {
11091111
log('Error writing file: ' + e);
1112+
notifyError('Image '+file+' is not writable, check directory permissions '+e);
11101113
}
11111114
}
11121115
);

utils.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,10 @@ export function getWallpaperDir(settings) {
369369
dir.make_directory_with_parents(null);
370370
}
371371
//FIXME: test if dir is good and writable
372-
return BingWallpaperDir;
372+
if (dir.query_exists(null))
373+
return BingWallpaperDir;
374+
else
375+
return null;
373376
}
374377

375378
export function setWallpaperDir(settings, uri) {

0 commit comments

Comments
 (0)