[chrome-gnome-shell] connector: expose checking updates of enabled only extensions feature.



commit ec3660718b3d7d7848a8c8c1075d6ec7e9869d63
Author: Yuri Konotopov <ykonotopov gnome org>
Date:   Sun Jan 28 19:37:54 2018 +0400

    connector: expose checking updates of enabled only extensions feature.

 connector/chrome-gnome-shell.py     |    4 +-
 extension/_locales/en/messages.json |    3 ++
 extension/include/gsc.js            |    6 ++++-
 extension/options.html              |    3 +-
 extension/options.js                |   37 ++++++++++++++++++++++++++++++++--
 po/template.pot                     |    8 ++++++-
 6 files changed, 53 insertions(+), 8 deletions(-)
---
diff --git a/connector/chrome-gnome-shell.py b/connector/chrome-gnome-shell.py
index a235256..219f9f0 100755
--- a/connector/chrome-gnome-shell.py
+++ b/connector/chrome-gnome-shell.py
@@ -3,7 +3,7 @@
 
 """
     GNOME Shell integration for Chrome
-    Copyright (C) 2016-2017  Yuri Konotopov <ykonotopov gnome org>
+    Copyright (C) 2016-2018  Yuri Konotopov <ykonotopov gnome org>
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -371,7 +371,7 @@ class ChromeGNOMEShell(Gio.Application):
                 else:
                     disable_version_check = False
 
-                supports = ['notifications']
+                supports = ['notifications', "update-enabled"]
                 if REQUESTS_IMPORTED:
                     supports.append('update-check')
 
diff --git a/extension/_locales/en/messages.json b/extension/_locales/en/messages.json
index ae68ed8..e021ef2 100644
--- a/extension/_locales/en/messages.json
+++ b/extension/_locales/en/messages.json
@@ -95,6 +95,9 @@
        "options_update_check_notice": {
                "message": "Your native host connector does not support check for GNOME Shell extensions 
updates. Probably python-requests package is missing."
        },
+       "options_update_check_enabled_notice": {
+               "message": "Your native host connector does not support updates check for enabled GNOME Shell 
extensions only. Consider update."
+       },
        "options_check_period": {
                "message": "Update check period",
                "description": "Option name. Allow to set interval between GNOME Shell extensions update 
checks."
diff --git a/extension/include/gsc.js b/extension/include/gsc.js
index be80d14..4ae4b38 100644
--- a/extension/include/gsc.js
+++ b/extension/include/gsc.js
@@ -1,6 +1,6 @@
 /*
     GNOME Shell integration for Chrome
-    Copyright (C) 2016  Yuri Konotopov <ykonotopov gnome org>
+    Copyright (C) 2016-2018  Yuri Konotopov <ykonotopov gnome org>
 
     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -139,6 +139,10 @@ GSC = (function() {
 
                nativeUpdateCheckSupported: function (response) {
                        return isSupported('update-check', response);
+               },
+
+               nativeUpdateCheckEnabledOnlySupported: function (response) {
+                       return isSupported('update-enabled', response);
                }
        };
 })();
diff --git a/extension/options.html b/extension/options.html
index 6b1203b..4d25877 100644
--- a/extension/options.html
+++ b/extension/options.html
@@ -38,7 +38,8 @@
                                        </dl>
                                        <dl>
                                                <dt>
-                                                       <span 
data-i18n="options_update_check_enabled"></span>:
+                                                       <span 
data-i18n="options_update_check_enabled"></span>:<br class="update-notice"/>
+                                                       <span class="notice wrapped update-notice" 
data-i18n="options_update_check_enabled_notice"></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' />
diff --git a/extension/options.js b/extension/options.js
index 7278aa5..d61302e 100644
--- a/extension/options.js
+++ b/extension/options.js
@@ -87,8 +87,8 @@ function restore_options()
        tabby.init();
 
        chrome.storage.sync.get(DEFAULT_SYNC_OPTIONS, function (items) {
-               function toggle_update_notice(show) {
-                       let notice = $('#update_check_yes')
+               function toggle_notice(show, id) {
+                       let notice = $('#' + id)
                                .closest('dl')
                                .find('dt br, dt span.notice');
 
@@ -102,6 +102,14 @@ function restore_options()
                        }
                }
 
+               function toggle_update_notice(show) {
+                       toggle_notice(show, "update_check_yes");
+               }
+
+               function toggle_update_enable_notice(show) {
+                       toggle_notice(show, "update_check_enabled_yes");
+               }
+
                function disable_update_check() {
                        if (items.updateCheck)
                        {
@@ -115,6 +123,19 @@ function restore_options()
                        toggle_update_notice(true);
                }
 
+               function disable_update_enabled_only() {
+                       if (items.updateCheckEnabledOnly)
+                       {
+                               items.updateCheckEnabledOnly = false;
+
+                               chrome.storage.sync.set({
+                                       updateCheckEnabledOnly: items.updateCheckEnabledOnly
+                               });
+                       }
+
+                       toggle_update_enable_notice(true);
+               }
+
                GSC.onInitialize().then(function (response) {
                        if (!GSC.nativeUpdateCheckSupported(response))
                        {
@@ -122,12 +143,22 @@ function restore_options()
                        }
                        else
                        {
-                               $("input[name='update_check'], input[name='update_check_enabled'], 
#update_check_period").removeAttr('disabled');
+                               $("input[name='update_check'], #update_check_period").removeAttr('disabled');
                                $('#update_check_period').val(items.updateCheckPeriod);
                                toggle_update_notice(false);
                                retrieveUpdateTimes();
                        }
 
+                       if (!GSC.nativeUpdateCheckEnabledOnlySupported(response))
+                       {
+                               disable_update_enabled_only();
+                       }
+                       else
+                       {
+                               $("input[name='update_check_enabled']").removeAttr('disabled');
+                               toggle_update_enable_notice(false);
+                       }
+
                        setCheckUpdate(items.updateCheck);
                        setCheckUpdateEnabledOnly(items.updateCheckEnabledOnly);
                }, function(response) {
diff --git a/po/template.pot b/po/template.pot
index 25a83cf..6276d22 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: 2018-01-28 08:41+0000\n"
+"POT-Creation-Date: 2018-01-28 15:32+0000\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=utf-8\n"
 "Content-Transfer-Encoding: 8bit\n"
@@ -188,6 +188,12 @@ msgstr ""
 msgid "Check update of enabled GNOME Shell extensions only"
 msgstr ""
 
+#: chrome-gnome-shell-key-options_update_check_enabled_notice:1
+msgid ""
+"Your native host connector does not support updates check for enabled GNOME "
+"Shell extensions only. Consider update."
+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]