Skip to content

Commit ad42f60

Browse files
authored
Merge pull request #34 from neffo/version-15
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)
2 parents 7b98149 + c353631 commit ad42f60

15 files changed

+349
-243
lines changed

buildzip.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ intltool-extract --type=gettext/glade ui/Settings.ui
1111
intltool-extract --type=gettext/glade ui/Settings4.ui
1212
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
1313

14+
rm translations.txt
1415
for D in locale/*; do
1516
if [ -d "${D}" ]; then
16-
msgfmt --statistics --template=locale/GoogleEarthWallpaper.pot --verbose -o "${D}/LC_MESSAGES/GoogleEarthWallpaper.mo" "${D}/LC_MESSAGES/GoogleEarthWallpaper.po" 2> translations.txt # compile translations
17+
msgfmt --statistics --template=locale/GoogleEarthWallpaper.pot --verbose -o "${D}/LC_MESSAGES/GoogleEarthWallpaper.mo" "${D}/LC_MESSAGES/GoogleEarthWallpaper.po" 2>> translations.txt # compile translations
1718
fi
1819
done
1920

convenience.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function versionSmaller(a, b) {
6363
}
6464

6565
function currentVersion() {
66-
return Config.PACKAGE_VERSION;
66+
return ''+Config.PACKAGE_VERSION.replace(/(alpha|beta)/,'0');
6767
}
6868

6969
function currentVersionEqual(v) {

extension.js

+44-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/*eslint class-methods-use-this: "off"*/
1111

1212
const {St, Soup, Gio, GLib, Clutter, GObject} = imports.gi;
13-
const {main, panelMenu, popupMenu} = imports.ui;
13+
const {main, panelMenu, popupMenu, messageTray} = imports.ui;
1414
const Util = imports.misc.util;
1515

