Skip to content

Commit

Permalink
Merge pull request #34 from neffo/version-15
Browse files Browse the repository at this point in the history
Version 15:
- don't force wallpaper style, add preferences options
- clean up gtk4 preferences window
- clean up menus (word wrap, etc)
- fix changing wallpaper directory
- fix hiding icon
- fix gnome 36/38 support
- re-enable notifications (default off)
  • Loading branch information
neffo authored Apr 3, 2022
2 parents 7b98149 + c353631 commit ad42f60
Show file tree
Hide file tree
Showing 15 changed files with 349 additions and 243 deletions.
3 changes: 2 additions & 1 deletion buildzip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion convenience.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
47 changes: 44 additions & 3 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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();
Expand All @@ -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());
Expand All @@ -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));
Expand All @@ -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));
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -360,6 +400,7 @@ class GEWallpaperIndicator extends panelMenu.Button {
this._updatePending = false;
}
this._updateMenu();
this._notifyCurrentImage();
this._restartTimeout(this._settings.get_int('refresh-interval'));
}

Expand Down
116 changes: 62 additions & 54 deletions locale/GoogleEarthWallpaper.pot
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""

Expand All @@ -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 ""
"<span size=\"small\">This program comes with ABSOLUTELY NO WARRANTY.\n"
"See the <a href=\"https://www.gnu.org/licenses/gpl-3.0.html\">GNU General "
"Public License, version 3 or later</a> for details.</span>"
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 "<No refresh scheduled>"
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 ""
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit ad42f60

Please sign in to comment.