[chrome-gnome-shell/feature/extensions_sync: 2/2] Added option to control extensions synchronization
- From: Yuri Konotopov <ykonotopov src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chrome-gnome-shell/feature/extensions_sync: 2/2] Added option to control extensions synchronization
- Date: Tue, 9 Aug 2016 09:40:50 +0000 (UTC)
commit b49d0739000904a32f721d22e111d834b6f6e321
Author: Yuri Konotopov <ykonotopov gmail com>
Date: Tue Aug 9 12:40:31 2016 +0300
Added option to control extensions synchronization
extension/_locales/en/messages.json | 9 +++++++++
extension/css/options.css | 2 +-
extension/include/constants.js | 4 ++++
extension/options.html | 11 +++++++++++
extension/options.js | 34 +++++++++++++++++++++++++++++-----
5 files changed, 54 insertions(+), 6 deletions(-)
---
diff --git a/extension/_locales/en/messages.json b/extension/_locales/en/messages.json
index 5e127d8..ecdb4c2 100644
--- a/extension/_locales/en/messages.json
+++ b/extension/_locales/en/messages.json
@@ -71,6 +71,15 @@
"options_show_release_notes": {
"message": "Show release notes when extension updated"
},
+ "options_synchronize_extensions": {
+ "message": "Synchronize extensions list"
+ },
+ "options_synchronize_extensions_notice": {
+ "message": "If enabled, your GNOME Shell extensions list will be synchronized with your
Google account."
+ },
+ "options_synchronize_extensions_notice2": {
+ "message": "For this feature to work properly you must manage GNOME Shell extensions from
your Chrome/Chromium browser only."
+ },
"options_last_check": {
"message": "Last check"
},
diff --git a/extension/css/options.css b/extension/css/options.css
index 6663fb2..e701c66 100644
--- a/extension/css/options.css
+++ b/extension/css/options.css
@@ -1,6 +1,6 @@
body {
padding: 10px;
- min-width: 500px;
+ min-width: 550px;
}
#translation_credits {
diff --git a/extension/include/constants.js b/extension/include/constants.js
index c7c1d3f..4bc8dc6 100644
--- a/extension/include/constants.js
+++ b/extension/include/constants.js
@@ -30,6 +30,10 @@ DEFAULT_SYNC_OPTIONS = {
updateCheckPeriod: 6
};
+DEFAULT_LOCAL_OPTIONS = {
+ syncExtensions: false
+};
+
EXTERNAL_MESSAGES = [
"connecting_host_app",
"error_extension_response",
diff --git a/extension/options.html b/extension/options.html
index 9ae5297..072f13d 100644
--- a/extension/options.html
+++ b/extension/options.html
@@ -32,6 +32,17 @@
</dl>
<dl>
<dt>
+ <label for='synchronize_extensions_yes'
data-i18n="options_synchronize_extensions"></label>:<br />
+ <span class="notice wrapped"
data-i18n="options_synchronize_extensions_notice"></span><br />
+ <span class="notice wrapped"
data-i18n="options_synchronize_extensions_notice2"></span>
+ </dt>
+ <dd>
+ <label for='synchronize_extensions_yes'
data-i18n="yes"></label> <input type='radio' id='synchronize_extensions_yes' name='synchronize_extensions' />
+ <label for='synchronize_extensions_no'
data-i18n="no"></label> <input type='radio' id='synchronize_extensions_no' name='synchronize_extensions' />
+ </dd>
+ </dl>
+ <dl>
+ <dt>
<label for='show_network_errors_yes'
data-i18n="options_show_network_errors"></label>:<br />
<span class="notice wrapped"
data-i18n="options_show_network_errors_notice"></span>
</dt>
diff --git a/extension/options.js b/extension/options.js
index 8c8f3a6..9c6b8a4 100644
--- a/extension/options.js
+++ b/extension/options.js
@@ -11,6 +11,7 @@
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 updateCheckPeriod = $('#update_check_period').val();
updateCheckPeriod = Math.max(3, updateCheckPeriod);
@@ -20,11 +21,15 @@ function save_options()
updateCheck: updateCheck,
updateCheckPeriod: updateCheckPeriod
}, function () {
- // Update status to let user know options were saved.
- $('#status')
- .show()
- .delay(750)
- .hide(250);
+ chrome.storage.local.set({
+ syncExtensions: syncExtensions
+ }, function() {
+ // Update status to let user know options were saved.
+ $('#status')
+ .show()
+ .delay(750)
+ .hide(250);
+ });
});
}
@@ -43,6 +48,17 @@ function restore_options()
}, function(result) {
setNetworkErrors(result);
});
+
+ if(!IS_OPERA)
+ {
+ chrome.storage.local.get(DEFAULT_LOCAL_OPTIONS, function (items) {
+ setSyncExtensions(items.syncExtensions);
+ });
+ }
+ else
+ {
+ $('#synchronize_extensions_yes').closest('dl').hide();
+ }
}
function retrieveUpdateTimes()
@@ -101,6 +117,14 @@ function setNetworkErrors(result)
$('#show_network_errors_no').prop('checked', true);
}
+function setSyncExtensions(result)
+{
+ if(result)
+ $('#synchronize_extensions_yes').prop('checked', true);
+ else
+ $('#synchronize_extensions_no').prop('checked', true);
+}
+
function handleWebrequestPermission()
{
if($('#show_network_errors_yes').prop('checked'))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]