Skip to content

Commit bbae510

Browse files
authored
Merge pull request #219 from neffo/version-47
Version 47
2 parents e0e445a + 91c7ad1 commit bbae510

File tree

10 files changed

+11
-146
lines changed

10 files changed

+11
-146
lines changed

blur.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,11 @@
1010
// and https://github.com/sunwxg/gnome-shell-extension-unlockDialogBackground
1111

1212
import St from 'gi://St';
13-
import Shell from 'gi://Shell';
14-
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
15-
import * as Background from 'resource:///org/gnome/shell/ui/background.js';
16-
import * as ScreenShield from 'resource:///org/gnome/shell/ui/screenShield.js';
1713
import * as UnlockDialog from 'resource:///org/gnome/shell/ui/unlockDialog.js';
1814
import * as Config from 'resource:///org/gnome/shell/misc/config.js';
19-
import {Extension} from 'resource:///org/gnome/shell/extensions/extension.js';
2015
var _updateBackgroundEffects = UnlockDialog.UnlockDialog.prototype._updateBackgroundEffects;
2116
var _showClock = UnlockDialog.UnlockDialog.prototype._showClock;
2217
var _showPrompt = UnlockDialog.UnlockDialog.prototype._showPrompt;
23-
import * as Utils from './utils.js';
2418

2519
var shellVersionMajor = parseInt(Config.PACKAGE_VERSION.split('.')[0]);
2620
var shellVersionMinor = parseInt(Config.PACKAGE_VERSION.split('.')[1]);

buildzip.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
glib-compile-schemas schemas/
88
intltool-extract --type=gettext/glade ui/Settings4.ui
99
intltool-extract --type=gettext/glade ui/carousel4.ui
10-
xgettext -k -k_ -kN_ --omit-header -o locale/BingWallpaper.pot ui/Settings4.ui.h ui/carousel4.ui.h ui/intervals.utils.js.h extension.js prefs.js blur.js utils.js convenience.js --from-code=UTF-8
10+
xgettext -k -k_ -kN_ --omit-header -o locale/BingWallpaper.pot ui/Settings4.ui.h ui/carousel4.ui.h ui/intervals.utils.js.h extension.js prefs.js blur.js utils.js --from-code=UTF-8
1111

1212
DATE=`date +"%F"`
1313
echo "# Translation status of statements as at $DATE:" > translations.txt

carousel.js

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,18 @@
88
// Based on GNOME shell extension NASA APOD by Elia Argentieri https://github.com/Elinvention/gnome-shell-extension-nasa-apod
99