1616
const ExtensionUtils = imports.misc.extensionUtils;
@@ -48,7 +48,13 @@ function notifyError(msg) {
4848
function doSetBackground(uri, schema) {
4949
let gsettings = new Gio.Settings({schema: schema});
5050
gsettings.set_string('picture-uri', 'file://' + uri);
51-
gsettings.set_string('picture-options', 'zoom');
51+
try {
52+
gsettings.set_string('picture-uri-dark', uri);
53+
}
54+
catch (e) {
55+
log("unable to set dark background for : " + e);
56+
}
57+
//gsettings.set_string('picture-options', 'zoom');
5258
Gio.Settings.sync();
5359
gsettings.apply();
5460
}
@@ -79,12 +85,13 @@ class GEWallpaperIndicator extends panelMenu.Button {
7985
this.httpSession = new Soup.SessionAsync();
8086
Soup.Session.prototype.add_feature.call(this.httpSession, new Soup.ProxyResolverDefault());
8187

82-
this._settings.connect('changed::hide', function() {
88+
this._settings.connect('changed::hide', () => {
8389
getActorCompat(this).visible = !this._settings.get_boolean('hide');
8490
});
8591
getActorCompat(this).visible = !this._settings.get_boolean('hide');
8692

8793
this._settings.connect('changed::map-link-provider', this._updateProviderLink.bind(this));
94+
this._settings.connect('changed::notify', this._notifyCurrentImage.bind(this));
8895

8996
getActorCompat(this).add_child(this.icon);
9097
this._setIcon();
@@ -100,14 +107,19 @@ class GEWallpaperIndicator extends panelMenu.Button {
100107
this.swallpaperItem = new popupMenu.PopupMenuItem(_("Set lockscreen image now"));
101108
this.refreshItem = new popupMenu.PopupMenuItem(_("Refresh Now"));
102109
this.settingsItem = new popupMenu.PopupMenuItem(_("Extension settings"));
110+
this._wrapLabelItem(this.descriptionItem);
111+
this._wrapLabelItem(this.copyrightItem);
103112

104113
// menu toggles for settings
105114
this.wallpaperToggle = this._newMenuSwitch(_("Set background image"), "set-background", this._settings.get_boolean('set-background'), true);
106115
this.lockscreenToggle = this._newMenuSwitch(_("Set lockscreen image"), "set-lock-screen", this._settings.get_boolean('set-lock-screen'), !Convenience.currentVersionGreaterEqual("3.36"));
116+
this.notifyToggle = this._newMenuSwitch(_("Send notification"), "notify", this._settings.get_boolean('notify'), true);
107117

108118
this.menu.addMenuItem(this.descriptionItem);
109119
this.menu.addMenuItem(this.locationItem);
120+
this.menu.addMenuItem(this.copyrightItem);
110121
this.menu.addMenuItem(this.extLinkItem);
122+
this.menu.addMenuItem(new popupMenu.PopupSeparatorMenuItem());
111123
this.menu.addMenuItem(this.refreshDueItem);
112124
this.menu.addMenuItem(this.refreshItem);
113125
this.menu.addMenuItem(new popupMenu.PopupSeparatorMenuItem());
@@ -116,6 +128,7 @@ class GEWallpaperIndicator extends panelMenu.Button {
116128
// disable until fresh is done
117129
this.refreshDueItem.setSensitive(false);
118130
this.descriptionItem.setSensitive(false);
131+
this.copyrightItem.setSensitive(false);
119132
this.locationItem.setSensitive(false);
120133

121134
this.extLinkItem.connect('activate', this._open_link.bind(this));
@@ -132,6 +145,8 @@ class GEWallpaperIndicator extends panelMenu.Button {
132145
if (!Convenience.currentVersionGreaterEqual("3.36")) { // lockscreen and desktop wallpaper are the same in GNOME 3.36+
133146
this.menu.addMenuItem(this.lockscreenToggle);
134147
}
148+
this.menu.addMenuItem(this.notifyToggle);
149+
this.menu.addMenuItem(new popupMenu.PopupSeparatorMenuItem());
135150
this.menu.addMenuItem(this.settingsItem);
136151

137152
getActorCompat(this).connect('button-press-event', this._updateMenu.bind(this));
@@ -191,6 +206,31 @@ class GEWallpaperIndicator extends panelMenu.Button {
191206
this.extLinkItem.label.set_text(this.provider_text);
192207
}
193208

209+
_notifyCurrentImage() {
210+
if (this._settings.get_boolean('notify') && this.filename != "") {
211+
this._createNotification();
212+
}
213+
}
214+
215+
_createNotification() {
216+
// set notifications icon
217+
let source = new messageTray.Source('Google Earth Wallpaper', 'preferences-desktop-wallpaper-symbolic');
218+
main.messageTray.add(source);
219+
let msg = 'Google Earth Wallpaper';
220+
let details = this.explanation+'\n'+Utils.friendly_coordinates(this.lat, this.lon)+'\n'+this.copyright;
221+
let notification = new messageTray.Notification(source, msg, details);
222+
notification.setTransient(this._settings.get_boolean('transient'));
223+
source.showNotification(notification);
224+
}
225+
226+
_wrapLabelItem(menuItem) {
227+
let clutter_text = menuItem.label.get_clutter_text();
228+
clutter_text.set_line_wrap(true);
229+
clutter_text.set_ellipsize(0);
230+
clutter_text.set_max_length(0);
231+
menuItem.label.set_style('max-width: 420px;');
232+
}
233+
194234
_getProviderLink(provider = this._settings.get_enum('map-link-provider')) {
195235
switch(provider) {
196236
case 1: // Google Maps
@@ -360,6 +400,7 @@ class GEWallpaperIndicator extends panelMenu.Button {
360400
this._updatePending = false;
361401
}
362402
this._updateMenu();
403+
this._notifyCurrentImage();
363404
this._restartTimeout(this._settings.get_int('refresh-interval'));
364405
}
365406

locale/GoogleEarthWallpaper.pot

+62-54
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,47 @@
22
msgid "Hide the indicator"
33
msgstr ""
44

5-
#: ui/Settings.ui.h:2 ui/Settings4.ui.h:2
5+
#: ui/Settings.ui.h:2
66
msgid "Indicator brightness"
77
msgstr ""
88

9-
#: ui/Settings.ui.h:3 ui/Settings4.ui.h:3
9+
#: ui/Settings.ui.h:3 ui/Settings4.ui.h:2
1010
msgid "Indicator"
1111
msgstr ""
1212

13-
#: ui/Settings.ui.h:4 ui/Settings4.ui.h:4
13+
#: ui/Settings.ui.h:4 ui/Settings4.ui.h:3
1414
msgid "Indicator icon"
1515
msgstr ""
1616

17-
#: ui/Settings.ui.h:5 ui/Settings4.ui.h:5
17+
#: ui/Settings.ui.h:5 ui/Settings4.ui.h:4
1818
msgid "Refresh interval"
1919
msgstr ""
2020

21-
#: ui/Settings.ui.h:6 ui/Settings4.ui.h:6
21+
#: ui/Settings.ui.h:6 ui/Settings4.ui.h:5
2222
msgid "Change effective from next refresh"
2323
msgstr ""
2424

25-
#: ui/Settings.ui.h:7 ui/Settings4.ui.h:7
25+
#: ui/Settings.ui.h:7 ui/Settings4.ui.h:6
26+
msgid "Enable desktop notifications"
27+
msgstr ""
28+
29+
#: ui/Settings.ui.h:8 ui/Settings4.ui.h:7
2630
msgid "Map Provider for external links"
2731
msgstr ""
2832

29-
#: ui/Settings.ui.h:8 ui/Settings4.ui.h:8
33+
#: ui/Settings.ui.h:9 ui/Settings4.ui.h:8
3034
msgid "Provider used to view wallpaper location and context"
3135
msgstr ""
3236

33-
#: ui/Settings.ui.h:9 ui/Settings4.ui.h:9 extension.js:105
37+
#: ui/Settings.ui.h:10 ui/Settings4.ui.h:9 extension.js:114
3438
msgid "Set background image"
3539
msgstr ""
3640

37-
#: ui/Settings.ui.h:10 ui/Settings4.ui.h:10
38-
msgid "Set lock screen image"
39-
msgstr ""
40-
4141
#: ui/Settings.ui.h:11 ui/Settings4.ui.h:11
42-
msgid "Set lock screen password prompt image"
42+
msgid "Background style option"
4343
msgstr ""
4444

45-
#: ui/Settings.ui.h:12 ui/Settings4.ui.h:12
45+
#: ui/Settings.ui.h:12 ui/Settings4.ui.h:13
4646
msgid "Download folder:"
4747
msgstr ""
4848

@@ -62,151 +62,159 @@ msgstr ""
6262
msgid "Background"
6363
msgstr ""
6464

65-
#: ui/Settings.ui.h:17 ui/Settings4.ui.h:18
66-
msgid "Changes since last version"
67-
msgstr ""
68-
69-
#: ui/Settings.ui.h:18 ui/Settings4.ui.h:19
65+
#: ui/Settings.ui.h:17
7066
msgid "Change log"
7167
msgstr ""
7268

73-
#: ui/Settings.ui.h:19 ui/Settings4.ui.h:20
69+
#: ui/Settings.ui.h:18 ui/Settings4.ui.h:18
7470
msgid ""
7571
"<span size=\"small\">This program comes with ABSOLUTELY NO WARRANTY.\n"
7672
"See the <a href=\"https://www.gnu.org/licenses/gpl-3.0.html\">GNU General "
7773
"Public License, version 3 or later</a> for details.</span>"
7874
msgstr ""
7975

80-
#: ui/Settings.ui.h:21 ui/Settings4.ui.h:22
76+
#: ui/Settings.ui.h:20 ui/Settings4.ui.h:20
8177
msgid "https://github.com/neffo/earth-view-wallpaper-gnome-extension"
8278
msgstr ""
8379

84-
#: ui/Settings.ui.h:22 ui/Settings4.ui.h:23
80+
#: ui/Settings.ui.h:21 ui/Settings4.ui.h:21
8581
msgid "Based on NASA APOD Wallpaper extension by Elia Argentieri"
8682
msgstr ""
8783

88-
#: ui/Settings.ui.h:23 ui/Settings4.ui.h:24
84+
#: ui/Settings.ui.h:22 ui/Settings4.ui.h:22
8985
msgid ""
9086
"This GNOME shell extension sets your wallpaper to a random Google Earth "
9187
"photo from a selection of curated locations."
9288
msgstr ""
9389

94-
#: ui/Settings.ui.h:24 ui/Settings4.ui.h:25 extension.js:158 extension.js:303
90+
#: ui/Settings.ui.h:23 ui/Settings4.ui.h:23 extension.js:173 extension.js:343
9591
msgid "Google Earth Wallpaper"
9692
msgstr ""
9793

98-
#: ui/Settings.ui.h:25 ui/Settings4.ui.h:26
94+
#: ui/Settings.ui.h:24 ui/Settings4.ui.h:24
9995
msgid "Maintained by Michael Carroll"
10096
msgstr ""
10197

102-
#: ui/Settings.ui.h:26 ui/Settings4.ui.h:27
98+
#: ui/Settings.ui.h:25 ui/Settings4.ui.h:25
10399
msgid "About"
104100
msgstr ""
105101

106-
#: ui/Settings4.ui.h:13
107-
msgid "Bing Wallpaper pictures folder"
102+
#: ui/Settings4.ui.h:10
103+
msgid "Sets background image for desktop and lockscreen"
104+
msgstr ""
105+
106+
#: ui/Settings4.ui.h:12
107+
msgid "Select how the image is rendered on desktop"
108108
msgstr ""
109109

110-
#: extension.js:94
110+
#: extension.js:101
111111
msgid "<No refresh scheduled>"
112112
msgstr ""
113113

114-
#: extension.js:95
114+
#: extension.js:102
115115
msgid "Text Location"
116116
msgstr ""
117117

118-
#: extension.js:96
118+
#: extension.js:103
119119
msgid "Geo Location"
120120
msgstr ""
121121

122-
#: extension.js:97
122+
#: extension.js:104
123123
msgid "External Link"
124124
msgstr ""
125125

126-
#: extension.js:98
126+
#: extension.js:105
127127
msgid "Copyright"
128128
msgstr ""
129129

130-
#: extension.js:99
130+
#: extension.js:106
131131
msgid "Set background image now"
132132
msgstr ""
133133

134-
#: extension.js:100
134+
#: extension.js:107
135135
msgid "Set lockscreen image now"
136136
msgstr ""
137137

138-
#: extension.js:101
138+
#: extension.js:108
139139
msgid "Refresh Now"
140140
msgstr ""
141141

142-
#: extension.js:102
142+
#: extension.js:109
143143
msgid "Extension settings"
144144
msgstr ""
145145

146-
#: extension.js:106
146+
#: extension.js:115
147147
msgid "Set lockscreen image"
148148
msgstr ""
149149

150-
#: extension.js:130
150+
#: extension.js:116
151+
msgid "Send notification"
152+
msgstr ""
153+
154+
#: extension.js:143
151155
msgid "On refresh:"
152156
msgstr ""
153157

154-
#: extension.js:187
158+
#: extension.js:202
155159
msgid "Next refresh"
156160
msgstr ""
157161

158-
#: extension.js:214
162+
#: extension.js:254
159163
msgid "View in "
160164
msgstr ""
161165

162-
#: extension.js:269
166+
#: extension.js:309
163167
msgid "Fetching..."
164168
msgstr ""
165169

166-
#: extension.js:357
170+
#: extension.js:397
167171
msgid "No wallpaper available"
168172
msgstr ""
169173

170-
#: extension.js:358
174+
#: extension.js:398
171175
msgid "Something went wrong..."
172176
msgstr ""
173177

174-
#: prefs.js:26
178+
#: prefs.js:27
175179
msgid "5 m"
176180
msgstr ""
177181

178-
#: prefs.js:26
182+
#: prefs.js:27
179183
msgid "10 m"
180184
msgstr ""
181185

182-
#: prefs.js:26
186+
#: prefs.js:27
183187
msgid "30 m"
184188
msgstr ""
185189

186-
#: prefs.js:26
190+
#: prefs.js:27
187191
msgid "60 m"
188192
msgstr ""
189193

190-
#: prefs.js:26
194+
#: prefs.js:27
191195
msgid "90 m"
192196
msgstr ""
193197

194-
#: prefs.js:26
198+
#: prefs.js:27
195199
msgid "daily"
196200
msgstr ""
197201

198-
#: utils.js:33 utils.js:36
202+
#: prefs.js:105
203+
msgid "Select folder"
204+
msgstr ""
205+
206+
#: utils.js:35 utils.js:38
199207
msgid "minutes"
200208
msgstr ""
201209

202-
#: utils.js:39
210+
#: utils.js:41
203211
msgid "days"
204212
msgstr ""
205213

206-
#: utils.js:42
214+
#: utils.js:44
207215
msgid "hours"
208216
msgstr ""
209217

210-
#: utils.js:69
218+
#: utils.js:71
211219
msgid "No change log found for this release"
212220
msgstr ""
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)