[chrome-gnome-shell] update-check: added option to check updates of enabled only extensions.
- From: Yuri Konotopov <ykonotopov src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chrome-gnome-shell] update-check: added option to check updates of enabled only extensions.
- Date: Mon, 12 Jun 2017 17:59:10 +0000 (UTC)
commit 6ded9edb18444ebaa11d795c015715b91e5e3d07
Author: Yuri Konotopov <ykonotopov gnome org>
Date: Mon Jun 12 21:30:40 2017 +0400
update-check: added option to check updates of enabled only extensions.
connector/chrome-gnome-shell.py | 12 +++++++++---
extension/_locales/en/messages.json | 4 ++++
extension/include/constants.js | 1 +
extension/include/update.js | 25 ++++++++++++++++---------
extension/options.html | 9 +++++++++
extension/options.js | 13 ++++++++++++-
po/template.pot | 7 ++++++-
7 files changed, 57 insertions(+), 14 deletions(-)
---
diff --git a/connector/chrome-gnome-shell.py b/connector/chrome-gnome-shell.py
index 410f9e8..6679e51 100755
--- a/connector/chrome-gnome-shell.py
+++ b/connector/chrome-gnome-shell.py
@@ -476,10 +476,14 @@ class ChromeGNOMEShell(Gio.Application):
elif request['execute'] == 'checkUpdate':
update_url = 'https://extensions.gnome.org/update-info/'
+ enabled_only = True
if 'url' in request:
update_url = request['url']
- self.check_update(update_url)
+ if 'enabledOnly' in request:
+ enabled_only = request['enabledOnly']
+
+ self.check_update(update_url, enabled_only)
elif request['execute'] == 'createNotification':
Gio.DBusActionGroup.get(
@@ -498,7 +502,7 @@ class ChromeGNOMEShell(Gio.Application):
debug('Execute: from %s' % request['execute'])
- def check_update(self, update_url):
+ def check_update(self, update_url, enabled_only):
result = self.shell_proxy.call_sync(
"ListExtensions",
None,
@@ -508,6 +512,8 @@ class ChromeGNOMEShell(Gio.Application):
)
extensions = result.unpack()[0]
+ settings = Gio.Settings.new(SHELL_SCHEMA)
+ enabled_extensions = settings.get_strv(ENABLED_EXTENSIONS_KEY)
if extensions:
http_request = {
@@ -518,7 +524,7 @@ class ChromeGNOMEShell(Gio.Application):
for uuid in extensions:
# gnome-shell/js/misc/extensionUtils.js
# EXTENSION_TYPE.PER_USER = 2
- if is_uuid(uuid) and extensions[uuid]['type'] == 2:
+ if is_uuid(uuid) and extensions[uuid]['type'] == 2 and (not enabled_only or uuid in
enabled_extensions):
try:
http_request['installed'][uuid] = {
'version': int(extensions[uuid]['version'])
diff --git a/extension/_locales/en/messages.json b/extension/_locales/en/messages.json
index b423f48..7eb13de 100644
--- a/extension/_locales/en/messages.json
+++ b/extension/_locales/en/messages.json
@@ -88,6 +88,10 @@
"message": "Check for GNOME Shell extensions update",
"description": "Option name. Allow enable/disable update check for GNOME Shell extensions."
},
+ "options_update_check_enabled": {
+ "message": "Check update of enabled GNOME Shell extensions only",
+ "description": "Option name."
+ },
"options_update_check_notice": {
"message": "Your native host connector does not support check for GNOME Shell extensions
updates. Probably python-requests package is missing."
},
diff --git a/extension/include/constants.js b/extension/include/constants.js
index 6b79ae4..ef193ba 100644
--- a/extension/include/constants.js
+++ b/extension/include/constants.js
@@ -41,6 +41,7 @@ UPDATE_URL = EXTENSIONS_WEBSITE + 'update-info/';
DEFAULT_SYNC_OPTIONS = {
showReleaseNotes: true,
updateCheck: true,
+ updateCheckEnabledOnly: true,
updateCheckPeriod: 6
};
diff --git a/extension/include/update.js b/extension/include/update.js
index 3cd56a8..04c00ca 100644
--- a/extension/include/update.js
+++ b/extension/include/update.js
@@ -35,15 +35,22 @@ GSC.update = (function($) {
// TODO: remove deprecated in version 9
if(GSC.nativeUpdateCheckSupported(response))
{
- GSC.sendNativeRequest({execute: 'checkUpdate', url: UPDATE_URL},
function (response) {
- if (response.success)
- {
- onSweetToothResponse(response.upgrade,
response.extensions);
- }
- else
- {
- createUpdateFailedNotification(response.message ?
response.message : m('native_request_failed', 'checkUpdate'));
- }
+ chrome.storage.sync.get(DEFAULT_SYNC_OPTIONS, function (options) {
+ GSC.sendNativeRequest(
+ {
+ execute: 'checkUpdate',
+ url: UPDATE_URL,
+ enabledOnly: options.updateCheckEnabledOnly
+ }, function (response) {
+ if (response.success)
+ {
+ onSweetToothResponse(response.upgrade,
response.extensions);
+ }
+ else
+ {
+
createUpdateFailedNotification(response.message ? response.message : m('native_request_failed',
'checkUpdate'));
+ }
+ });
});
}
else
diff --git a/extension/options.html b/extension/options.html
index a294ae2..83c496b 100644
--- a/extension/options.html
+++ b/extension/options.html
@@ -37,6 +37,15 @@
</dd>
</dl>
<dl>
+ <dt>
+ <span
data-i18n="options_update_check_enabled"></span>:
+ </dt>
+ <dd>
+ <label for='update_check_enabled_yes'
data-i18n="yes"></label> <input type='radio' id='update_check_enabled_yes' name='update_check_enabled'
disabled='disabled' />
+ <label for='update_check_enabled_no'
data-i18n="no"></label> <input type='radio' id='update_check_enabled_no' name='update_check_enabled'
disabled='disabled' />
+ </dd>
+ </dl>
+ <dl>
<dt><label for='update_check_period'
data-i18n="options_check_period"></label>:</dt>
<dd>
<input id='update_check_period' type='number' min="3"
disabled='disabled' /> <span data-i18n="hours"></span>
diff --git a/extension/options.js b/extension/options.js
index dd50dbc..9fdd4ea 100644
--- a/extension/options.js
+++ b/extension/options.js
@@ -13,12 +13,14 @@ function save_options()
var showReleaseNotes = $('#show_release_notes_yes').prop('checked');
var syncExtensions = $('#synchronize_extensions_yes').prop('checked');
var updateCheck = $('#update_check_yes').prop('checked');
+ var updateCheckEnabledOnly = $('#update_check_enabled_yes').prop('checked');
var updateCheckPeriod = $('#update_check_period').val();
updateCheckPeriod = Math.max(3, updateCheckPeriod);
chrome.storage.sync.set({
showReleaseNotes: showReleaseNotes,
updateCheck: updateCheck,
+ updateCheckEnabledOnly: updateCheckEnabledOnly,
updateCheckPeriod: updateCheckPeriod
}, function () {
chrome.storage.local.set({
@@ -118,13 +120,14 @@ function restore_options()
}
else
{
- $("input[name='update_check'], #update_check_period").removeAttr('disabled');
+ $("input[name='update_check'], input[name='update_check_enabled'],
#update_check_period").removeAttr('disabled');
$('#update_check_period').val(items.updateCheckPeriod);
toggle_update_notice(false);
retrieveUpdateTimes();
}
setCheckUpdate(items.updateCheck);
+ setCheckUpdateEnabledOnly(items.updateCheckEnabledOnly);
}, function(response) {
disable_update_check();
});
@@ -202,6 +205,14 @@ function setCheckUpdate(result)
$('#update_check_no').prop('checked', true);
}
+function setCheckUpdateEnabledOnly(result)
+{
+ if(result)
+ $('#update_check_enabled_yes').prop('checked', true);
+ else
+ $('#update_check_enabled_no').prop('checked', true);
+}
+
function setReleaseNotes(result)
{
if(result)
diff --git a/po/template.pot b/po/template.pot
index 01f9699..cec8cb9 100644
--- a/po/template.pot
+++ b/po/template.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 1.0\n"
"Report-Msgid-Bugs-To: ykonotopov gnome org\n"
-"POT-Creation-Date: 2017-06-03 07:45+0000\n"
+"POT-Creation-Date: 2017-06-12 17:29+0000\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -183,6 +183,11 @@ msgstr ""
msgid "Check for GNOME Shell extensions update"
msgstr ""
+#. Option name.
+#: chrome-gnome-shell-key-options_update_check_enabled:1
+msgid "Check update of enabled GNOME Shell extensions only"
+msgstr ""
+
#: chrome-gnome-shell-key-options_update_check_notice:1
msgid ""
"Your native host connector does not support check for GNOME Shell extensions"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]