1010
import Gtk from 'gi://Gtk';
11-
import Gdk from 'gi://Gdk';
1211
import GdkPixbuf from 'gi://GdkPixbuf';
1312
import Gio from 'gi://Gio';
14-
import GLib from 'gi://GLib';
1513
import * as Utils from './utils.js';
16-
import {ExtensionPreferences, gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
14+
import {gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
1715

1816
const default_dimensions = [30, 30, 1650, 800]; // TODO: pull from and save dimensions to settings, but perhaps verify that dimensions are ok
1917

2018
const GALLERY_THUMB_WIDTH = 320;
2119
const GALLERY_THUMB_HEIGHT = 180;
2220

2321
export default class Carousel {
24-
constructor(settings, button = null, callbackfunc = null, prefs_flowbox = null) {
22+
constructor(settings, button = null, callbackfunc = null, prefs_flowbox = null, extensionPath = null) {
2523
//create_gallery(widget, settings);
2624
this.settings = settings;
2725
this.button = button;
@@ -30,27 +28,12 @@ export default class Carousel {
3028
this.window = null;
3129
this.imageList = Utils.imageListSortByDate(Utils.getImageList(this.settings)).reverse(); // get images and reverse order
3230
this.searchEntry = null;
33-
this.extensionPath = ExtensionPreferences.lookupByUUID('[email protected]').path
31+
this.extensionPath = extensionPath
3432

3533
this.log('create carousel...');
3634

37-
if (!prefs_flowbox) {
38-
[this.window, this.flowBox] = this._create_gallery_window(_('Bing Wallpaper Gallery'), default_dimensions);
39-
if (Gtk.get_major_version() < 4)
40-
this.window.show_all();
41-
else
42-
this.window.show();
43-
//this.window.connect('destroy', this._enable_button);
44-
}
45-
else {
46-
this.flowBox = prefs_flowbox;
47-
}
48-
if (Gtk.get_major_version() < 4) {
49-
this._create_gallery();
50-
}
51-
else {
52-
this.flowBox.insert(this._create_placeholder_item(), -1);
53-
}
35+
this.flowBox = prefs_flowbox;
36+
this.flowBox.insert(this._create_placeholder_item(), -1);
5437
}
5538

5639
_enable_button() {
@@ -59,20 +42,6 @@ export default class Carousel {
5942
}
6043
}
6144

62-
_create_gallery_window(title, dimensions) {
63-
let buildable = new Gtk.Builder();
64-
let win = new Gtk.Window();
65-
let flowBox;
66-
67-
win.set_default_size(dimensions[2], dimensions[3]);
68-
win.set_title(title);
69-
70-
buildable.add_objects_from_file(this.extensionPath + '/ui/carousel4.ui', ['carouselViewPort']);
71-
flowBox = buildable.get_object('carouselFlowBox');
72-
win.set_child(buildable.get_object('carouselScrollable'));
73-
return [win, flowBox];
74-
}
75-
7645
_create_gallery() {
7746
Utils.randomIntervals.forEach((x) => {
7847
let item = this._create_random_item(x.value, _(x.title));

convenience.js

Lines changed: 0 additions & 61 deletions
This file was deleted.

extension.js

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,18 @@ import GObject from 'gi://GObject';
1414
import GLib from 'gi://GLib';
1515
import Clutter from 'gi://Clutter';
1616
import Cogl from 'gi://Cogl';
17-
import Gdk from 'gi://Gdk';
1817

1918
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
2019
import * as MessageTray from 'resource:///org/gnome/shell/ui/messageTray.js';
21-
import * as Util from 'resource:///org/gnome/shell/misc/util.js';
2220
import {Button} from 'resource:///org/gnome/shell/ui/panelMenu.js';
2321
import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js';
2422
import * as Config from 'resource:///org/gnome/shell/misc/config.js';
25-
const ByteArray = imports.byteArray;
2623

2724
import {Extension, gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js';
2825
import * as Utils from './utils.js';
2926
import Blur from './blur.js';
3027
import Thumbnail from './thumbnail.js';
3128
import BWClipboard from './BWClipboard.js';
32-
import * as Convenience from './convenience.js';
3329

3430
const BingImageURL = Utils.BingImageURL;
3531
const BingURL = 'https://www.bing.com';
@@ -1017,14 +1013,6 @@ export default class BingWallpaperExtension extends Extension {
10171013
bingWallpaperIndicator.stop();
10181014
bingWallpaperIndicator.destroy();
10191015
bingWallpaperIndicator = null;
1020-
1021-
// *** NOTE for EGO reviewers ***
1022-
// blur.js remains active during lockscreen, while the rest of the extension is disabled
1023-
// this code ONLY modifies the background blur effects for the lockscreen no web connectivity
1024-
if (!Main.sessionMode.isLocked) {
1025-
blur._disable(); // disable blur (blur.js) override and cleanup
1026-
blur = null;
1027-
}
10281016
}
10291017
}
10301018

3 Bytes
Binary file not shown.

locale/de/LC_MESSAGES/BingWallpaper.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgstr ""
88
"Project-Id-Version: \n"
99
"Report-Msgid-Bugs-To: \n"
1010
"POT-Creation-Date: 2021-12-14 18:32+1000\n"
11-
"PO-Revision-Date: 2023-10-22 10:31+0200\n"
11+
"PO-Revision-Date: 2023-10-23 08:47+0200\n"
1212
"Last-Translator: Sebastian Kessler\n"
1313
"Language-Team: \n"
1414
"Language: de\n"
@@ -325,7 +325,7 @@ msgstr "Shuffle-Modus für Bilder"
325325

326326
#: extension.js:162
327327
msgid "Image shuffle only favourites"
328-
msgstr "Shuffle-Modus nur Bilder"
328+
msgstr "Shuffle-Modus nur Favoriten"
329329

330330
#: extension.js:164
331331
msgid "Show image count"

metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"name": "Bing Wallpaper",
55
"settings-schema": "org.gnome.shell.extensions.bingwallpaper",
66
"description": "Sync your wallpaper to today's Microsoft Bing image of the day (the image you see when you visit Bing.com).\n\n *Disclaimer*: this extension is unofficial and not affiliated with Bing or Microsoft in any way. Images are protected by copyright and are licensed only for use as wallpapers.\n\nFeatures:\n* UHD resolution wallpapers\n* Automatically fetches current Bing wallpaper of the day and sets as both lock screen and desktop wallpaper (user selectable on GNOME versions that support it)\n* Doesn't poll continuously - only once per day and on startup (schedules a refresh when Bing is due to update)\n * random mode (from previously downloaded wallpapers)\n *NEW: select/cycle wallpaper through previously downloaded images\n* Language support: English (en), German (de), Dutch (nl), Italian (it), Polish (pl), Chinese (zh_CN, zh_TW), French (fr), Portuguese (pt), Ukrainian (uk), Russian (ru_RU), Spanish (es), Korean (ko), Indonesian (id), Catalan (ca), Norwegian Bokmål (nb) & Nynorsk (ni), Swedish (sv), Arabic (ar), Hungarian (hu) and Japanese (ja) - a HUGE thanks to the translators\n\nThis extension was forked from the NASA APOD extension by Elinvention (https://github.com/Elinvention) and inspired by Bing Desktop Wallpaper Changer by Utkarsh Gupta (https://github.com/UtkarshGpta).\n\nAlways restart GNOME after manually updating extensions. Please report bugs to the GitHub page below:",
7-
"version": "46",
7+
"version": "47",
88
"url": "https://github.com/neffo/bing-wallpaper-gnome-extension",
99
"gettext-domain": "BingWallpaper"
1010
}

prefs.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,12 @@
99

1010
import Gtk from 'gi://Gtk';
1111
import Gdk from 'gi://Gdk';
12-
import GdkPixbuf from 'gi://GdkPixbuf';
1312
import Gio from 'gi://Gio';
14-
import GLib from 'gi://GLib';
1513
import Soup from 'gi://Soup';
1614
import Adw from 'gi://Adw';
1715
import {ExtensionPreferences, gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
1816
import * as Config from 'resource:///org/gnome/Shell/Extensions/js/misc/config.js';
1917
import * as Utils from './utils.js';
20-
import * as Convenience from './convenience.js';
2118
import Carousel from './carousel.js';
2219

2320
const BingImageURL = Utils.BingImageURL;
@@ -137,7 +134,7 @@ export default class BingWallpaperExtensionPreferences extends ExtensionPreferen
137134
});
138135

139136
// we populate the tab (gtk4+, gnome 40+), this was previously a button to open a new window in gtk3
140-
carousel = new Carousel(settings, null, null, carouselFlowBox); // auto load carousel
137+
carousel = new Carousel(settings, null, null, carouselFlowBox, this.dir.get_path()); // auto load carousel
141138

142139
// this is intended for migrating image folders between computers (or even sharing) or backups
143140
// we export the Bing JSON data to the image directory, so this folder becomes portable

utils.js

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ import Gio from 'gi://Gio';
1111
import GLib from 'gi://GLib';
1212
import Soup from 'gi://Soup';
1313
import GdkPixbuf from 'gi://GdkPixbuf';
14-
import * as Convenience from './convenience.js';
15-
//import {Extension, gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js';
1614

1715
export var PRESET_GNOME_DEFAULT = { blur: 60, dim: 55 }; // as at GNOME 40
1816
export var PRESET_NO_BLUR = { blur: 0, dim: 60 };
@@ -137,10 +135,6 @@ export function set_blur_preset(settings, preset) {
137135
BingLog("Set blur preset to " + preset.blur + " brightness to " + preset.dim);
138136
}
139137

140-
export function is_x11(settings) {
141-
return settings.get_boolean('override-unsafe-wayland') || GLib.getenv('XDG_SESSION_TYPE') == 'x11'; // don't do wayland unsafe things if set
142-
}
143-
144138
export function imageHasBasename(image_item, i, b) {
145139
//log("imageHasBasename : " + image_item.urlbase + " =? " + this);
146140
if (this && this.search(image_item.urlbase.replace('th?id=OHR.', '')))
@@ -196,7 +190,6 @@ export function setImageList(settings, imageList) {
196190
}
197191

198192
export function setImageHiddenStatus(settings, hide_image_list, hide_status) {
199-
// stub
200193
// get current image list
201194
let image_list = getImageList(settings);
202195
image_list.forEach( (x, i) => {
@@ -255,21 +248,6 @@ export function getCurrentImage(imageList) {
255248
return imageList[index];
256249
}
257250

258-
function getFetchableImageList(settings) {
259-
let imageList = getImageList(settings);
260-
let cutOff = GLib.DateTime.new_now_utc().add_days(-8); // 8 days ago
261-
let dlList = [];
262-
imageList.forEach( function (x, i) {
263-
let diff = dateFromLongDate(x.fullstartdate, 0).difference(cutOff);
264-
let filename = imageToFilename(settings, x);
265-
// image is still downloadable (< 8 days old) but not on disk
266-
if (diff > 0 && !Gio.file_new_for_path(filename).query_exists(null)) {
267-
dlList.push(x);
268-
}
269-
});
270-
return dlList;
271-
}
272-
273251
export function inImageList(imageList, urlbase) {
274252
let image = null;
275253
imageList.forEach(function(x, i) {
@@ -423,7 +401,7 @@ export function friendly_time_diff(time, short = true) {
423401
}
424402
}
425403

426-
function seconds_until(until) {
404+
export function seconds_until(until) {
427405
let now = GLib.DateTime.new_now_local();
428406
let end, day;
429407
if (until == 'hourly') {

0 commit comments

Comments
 (0)