Skip to content

Commit 7b98149

Browse files
authored
Merge pull request #31 from neffo/version-14
Version 14: - add support for GNOME 42 - add translation for Arabic, Italian language - fix opening prefs
2 parents 0de887b + 607eaf6 commit 7b98149

16 files changed

+520
-147
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Lightweight GNOME shell extension to set your wallpaper to a random Google Earth
1717

1818
## Requirements
1919

20-
GNOME Shell 3.38+ (Ubuntu Gnome 21.04+), legacy support exists for earlier GNOME Shell versions (3.28+)
20+
GNOME Shell 3.36+ (Ubuntu Gnome 20.04 LTS+), legacy support exists for earlier GNOME Shell versions (3.28+)
2121

2222
## Install
2323

buildzip.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ npm --version && (npm test; if [ $? -ne 0 ]; then exit 1; fi)
99
glib-compile-schemas schemas/
1010
intltool-extract --type=gettext/glade ui/Settings.ui
1111
intltool-extract --type=gettext/glade ui/Settings4.ui
12-
xgettext -k -k_ -kN_ -o locale/GoogleEarthWallpaper.pot ui/Settings.ui.h ui/Settings4.ui.h extension.js prefs.js utils.js --from-code=UTF-8
12+
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

1414
for D in locale/*; do
1515
if [ -d "${D}" ]; then

convenience.js

-63
Original file line numberDiff line numberDiff line change
@@ -32,67 +32,6 @@ const Gio = imports.gi.Gio;
3232

3333
const Config = imports.misc.config;
3434
const ExtensionUtils = imports.misc.extensionUtils;
35-
36-
/**
37-
* initTranslations:
38-
* @domain: (optional): the gettext domain to use
39-
*
40-
* Initialize Gettext to load translations from extensionsdir/locale.
41-
* If @domain is not provided, it will be taken from metadata['gettext-domain']
42-
*/
43-
function initTranslations(domain) {
44-
let extension = ExtensionUtils.getCurrentExtension();
45-
46-
domain = domain || extension.metadata['gettext-domain'];
47-
48-
// check if this extension was built with "make zip-file", and thus
49-
// has the locale files in a subfolder
50-
// otherwise assume that extension has been installed in the
51-
// same prefix as gnome-shell
52-
let localeDir = extension.dir.get_child('locale');
53-
if (localeDir.query_exists(null))
54-
Gettext.bindtextdomain(domain, localeDir.get_path());
55-
else
56-
Gettext.bindtextdomain(domain, Config.LOCALEDIR);
57-
}
58-
59-
/**
60-
* getSettings:
61-
* @schema: (optional): the GSettings schema id
62-
*
63-
* Builds and return a GSettings schema for @schema, using schema files
64-
* in extensionsdir/schemas. If @schema is not provided, it is taken from
65-
* metadata['settings-schema'].
66-
*/
67-
function getSettings(schema) {
68-
let extension = ExtensionUtils.getCurrentExtension();
69-
70-
schema = schema || extension.metadata['settings-schema'];
71-
72-
const GioSSS = Gio.SettingsSchemaSource;
73-
74-
// check if this extension was built with "make zip-file", and thus
75-
// has the schema files in a subfolder
76-
// otherwise assume that extension has been installed in the
77-
// same prefix as gnome-shell (and therefore schemas are available
78-
// in the standard folders)
79-
let schemaDir = extension.dir.get_child('schemas');
80-
let schemaSource;
81-
if (schemaDir.query_exists(null))
82-
schemaSource = GioSSS.new_from_directory(schemaDir.get_path(),
83-
GioSSS.get_default(),
84-
false);
85-
else
86-
schemaSource = GioSSS.get_default();
87-
88-
let schemaObj = schemaSource.lookup(schema, true);
89-
if (!schemaObj)
90-
throw new Error('Schema ' + schema + ' could not be found for extension '
91-
+ extension.metadata.uuid + '. Please check your installation.');
92-
93-
return new Gio.Settings({ settings_schema: schemaObj });
94-
}
95-
9635
const versionArray = (v) => v.split(".").map(Number);
9736

