diff --git a/buildzip.sh b/buildzip.sh
index dd97028..00196b9 100755
--- a/buildzip.sh
+++ b/buildzip.sh
@@ -11,9 +11,10 @@ intltool-extract --type=gettext/glade ui/Settings.ui
intltool-extract --type=gettext/glade ui/Settings4.ui
xgettext -k -k_ -kN_ --omit-header -o locale/GoogleEarthWallpaper.pot ui/Settings.ui.h ui/Settings4.ui.h extension.js prefs.js utils.js --from-code=UTF-8
+rm translations.txt
for D in locale/*; do
if [ -d "${D}" ]; then
- msgfmt --statistics --template=locale/GoogleEarthWallpaper.pot --verbose -o "${D}/LC_MESSAGES/GoogleEarthWallpaper.mo" "${D}/LC_MESSAGES/GoogleEarthWallpaper.po" 2> translations.txt # compile translations
+ msgfmt --statistics --template=locale/GoogleEarthWallpaper.pot --verbose -o "${D}/LC_MESSAGES/GoogleEarthWallpaper.mo" "${D}/LC_MESSAGES/GoogleEarthWallpaper.po" 2>> translations.txt # compile translations
fi
done
diff --git a/convenience.js b/convenience.js
index 8388672..3d17f01 100644
--- a/convenience.js
+++ b/convenience.js
@@ -63,7 +63,7 @@ function versionSmaller(a, b) {
}
function currentVersion() {
- return Config.PACKAGE_VERSION;
+ return ''+Config.PACKAGE_VERSION.replace(/(alpha|beta)/,'0');
}
function currentVersionEqual(v) {
diff --git a/extension.js b/extension.js
index 94f7a9e..5d62c43 100644
--- a/extension.js
+++ b/extension.js
@@ -10,7 +10,7 @@
/*eslint class-methods-use-this: "off"*/
const {St, Soup, Gio, GLib, Clutter, GObject} = imports.gi;
-const {main, panelMenu, popupMenu} = imports.ui;
+const {main, panelMenu, popupMenu, messageTray} = imports.ui;
const Util = imports.misc.util;
const ExtensionUtils = imports.misc.extensionUtils;
@@ -48,7 +48,13 @@ function notifyError(msg) {
function doSetBackground(uri, schema) {
let gsettings = new Gio.Settings({schema: schema});
gsettings.set_string('picture-uri', 'file://' + uri);
- gsettings.set_string('picture-options', 'zoom');
+ try {
+ gsettings.set_string('picture-uri-dark', uri);
+ }
+ catch (e) {
+ log("unable to set dark background for : " + e);
+ }
+ //gsettings.set_string('picture-options', 'zoom');
Gio.Settings.sync();
gsettings.apply();
}
@@ -79,12 +85,13 @@ class GEWallpaperIndicator extends panelMenu.Button {
this.httpSession = new Soup.SessionAsync();
Soup.Session.prototype.add_feature.call(this.httpSession, new Soup.ProxyResolverDefault());
- this._settings.connect('changed::hide', function() {
+ this._settings.connect('changed::hide', () => {
getActorCompat(this).visible = !this._settings.get_boolean('hide');
});
getActorCompat(this).visible = !this._settings.get_boolean('hide');
this._settings.connect('changed::map-link-provider', this._updateProviderLink.bind(this));
+ this._settings.connect('changed::notify', this._notifyCurrentImage.bind(this));
getActorCompat(this).add_child(this.icon);
this._setIcon();
@@ -100,14 +107,19 @@ class GEWallpaperIndicator extends panelMenu.Button {
this.swallpaperItem = new popupMenu.PopupMenuItem(_("Set lockscreen image now"));
this.refreshItem = new popupMenu.PopupMenuItem(_("Refresh Now"));
this.settingsItem = new popupMenu.PopupMenuItem(_("Extension settings"));
+ this._wrapLabelItem(this.descriptionItem);
+ this._wrapLabelItem(this.copyrightItem);
// menu toggles for settings
this.wallpaperToggle = this._newMenuSwitch(_("Set background image"), "set-background", this._settings.get_boolean('set-background'), true);
this.lockscreenToggle = this._newMenuSwitch(_("Set lockscreen image"), "set-lock-screen", this._settings.get_boolean('set-lock-screen'), !Convenience.currentVersionGreaterEqual("3.36"));
+ this.notifyToggle = this._newMenuSwitch(_("Send notification"), "notify", this._settings.get_boolean('notify'), true);
this.menu.addMenuItem(this.descriptionItem);
this.menu.addMenuItem(this.locationItem);
+ this.menu.addMenuItem(this.copyrightItem);
this.menu.addMenuItem(this.extLinkItem);
+ this.menu.addMenuItem(new popupMenu.PopupSeparatorMenuItem());
this.menu.addMenuItem(this.refreshDueItem);
this.menu.addMenuItem(this.refreshItem);
this.menu.addMenuItem(new popupMenu.PopupSeparatorMenuItem());
@@ -116,6 +128,7 @@ class GEWallpaperIndicator extends panelMenu.Button {
// disable until fresh is done
this.refreshDueItem.setSensitive(false);
this.descriptionItem.setSensitive(false);
+ this.copyrightItem.setSensitive(false);
this.locationItem.setSensitive(false);
this.extLinkItem.connect('activate', this._open_link.bind(this));
@@ -132,6 +145,8 @@ class GEWallpaperIndicator extends panelMenu.Button {
if (!Convenience.currentVersionGreaterEqual("3.36")) { // lockscreen and desktop wallpaper are the same in GNOME 3.36+
this.menu.addMenuItem(this.lockscreenToggle);
}
+ this.menu.addMenuItem(this.notifyToggle);
+ this.menu.addMenuItem(new popupMenu.PopupSeparatorMenuItem());
this.menu.addMenuItem(this.settingsItem);
getActorCompat(this).connect('button-press-event', this._updateMenu.bind(this));
@@ -191,6 +206,31 @@ class GEWallpaperIndicator extends panelMenu.Button {
this.extLinkItem.label.set_text(this.provider_text);
}
+ _notifyCurrentImage() {
+ if (this._settings.get_boolean('notify') && this.filename != "") {
+ this._createNotification();
+ }
+ }
+
+ _createNotification() {
+ // set notifications icon
+ let source = new messageTray.Source('Google Earth Wallpaper', 'preferences-desktop-wallpaper-symbolic');
+ main.messageTray.add(source);
+ let msg = 'Google Earth Wallpaper';
+ let details = this.explanation+'\n'+Utils.friendly_coordinates(this.lat, this.lon)+'\n'+this.copyright;
+ let notification = new messageTray.Notification(source, msg, details);
+ notification.setTransient(this._settings.get_boolean('transient'));
+ source.showNotification(notification);
+ }
+
+ _wrapLabelItem(menuItem) {
+ let clutter_text = menuItem.label.get_clutter_text();
+ clutter_text.set_line_wrap(true);
+ clutter_text.set_ellipsize(0);
+ clutter_text.set_max_length(0);
+ menuItem.label.set_style('max-width: 420px;');
+ }
+
_getProviderLink(provider = this._settings.get_enum('map-link-provider')) {
switch(provider) {
case 1: // Google Maps
@@ -360,6 +400,7 @@ class GEWallpaperIndicator extends panelMenu.Button {
this._updatePending = false;
}
this._updateMenu();
+ this._notifyCurrentImage();
this._restartTimeout(this._settings.get_int('refresh-interval'));
}
diff --git a/locale/GoogleEarthWallpaper.pot b/locale/GoogleEarthWallpaper.pot
index 916c43e..933a2de 100644
--- a/locale/GoogleEarthWallpaper.pot
+++ b/locale/GoogleEarthWallpaper.pot
@@ -2,47 +2,47 @@
msgid "Hide the indicator"
msgstr ""
-#: ui/Settings.ui.h:2 ui/Settings4.ui.h:2
+#: ui/Settings.ui.h:2
msgid "Indicator brightness"
msgstr ""
-#: ui/Settings.ui.h:3 ui/Settings4.ui.h:3
+#: ui/Settings.ui.h:3 ui/Settings4.ui.h:2
msgid "Indicator"
msgstr ""
-#: ui/Settings.ui.h:4 ui/Settings4.ui.h:4
+#: ui/Settings.ui.h:4 ui/Settings4.ui.h:3
msgid "Indicator icon"
msgstr ""
-#: ui/Settings.ui.h:5 ui/Settings4.ui.h:5
+#: ui/Settings.ui.h:5 ui/Settings4.ui.h:4
msgid "Refresh interval"
msgstr ""
-#: ui/Settings.ui.h:6 ui/Settings4.ui.h:6
+#: ui/Settings.ui.h:6 ui/Settings4.ui.h:5
msgid "Change effective from next refresh"
msgstr ""
-#: ui/Settings.ui.h:7 ui/Settings4.ui.h:7
+#: ui/Settings.ui.h:7 ui/Settings4.ui.h:6
+msgid "Enable desktop notifications"
+msgstr ""
+
+#: ui/Settings.ui.h:8 ui/Settings4.ui.h:7
msgid "Map Provider for external links"
msgstr ""
-#: ui/Settings.ui.h:8 ui/Settings4.ui.h:8
+#: ui/Settings.ui.h:9 ui/Settings4.ui.h:8
msgid "Provider used to view wallpaper location and context"
msgstr ""
-#: ui/Settings.ui.h:9 ui/Settings4.ui.h:9 extension.js:105
+#: ui/Settings.ui.h:10 ui/Settings4.ui.h:9 extension.js:114
msgid "Set background image"
msgstr ""
-#: ui/Settings.ui.h:10 ui/Settings4.ui.h:10
-msgid "Set lock screen image"
-msgstr ""
-
#: ui/Settings.ui.h:11 ui/Settings4.ui.h:11
-msgid "Set lock screen password prompt image"
+msgid "Background style option"
msgstr ""
-#: ui/Settings.ui.h:12 ui/Settings4.ui.h:12
+#: ui/Settings.ui.h:12 ui/Settings4.ui.h:13
msgid "Download folder:"
msgstr ""
@@ -62,151 +62,159 @@ msgstr ""
msgid "Background"
msgstr ""
-#: ui/Settings.ui.h:17 ui/Settings4.ui.h:18
-msgid "Changes since last version"
-msgstr ""
-
-#: ui/Settings.ui.h:18 ui/Settings4.ui.h:19
+#: ui/Settings.ui.h:17
msgid "Change log"
msgstr ""
-#: ui/Settings.ui.h:19 ui/Settings4.ui.h:20
+#: ui/Settings.ui.h:18 ui/Settings4.ui.h:18
msgid ""
"This program comes with ABSOLUTELY NO WARRANTY.\n"
"See the GNU General "
"Public License, version 3 or later for details."
msgstr ""
-#: ui/Settings.ui.h:21 ui/Settings4.ui.h:22
+#: ui/Settings.ui.h:20 ui/Settings4.ui.h:20
msgid "https://github.com/neffo/earth-view-wallpaper-gnome-extension"
msgstr ""
-#: ui/Settings.ui.h:22 ui/Settings4.ui.h:23
+#: ui/Settings.ui.h:21 ui/Settings4.ui.h:21
msgid "Based on NASA APOD Wallpaper extension by Elia Argentieri"
msgstr ""
-#: ui/Settings.ui.h:23 ui/Settings4.ui.h:24
+#: ui/Settings.ui.h:22 ui/Settings4.ui.h:22
msgid ""
"This GNOME shell extension sets your wallpaper to a random Google Earth "
"photo from a selection of curated locations."
msgstr ""
-#: ui/Settings.ui.h:24 ui/Settings4.ui.h:25 extension.js:158 extension.js:303
+#: ui/Settings.ui.h:23 ui/Settings4.ui.h:23 extension.js:173 extension.js:343
msgid "Google Earth Wallpaper"
msgstr ""
-#: ui/Settings.ui.h:25 ui/Settings4.ui.h:26
+#: ui/Settings.ui.h:24 ui/Settings4.ui.h:24
msgid "Maintained by Michael Carroll"
msgstr ""
-#: ui/Settings.ui.h:26 ui/Settings4.ui.h:27
+#: ui/Settings.ui.h:25 ui/Settings4.ui.h:25
msgid "About"
msgstr ""
-#: ui/Settings4.ui.h:13
-msgid "Bing Wallpaper pictures folder"
+#: ui/Settings4.ui.h:10
+msgid "Sets background image for desktop and lockscreen"
+msgstr ""
+
+#: ui/Settings4.ui.h:12
+msgid "Select how the image is rendered on desktop"
msgstr ""
-#: extension.js:94
+#: extension.js:101
msgid ""
msgstr ""
-#: extension.js:95
+#: extension.js:102
msgid "Text Location"
msgstr ""
-#: extension.js:96
+#: extension.js:103
msgid "Geo Location"
msgstr ""
-#: extension.js:97
+#: extension.js:104
msgid "External Link"
msgstr ""
-#: extension.js:98
+#: extension.js:105
msgid "Copyright"
msgstr ""
-#: extension.js:99
+#: extension.js:106
msgid "Set background image now"
msgstr ""
-#: extension.js:100
+#: extension.js:107
msgid "Set lockscreen image now"
msgstr ""
-#: extension.js:101
+#: extension.js:108
msgid "Refresh Now"
msgstr ""
-#: extension.js:102
+#: extension.js:109
msgid "Extension settings"
msgstr ""
-#: extension.js:106
+#: extension.js:115
msgid "Set lockscreen image"
msgstr ""
-#: extension.js:130
+#: extension.js:116
+msgid "Send notification"
+msgstr ""
+
+#: extension.js:143
msgid "On refresh:"
msgstr ""
-#: extension.js:187
+#: extension.js:202
msgid "Next refresh"
msgstr ""
-#: extension.js:214
+#: extension.js:254
msgid "View in "
msgstr ""
-#: extension.js:269
+#: extension.js:309
msgid "Fetching..."
msgstr ""
-#: extension.js:357
+#: extension.js:397
msgid "No wallpaper available"
msgstr ""
-#: extension.js:358
+#: extension.js:398
msgid "Something went wrong..."
msgstr ""
-#: prefs.js:26
+#: prefs.js:27
msgid "5 m"
msgstr ""
-#: prefs.js:26
+#: prefs.js:27
msgid "10 m"
msgstr ""
-#: prefs.js:26
+#: prefs.js:27
msgid "30 m"
msgstr ""
-#: prefs.js:26
+#: prefs.js:27
msgid "60 m"
msgstr ""
-#: prefs.js:26
+#: prefs.js:27
msgid "90 m"
msgstr ""
-#: prefs.js:26
+#: prefs.js:27
msgid "daily"
msgstr ""
-#: utils.js:33 utils.js:36
+#: prefs.js:105
+msgid "Select folder"
+msgstr ""
+
+#: utils.js:35 utils.js:38
msgid "minutes"
msgstr ""
-#: utils.js:39
+#: utils.js:41
msgid "days"
msgstr ""
-#: utils.js:42
+#: utils.js:44
msgid "hours"
msgstr ""
-#: utils.js:69
+#: utils.js:71
msgid "No change log found for this release"
msgstr ""
diff --git a/locale/ar/LC_MESSAGES/ar.mo b/locale/ar/LC_MESSAGES/GoogleEarthWallpaper.mo
similarity index 100%
rename from locale/ar/LC_MESSAGES/ar.mo
rename to locale/ar/LC_MESSAGES/GoogleEarthWallpaper.mo
diff --git a/locale/ar/LC_MESSAGES/ar.po b/locale/ar/LC_MESSAGES/GoogleEarthWallpaper.po
similarity index 100%
rename from locale/ar/LC_MESSAGES/ar.po
rename to locale/ar/LC_MESSAGES/GoogleEarthWallpaper.po
diff --git a/metadata.json b/metadata.json
index 8f94b9a..f666abc 100644
--- a/metadata.json
+++ b/metadata.json
@@ -3,8 +3,8 @@
"shell-version": ["3.36", "3.38", "40", "41", "42"],
"name": "Google Earth Wallpaper",
"settings-schema": "org.gnome.shell.extensions.googleearthwallpaper",
- "description": "Lightweight GNOME shell extension to set your wallpaper to a random photo from the curated Google Earth collection (2604 photos).\n\n*Disclaimer*: this extension is unofficial and not affiliated with Google in any way. Images are protected by copyright and are licensed only for use as wallpapers.\n\nSee also my other extension, Bing Wallpaper Changer (https://github.com/neffo/bing-wallpaper-gnome-extension).\n\nFeatures:\n* Fetches a random Google Earth wallpaper and sets as both lock screen and desktop wallpaper\n* User selectable refresh intervals (default is once per day)\n* View location on Google Maps, Bing Maps, Gnome Maps, OpenStreetMaps\n* German, Dutch and Chinese translations\n\nPlease report any bugs or suggestions to extension GitHub page below.",
- "version": "14",
+ "description": "Lightweight GNOME shell extension to sets your wallpaper to a random photo from the curated Google Earth collection (2604 photos).\n\n*Disclaimer*: this extension is unofficial and not affiliated with Google in any way. Images are protected by copyright and are licensed only for use as wallpapers.\n\nSee also my other extension, Bing Wallpaper Changer (https://github.com/neffo/bing-wallpaper-gnome-extension).\n\nFeatures:\n* Fetches a random Google Earth wallpaper and sets as both lock screen and desktop wallpaper\n* User selectable refresh intervals (default is once per day)\n* View location on Google Maps, Bing Maps, Gnome Maps, OpenStreetMaps\n* German, Dutch and Chinese translations\n\nPlease report any bugs or suggestions to extension GitHub page below.",
+ "version": "15",
"url": "https://github.com/neffo/earth-view-wallpaper-gnome-extension",
"gettext-domain": "GoogleEarthWallpaper"
}
diff --git a/prefs.js b/prefs.js
index e73547e..c337d2d 100644
--- a/prefs.js
+++ b/prefs.js
@@ -20,6 +20,7 @@ const _ = Gettext.gettext;
const Images = Me.imports.images;
let settings;
+let desktop_settings;
let httpSession = null;
const intervals = [ 300, 600, 1800, 3600, 4800, 86400 ];
@@ -27,6 +28,9 @@ const interval_names = [ _("5 m"), _("10 m"), _("30 m"), _("60 m"), _("90 m"), _
const providerNames = ['Google Earth', 'Google Maps', 'Bing Maps', 'OpenStreetMap' , 'GNOME Maps'];
+var PREFS_DEFAULT_WIDTH = 800;
+var PREFS_DEFAULT_HEIGHT = 500;
+
function init() {
ExtensionUtils.initTranslations("GoogleEarthWallpaper");
}
@@ -34,6 +38,7 @@ function init() {
function buildPrefsWidget(){
// Prepare labels and controls
settings = ExtensionUtils.getSettings(Utils.schema);
+ desktop_settings = ExtensionUtils.getSettings(Utils.DESKTOP_SCHEMA);
let buildable = new Gtk.Builder();
if (Gtk.get_major_version() == 4) { // GTK4 removes some properties, and builder breaks when it sees them
buildable.add_from_file( Me.dir.get_path() + '/ui/Settings4.ui' );
@@ -43,14 +48,21 @@ function buildPrefsWidget(){
}
let box = buildable.get_object('prefs_widget');
+ if (Convenience.currentVersionGreaterEqual('40')) {
+ box.connect('realize', () => {
+ let window = box.get_root();
+ window.default_width = PREFS_DEFAULT_WIDTH;
+ window.default_height = PREFS_DEFAULT_HEIGHT;
+ });
+ }
+
buildable.get_object('extension_version').set_text(' v'+Me.metadata.version.toString());
buildable.get_object('extension_name').set_text(Me.metadata.name.toString());
let hideSwitch = buildable.get_object('hide');
let iconEntry = buildable.get_object('icon');
let bgSwitch = buildable.get_object('background');
- let lsSwitch = buildable.get_object('lock_screen');
- let ldSwitch = buildable.get_object('lock_dialog');
+ let styleEntry = buildable.get_object('background_style');
let fileChooser = buildable.get_object('download_folder');
let fileChooserBtn = buildable.get_object('download_folder_btn');
let deleteSwitch = buildable.get_object('delete_previous');
@@ -59,6 +71,7 @@ function buildPrefsWidget(){
let folderButton = buildable.get_object('button_open_download_folder');
let icon_image = buildable.get_object('icon_image');
let change_log = buildable.get_object('change_log');
+ let notifySwitch = buildable.get_object('notify');
// enable change log access
httpSession = new Soup.SessionAsync();
@@ -66,11 +79,8 @@ function buildPrefsWidget(){
// Indicator
settings.bind('hide', hideSwitch, 'active', Gio.SettingsBindFlags.DEFAULT);
-
+ settings.bind('notify', notifySwitch, 'active', Gio.SettingsBindFlags.DEFAULT);
settings.bind('set-background', bgSwitch, 'active', Gio.SettingsBindFlags.DEFAULT);
- settings.bind('set-lock-screen', lsSwitch, 'active', Gio.SettingsBindFlags.DEFAULT);
- settings.bind('set-lock-screen-dialog', ldSwitch, 'active', Gio.SettingsBindFlags.DEFAULT);
- //settings.bind('brightness', brightnessValue, 'value', Gio.SettingsBindFlags.DEFAULT);
// adjustable indicator icons
Utils.icon_list.forEach(function (iconname, index) { // add icons to dropdown list (aka a GtkComboText)
@@ -83,20 +93,27 @@ function buildPrefsWidget(){
iconEntry.set_active_id(settings.get_string('icon'));
Utils.validate_icon(settings, icon_image);
//download folder
+
if (Gtk.get_major_version() == 4) {
+ fileChooserBtn.set_label(settings.get_string('download-folder'));
fileChooserBtn.connect('clicked', function(widget) {
let parent = widget.get_root();
fileChooser.set_transient_for(parent);
- /* fileChooser.set_filename(Gio.File.new_for_path(settings.get_string('download-folder')));*/ //FIXME: unsure why this doesn't work
+ fileChooser.set_current_folder(Gio.File.new_for_path(settings.get_string('download-folder')).get_parent());
+ fileChooser.set_action(Gtk.FileChooserAction.SELECT_FOLDER);
+ fileChooser.set_transient_for(parent);
+ fileChooser.set_accept_label(_('Select folder'));
fileChooser.show();
});
fileChooser.connect('response', function(widget, response) {
if (response !== Gtk.ResponseType.ACCEPT) {
return;
}
- let fileURI = widget.get_file();
+ let fileURI = widget.get_file().get_uri().replace('file://', '');
log("fileChooser returned: "+fileURI);
fileChooserBtn.set_label(fileURI);
+ let oldPath = settings.get_string('download-folder');
+ Utils.moveImagesToNewFolder(settings, oldPath, fileURI);
settings.set_string('download-folder', fileURI);
});
folderButton.connect('clicked', function() {
@@ -150,19 +167,18 @@ function buildPrefsWidget(){
});
if (Convenience.currentVersionGreaterEqual("40.0")) {
- // GNOME 40 specific code
- lsSwitch.set_sensitive(false);
- ldSwitch.set_sensitive(false);
+ // GNOME 40+ specific code
}
else if (Convenience.currentVersionGreaterEqual("3.36")) {
// GNOME 3.36 - 3.38 specific code
- lsSwitch.set_sensitive(false);
- ldSwitch.set_sensitive(false);
- }
- else {
- // legacy GNOME versions less than 3.36
}
+ // background styles (e.g. zoom or span)
+ Utils.backgroundStyle.forEach((style) => {
+ styleEntry.append(style, style);
+ });
+ desktop_settings.bind('picture-options', styleEntry, 'active_id', Gio.SettingsBindFlags.DEFAULT);
+
// not required in GTK4 as widgets are displayed by default
if (Gtk.get_major_version() < 4)
box.show_all();
diff --git a/schemas/gschemas.compiled b/schemas/gschemas.compiled
index 877515b..5891f59 100644
Binary files a/schemas/gschemas.compiled and b/schemas/gschemas.compiled differ
diff --git a/schemas/org.gnome.shell.extensions.googleearthwallpaper.gschema.xml b/schemas/org.gnome.shell.extensions.googleearthwallpaper.gschema.xml
index d593936..91de069 100644
--- a/schemas/org.gnome.shell.extensions.googleearthwallpaper.gschema.xml
+++ b/schemas/org.gnome.shell.extensions.googleearthwallpaper.gschema.xml
@@ -24,7 +24,7 @@
- true
+ false
Send a notifications
Send a notification with explanation when the picture of the day is downloaded
@@ -60,7 +60,7 @@
- true
+ false
Log messages to systemd journal
Unlikely to be useful for ordinary users, but helpful for debugging
diff --git a/ui/Settings.ui b/ui/Settings.ui
index 3deae54..9ba7796 100644
--- a/ui/Settings.ui
+++ b/ui/Settings.ui
@@ -263,6 +263,47 @@ Author: Michael Carroll
+
+
+
@@ -432,11 +473,11 @@ Author: Michael Carroll
-
+
True
True
-
+
True
False
12
@@ -445,51 +486,13 @@ Author: Michael Carroll
12
32
-
+
True
False
- Set lock screen image
-
-
- 0
- 0
-
-
-
-
- True
- True
- end
- center
+ start
True
-
-
- 1
- 0
-
-
-
-
-
-
-
-
- True
- True
-
-
- True
- False
- 12
- 12
- 12
- 12
- 32
-
-
- True
- False
- Set lock screen password prompt image
+ Background style option
+ True
0
@@ -497,12 +500,9 @@ Author: Michael Carroll
-
+
True
- True
- end
- center
- True
+ False
1
@@ -656,7 +656,7 @@ Author: Michael Carroll
12
True
True
- Changes since last version
+ Changes since last version
True
diff --git a/ui/Settings.ui.h b/ui/Settings.ui.h
index 2f465ae..bb9a83d 100644
--- a/ui/Settings.ui.h
+++ b/ui/Settings.ui.h
@@ -4,17 +4,16 @@ char *s = N_("Indicator");
char *s = N_("Indicator icon");
char *s = N_("Refresh interval");
char *s = N_("Change effective from next refresh");
+char *s = N_("Enable desktop notifications");
char *s = N_("Map Provider for external links");
char *s = N_("Provider used to view wallpaper location and context");
char *s = N_("Set background image");
-char *s = N_("Set lock screen image");
-char *s = N_("Set lock screen password prompt image");
+char *s = N_("Background style option");
char *s = N_("Download folder:");
char *s = N_("Wallpaper pictures folder");
char *s = N_("Open download folder");
char *s = N_("Delete previously downloaded wallpapers:");
char *s = N_("Background");
-char *s = N_("Changes since last version");
char *s = N_("Change log");
char *s = N_("This program comes with ABSOLUTELY NO WARRANTY.\n"
"See the GNU General Public License, version 3 or later for details.");
diff --git a/ui/Settings4.ui b/ui/Settings4.ui
index 0628d62..e79096d 100644
--- a/ui/Settings4.ui
+++ b/ui/Settings4.ui
@@ -8,9 +8,9 @@
0
- left
+ top
0
- 1
+ 0
@@ -46,7 +46,7 @@
0
start
Hide the indicator
- 1
+ 0
@@ -68,39 +68,6 @@
-
0
@@ -120,7 +87,7 @@
0
start
Indicator icon
- 1
+ 0
@@ -214,6 +181,42 @@
+
+
+ 0
+
+
+ 0
+ 12
+ 12
+ 12
+ 12
+ 32
+
+
+ 0
+ Enable desktop notifications
+ 1
+
+ 0
+ 0
+
+
+
+
+
+ end
+ 1
+
+ 1
+ 0
+
+
+
+
+
+
+
@@ -332,6 +335,7 @@
0
+ start
Set background image
0
@@ -350,38 +354,18 @@
-
-
-
-
-
-
-
-
- 0
- 12
- 12
- 12
- 12
- 32
-
+
0
- Set lock screen image
+ start
+ Sets background image for desktop and lockscreen
+ 0
+
0
- 0
-
-
-
-
-
- end
- center
- 1
-
- 1
- 0
+ 1
@@ -390,9 +374,10 @@
-
+
+ 0
-
+
0
12
12
@@ -400,9 +385,12 @@
12
32
-
+
0
- Set lock screen password prompt image
+ start
+ 1
+ Background style option
+ 0
0
0
@@ -410,13 +398,26 @@
-
- end
- center
- 1
+
1
0
+ 1
+
+
+
+
+
+ 0
+ start
+ Select how the image is rendered on desktop
+ 0
+
+
+ 0
+ 1
@@ -446,7 +447,7 @@
False
end
True
- Bing Wallpaper pictures folder
+ Wallpaper pictures folder
1
0
@@ -526,37 +527,6 @@
-
-
- 3
-
-
- 0
- 12
- 12
- 12
- vertical
-
-
- 0
- 12
- 12
- 1
- 1
- Changes since last version
- 1
-
-
-
-
-
-
- 0
- Change log
-
-
-
-
2
@@ -639,6 +609,7 @@ See the <a href="https://www.gnu.org/licenses/gpl-3.0.html">GNU
0
This GNOME shell extension sets your wallpaper to a random Google Earth photo from a selection of curated locations.
+ center
1
0
@@ -712,6 +683,26 @@ See the <a href="https://www.gnu.org/licenses/gpl-3.0.html">GNU
+
+
+ 0
+ 12
+ 12
+ 12
+ vertical
+
+
+ 0
+ 12
+ 12
+ 1
+ 1
+ Changes since last version
+ 1
+
+
+
+
diff --git a/ui/Settings4.ui.h b/ui/Settings4.ui.h
index fe12c77..8f063e0 100644
--- a/ui/Settings4.ui.h
+++ b/ui/Settings4.ui.h
@@ -1,22 +1,20 @@
char *s = N_("Hide the indicator");
-char *s = N_("Indicator brightness");
char *s = N_("Indicator");
char *s = N_("Indicator icon");
char *s = N_("Refresh interval");
char *s = N_("Change effective from next refresh");
+char *s = N_("Enable desktop notifications");
char *s = N_("Map Provider for external links");
char *s = N_("Provider used to view wallpaper location and context");
char *s = N_("Set background image");
-char *s = N_("Set lock screen image");
-char *s = N_("Set lock screen password prompt image");
+char *s = N_("Sets background image for desktop and lockscreen");
+char *s = N_("Background style option");
+char *s = N_("Select how the image is rendered on desktop");
char *s = N_("Download folder:");
-char *s = N_("Bing Wallpaper pictures folder");
char *s = N_("Wallpaper pictures folder");
char *s = N_("Open download folder");
char *s = N_("Delete previously downloaded wallpapers:");
char *s = N_("Background");
-char *s = N_("Changes since last version");
-char *s = N_("Change log");
char *s = N_("This program comes with ABSOLUTELY NO WARRANTY.\n"
"See the GNU General Public License, version 3 or later for details.");
char *s = N_("https://github.com/neffo/earth-view-wallpaper-gnome-extension");
diff --git a/utils.js b/utils.js
index 5634ebc..294b339 100644
--- a/utils.js
+++ b/utils.js
@@ -16,9 +16,11 @@ const _ = Gettext.gettext;
var icon_list = ['pin', 'globe','official'];
var icon_list_filename = ['pin-symbolic', 'globe-symbolic', 'official'];
+var backgroundStyle = ['none', 'wallpaper', 'centered', 'scaled', 'stretched', 'zoom', 'spanned'];
var gitreleaseurl = 'https://api.github.com/repos/neffo/earth-view-wallpaper-gnome-extension/releases/tags/';
var schema = 'org.gnome.shell.extensions.googleearthwallpaper';
+var DESKTOP_SCHEMA = 'org.gnome.desktop.background';
function friendly_time_diff(time, short = true) {
// short we want to keep ~4-5 characters
@@ -98,3 +100,53 @@ function dump(object, level = 0) {
log(output);
return(output);
}
+
+function moveImagesToNewFolder(settings, oldPath, newPath) {
+ let dir = Gio.file_new_for_path(oldPath);
+ let dirIter = dir.enumerate_children('', Gio.FileQueryInfoFlags.NONE, null );
+ let newDir = Gio.file_new_for_path(newPath);
+ if (!newDir.query_exists(null)) {
+ newDir.make_directory_with_parents(null);
+ }
+ let file = null;
+ while (file = dirIter.next_file(null)) {
+ let filename = file.get_name(); // we only want to move files that we think we own
+ if (filename.match(/.+\.jpg/i)) {
+ log('file: ' + slash(oldPath) + filename + ' -> ' + slash(newPath) + filename);
+ let cur = Gio.file_new_for_path(slash(oldPath) + filename);
+ let dest = Gio.file_new_for_path(slash(newPath) + filename);
+ cur.move(dest, Gio.FileCopyFlags.OVERWRITE, null, function () { log ('...moved'); });
+ }
+ }
+ // correct filenames for GNOME backgrounds
+ if (settings.get_boolean('set-background'))
+ moveBackground(oldPath, newPath, DESKTOP_SCHEMA);
+}
+
+function dirname(path) {
+ return path.match(/.*\//);
+}
+
+function slash(path) {
+ if (!path.endsWith('/'))
+ return path += '/';
+ return path;
+}
+
+function moveBackground(oldPath, newPath, schema) {
+ let gsettings = new Gio.Settings({schema: schema});
+ let uri;
+ let dark_uri;
+ uri = gsettings.get_string('picture-uri');
+ gsettings.set_string('picture-uri', uri.replace(oldPath, newPath));
+ try {
+ dark_uri = gsettings.get_string('picture-uri-dark');
+ gsettings.set_string('picture-uri-dark', dark_uri.replace(oldPath, newPath));
+ }
+ catch (e) {
+ log('no dark background gsettings key found ('+e+')');
+ }
+
+ Gio.Settings.sync();
+ gsettings.apply();
+}