Skip to content

Commit

Permalink
Merge pull request #219 from neffo/version-47
Browse files Browse the repository at this point in the history
Version 47
  • Loading branch information
neffo authored Oct 27, 2023
2 parents e0e445a + 91c7ad1 commit bbae510
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 146 deletions.
6 changes: 0 additions & 6 deletions blur.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,11 @@
// and https://github.com/sunwxg/gnome-shell-extension-unlockDialogBackground

import St from 'gi://St';
import Shell from 'gi://Shell';
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
import * as Background from 'resource:///org/gnome/shell/ui/background.js';
import * as ScreenShield from 'resource:///org/gnome/shell/ui/screenShield.js';
import * as UnlockDialog from 'resource:///org/gnome/shell/ui/unlockDialog.js';
import * as Config from 'resource:///org/gnome/shell/misc/config.js';
import {Extension} from 'resource:///org/gnome/shell/extensions/extension.js';
var _updateBackgroundEffects = UnlockDialog.UnlockDialog.prototype._updateBackgroundEffects;
var _showClock = UnlockDialog.UnlockDialog.prototype._showClock;
var _showPrompt = UnlockDialog.UnlockDialog.prototype._showPrompt;
import * as Utils from './utils.js';

var shellVersionMajor = parseInt(Config.PACKAGE_VERSION.split('.')[0]);
var shellVersionMinor = parseInt(Config.PACKAGE_VERSION.split('.')[1]);
Expand Down
2 changes: 1 addition & 1 deletion buildzip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
glib-compile-schemas schemas/
intltool-extract --type=gettext/glade ui/Settings4.ui
intltool-extract --type=gettext/glade ui/carousel4.ui
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
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

DATE=`date +"%F"`
echo "# Translation status of statements as at $DATE:" > translations.txt
Expand Down
41 changes: 5 additions & 36 deletions carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,18 @@
// Based on GNOME shell extension NASA APOD by Elia Argentieri https://github.com/Elinvention/gnome-shell-extension-nasa-apod