9837
const zip = function(a, b, defaultValue) {
@@ -150,8 +89,6 @@ function currentVersionSmallerEqual(v) {
15089
}
15190

15291
var exports = {
153-
initTranslations,
154-
getSettings,
15592
currentVersion,
15693
currentVersionEqual,
15794
currentVersionGreater,

extension.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class GEWallpaperIndicator extends panelMenu.Button {
5858
_init (params = {}) {
5959
super._init(0, IndicatorName, false);
6060

61-
this._settings = Utils.getSettings();
61+
this._settings = ExtensionUtils.getSettings(Utils.schema);
6262
let gicon = Gio.icon_new_for_string(Me.dir.get_child('icons').get_path() + "/" + this._settings.get_string('icon') + "-symbolic.svg");
6363
this.icon = new St.Icon({gicon: gicon, style_class: 'system-status-icon'});
6464
this.x_fill = true;
@@ -126,7 +126,7 @@ class GEWallpaperIndicator extends panelMenu.Button {
126126
}
127127
this.menu.addMenuItem(new popupMenu.PopupSeparatorMenuItem());
128128
this.refreshItem.connect('activate', this._refresh.bind(this));
129-
this.settingsItem.connect('activate', this._open_prefs.bind(this));
129+
this.settingsItem.connect('activate', this._openPrefs.bind(this));
130130
this.menu.addMenuItem(new popupMenu.PopupMenuItem(_("On refresh:"), {reactive : false} ));
131131
this.menu.addMenuItem(this.wallpaperToggle);
132132
if (!Convenience.currentVersionGreaterEqual("3.36")) { // lockscreen and desktop wallpaper are the same in GNOME 3.36+
@@ -149,8 +149,8 @@ class GEWallpaperIndicator extends panelMenu.Button {
149149
Util.spawn(["xdg-open", this.link]);
150150
}
151151

152-
_open_prefs () {
153-
Util.spawn(["gnome-shell-extension-prefs", Me.metadata.uuid]);
152+
_openPrefs() {
153+
ExtensionUtils.openPrefs();
154154
}
155155

156156
_restorePreviousState () {
@@ -408,7 +408,7 @@ class GEWallpaperIndicator extends panelMenu.Button {
408408
});
409409

410410
function init(extensionMeta) {
411-
Convenience.initTranslations("GoogleEarthWallpaper");
411+
ExtensionUtils.initTranslations("GoogleEarthWallpaper");
412412
}
413413

414414
function enable() {

locale/GoogleEarthWallpaper.pot

+12-31
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,3 @@
1-
# SOME DESCRIPTIVE TITLE.
2-
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3-
# This file is distributed under the same license as the PACKAGE package.
4-
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5-
#
6-
#, fuzzy
7-
msgid ""
8-
msgstr ""
9-
"Project-Id-Version: PACKAGE VERSION\n"
10-
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2021-10-19 21:56+1000\n"
12-
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13-
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14-
"Language-Team: LANGUAGE <[email protected]>\n"
15-
"Language: \n"
16-
"MIME-Version: 1.0\n"
17-
"Content-Type: text/plain; charset=CHARSET\n"
18-
"Content-Transfer-Encoding: 8bit\n"
19-
201
#: ui/Settings.ui.h:1 ui/Settings4.ui.h:1
212
msgid "Hide the indicator"
223
msgstr ""
@@ -92,8 +73,8 @@ msgstr ""
9273
#: ui/Settings.ui.h:19 ui/Settings4.ui.h:20
9374
msgid ""
9475
"<span size=\"small\">This program comes with ABSOLUTELY NO WARRANTY.\n"
95-
"See the <a href=\"https://www.gnu.org/licenses/old-licenses/gpl-2.0.html"
96-
"\">GNU General Public License, version 3 or later</a> for details.</span>"
76+
"See the <a href=\"https://www.gnu.org/licenses/gpl-3.0.html\">GNU General "
77+
"Public License, version 3 or later</a> for details.</span>"
9778
msgstr ""
9879

9980
#: ui/Settings.ui.h:21 ui/Settings4.ui.h:22
@@ -190,42 +171,42 @@ msgstr ""
190171
msgid "Something went wrong..."
191172
msgstr ""
192173

193-
#: prefs.js:24
174+
#: prefs.js:26
194175
msgid "5 m"
195176
msgstr ""
196177

197-
#: prefs.js:24
178+
#: prefs.js:26
198179
msgid "10 m"
199180
msgstr ""
200181

201-
#: prefs.js:24
182+
#: prefs.js:26
202183
msgid "30 m"
203184
msgstr ""
204185

205-
#: prefs.js:24
186+
#: prefs.js:26
206187
msgid "60 m"
207188
msgstr ""
208189

209-
#: prefs.js:24
190+
#: prefs.js:26
210191
msgid "90 m"
211192
msgstr ""
212193

213-
#: prefs.js:24
194+
#: prefs.js:26
214195
msgid "daily"
215196
msgstr ""
216197

217-
#: utils.js:62 utils.js:65
198+
#: utils.js:33 utils.js:36
218199
msgid "minutes"
219200
msgstr ""
220201

221-
#: utils.js:68
202+
#: utils.js:39
222203
msgid "days"
223204
msgstr ""
224205

225-
#: utils.js:71
206+
#: utils.js:42
226207
msgid "hours"
227208
msgstr ""
228209

229-
#: utils.js:98
210+
#: utils.js:69
230211
msgid "No change log found for this release"
231212
msgstr ""

locale/ar/LC_MESSAGES/ar.mo

4.85 KB
Binary file not shown.

0 commit comments

Comments
 (0)