import Gtk from 'gi://Gtk';
import Gdk from 'gi://Gdk';
import GdkPixbuf from 'gi://GdkPixbuf';
import Gio from 'gi://Gio';
import GLib from 'gi://GLib';
import * as Utils from './utils.js';
import {ExtensionPreferences, gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
import {gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';

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

const GALLERY_THUMB_WIDTH = 320;
const GALLERY_THUMB_HEIGHT = 180;

export default class Carousel {
constructor(settings, button = null, callbackfunc = null, prefs_flowbox = null) {
constructor(settings, button = null, callbackfunc = null, prefs_flowbox = null, extensionPath = null) {
//create_gallery(widget, settings);
this.settings = settings;
this.button = button;
Expand All @@ -30,27 +28,12 @@ export default class Carousel {
this.window = null;
this.imageList = Utils.imageListSortByDate(Utils.getImageList(this.settings)).reverse(); // get images and reverse order
this.searchEntry = null;
this.extensionPath = ExtensionPreferences.lookupByUUID('[email protected]').path
this.extensionPath = extensionPath

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

if (!prefs_flowbox) {
[this.window, this.flowBox] = this._create_gallery_window(_('Bing Wallpaper Gallery'), default_dimensions);
if (Gtk.get_major_version() < 4)
this.window.show_all();
else
this.window.show();
//this.window.connect('destroy', this._enable_button);
}
else {
this.flowBox = prefs_flowbox;
}
if (Gtk.get_major_version() < 4) {
this._create_gallery();
}
else {
this.flowBox.insert(this._create_placeholder_item(), -1);
}
this.flowBox = prefs_flowbox;
this.flowBox.insert(this._create_placeholder_item(), -1);
}

_enable_button() {
Expand All @@ -59,20 +42,6 @@ export default class Carousel {
}
}

_create_gallery_window(title, dimensions) {
let buildable = new Gtk.Builder();
let win = new Gtk.Window();
let flowBox;

win.set_default_size(dimensions[2], dimensions[3]);
win.set_title(title);

buildable.add_objects_from_file(this.extensionPath + '/ui/carousel4.ui', ['carouselViewPort']);
flowBox = buildable.get_object('carouselFlowBox');
win.set_child(buildable.get_object('carouselScrollable'));
return [win, flowBox];
}

_create_gallery() {
Utils.randomIntervals.forEach((x) => {
let item = this._create_random_item(x.value, _(x.title));
Expand Down
61 changes: 0 additions & 61 deletions convenience.js

This file was deleted.

12 changes: 0 additions & 12 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,18 @@ import GObject from 'gi://GObject';
import GLib from 'gi://GLib';
import Clutter from 'gi://Clutter';
import Cogl from 'gi://Cogl';
import Gdk from 'gi://Gdk';

import * as Main from 'resource:///org/gnome/shell/ui/main.js';
import * as MessageTray from 'resource:///org/gnome/shell/ui/messageTray.js';
import * as Util from 'resource:///org/gnome/shell/misc/util.js';
import {Button} from 'resource:///org/gnome/shell/ui/panelMenu.js';
import * as PopupMenu from 'resource:///org/gnome/shell/ui/popupMenu.js';
import * as Config from 'resource:///org/gnome/shell/misc/config.js';
const ByteArray = imports.byteArray;

import {Extension, gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js';
import * as Utils from './utils.js';
import Blur from './blur.js';
import Thumbnail from './thumbnail.js';
import BWClipboard from './BWClipboard.js';
import * as Convenience from './convenience.js';

const BingImageURL = Utils.BingImageURL;
const BingURL = 'https://www.bing.com';
Expand Down Expand Up @@ -1017,14 +1013,6 @@ export default class BingWallpaperExtension extends Extension {
bingWallpaperIndicator.stop();
bingWallpaperIndicator.destroy();
bingWallpaperIndicator = null;

// *** NOTE for EGO reviewers ***
// blur.js remains active during lockscreen, while the rest of the extension is disabled
// this code ONLY modifies the background blur effects for the lockscreen no web connectivity
if (!Main.sessionMode.isLocked) {
blur._disable(); // disable blur (blur.js) override and cleanup
blur = null;
}
}
}

Expand Down
Binary file modified locale/de/LC_MESSAGES/BingWallpaper.mo
Binary file not shown.
4 changes: 2 additions & 2 deletions locale/de/LC_MESSAGES/BingWallpaper.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-14 18:32+1000\n"
"PO-Revision-Date: 2023-10-22 10:31+0200\n"
"PO-Revision-Date: 2023-10-23 08:47+0200\n"
"Last-Translator: Sebastian Kessler\n"
"Language-Team: \n"
"Language: de\n"
Expand Down Expand Up @@ -325,7 +325,7 @@ msgstr "Shuffle-Modus für Bilder"

#: extension.js:162
msgid "Image shuffle only favourites"
msgstr "Shuffle-Modus nur Bilder"
msgstr "Shuffle-Modus nur Favoriten"

#: extension.js:164
msgid "Show image count"
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "Bing Wallpaper",
"settings-schema": "org.gnome.shell.extensions.bingwallpaper",
"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:",
"version": "46",
"version": "47",
"url": "https://github.com/neffo/bing-wallpaper-gnome-extension",
"gettext-domain": "BingWallpaper"
}
5 changes: 1 addition & 4 deletions prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@

import Gtk from 'gi://Gtk';
import Gdk from 'gi://Gdk';
import GdkPixbuf from 'gi://GdkPixbuf';
import Gio from 'gi://Gio';
import GLib from 'gi://GLib';
import Soup from 'gi://Soup';
import Adw from 'gi://Adw';
import {ExtensionPreferences, gettext as _} from 'resource:///org/gnome/Shell/Extensions/js/extensions/prefs.js';
import * as Config from 'resource:///org/gnome/Shell/Extensions/js/misc/config.js';
import * as Utils from './utils.js';
import * as Convenience from './convenience.js';
import Carousel from './carousel.js';

const BingImageURL = Utils.BingImageURL;
Expand Down Expand Up @@ -137,7 +134,7 @@ export default class BingWallpaperExtensionPreferences extends ExtensionPreferen
});

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

// this is intended for migrating image folders between computers (or even sharing) or backups
// we export the Bing JSON data to the image directory, so this folder becomes portable
Expand Down
24 changes: 1 addition & 23 deletions utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import Gio from 'gi://Gio';
import GLib from 'gi://GLib';
import Soup from 'gi://Soup';
import GdkPixbuf from 'gi://GdkPixbuf';
import * as Convenience from './convenience.js';
//import {Extension, gettext as _} from 'resource:///org/gnome/shell/extensions/extension.js';

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

export function is_x11(settings) {
return settings.get_boolean('override-unsafe-wayland') || GLib.getenv('XDG_SESSION_TYPE') == 'x11'; // don't do wayland unsafe things if set
}

export function imageHasBasename(image_item, i, b) {
//log("imageHasBasename : " + image_item.urlbase + " =? " + this);
if (this && this.search(image_item.urlbase.replace('th?id=OHR.', '')))
Expand Down Expand Up @@ -196,7 +190,6 @@ export function setImageList(settings, imageList) {
}

export function setImageHiddenStatus(settings, hide_image_list, hide_status) {
// stub
// get current image list
let image_list = getImageList(settings);
image_list.forEach( (x, i) => {
Expand Down Expand Up @@ -255,21 +248,6 @@ export function getCurrentImage(imageList) {
return imageList[index];
}

function getFetchableImageList(settings) {
let imageList = getImageList(settings);
let cutOff = GLib.DateTime.new_now_utc().add_days(-8); // 8 days ago
let dlList = [];
imageList.forEach( function (x, i) {
let diff = dateFromLongDate(x.fullstartdate, 0).difference(cutOff);
let filename = imageToFilename(settings, x);
// image is still downloadable (< 8 days old) but not on disk
if (diff > 0 && !Gio.file_new_for_path(filename).query_exists(null)) {
dlList.push(x);
}
});
return dlList;
}

export function inImageList(imageList, urlbase) {
let image = null;
imageList.forEach(function(x, i) {
Expand Down Expand Up @@ -423,7 +401,7 @@ export function friendly_time_diff(time, short = true) {
}
}

function seconds_until(until) {
export function seconds_until(until) {
let now = GLib.DateTime.new_now_local();
let end, day;
if (until == 'hourly') {
Expand Down

0 comments on commit bbae510

Please sign in to comment.