[chrome-gnome-shell] api: do not expose api if GNOME Shell is not running



commit 754f0c1498f161e473f7b13a275108c2c58bd2e8
Author: Yuri Konotopov <ykonotopov gnome org>
Date:   Wed Feb 22 18:25:52 2017 +0400

    api: do not expose api if GNOME Shell is not running
    
    Bug: https://github.com/nE0sIghT/chrome-gnome-shell-mirror/issues/35

 connector/chrome-gnome-shell.py     |    2 +-
 extension/include/sweettooth-api.js |    6 ++++++
 2 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/connector/chrome-gnome-shell.py b/connector/chrome-gnome-shell.py
index 045b4c6..f977485 100755
--- a/connector/chrome-gnome-shell.py
+++ b/connector/chrome-gnome-shell.py
@@ -372,7 +372,7 @@ class ChromeGNOMEShell(Gio.Application):
                     'success': True,
                     'properties': {
                         'connectorVersion': CONNECTOR_VERSION,
-                        'shellVersion': shell_version.unpack(),
+                        'shellVersion': shell_version.unpack() if shell_version is not None else None,
                         'versionValidationEnabled': not disable_version_check,
                         'supports': [
                             'notifications',
diff --git a/extension/include/sweettooth-api.js b/extension/include/sweettooth-api.js
index 248f62c..9a157d2 100644
--- a/extension/include/sweettooth-api.js
+++ b/extension/include/sweettooth-api.js
@@ -73,6 +73,12 @@ window.SweetTooth = function () {
                        var ready = sendResolveExtensionMessage("initialize", "properties", null);
 
                        ready.then(function (response) {
+                               if(!response.shellVersion)
+                               {
+                                       apiObject.apiVersion = null;
+                                       return;
+                               }
+
                                apiObject.shellVersion = response.shellVersion;
                                apiObject.versionValidationEnabled = response.versionValidationEnabled;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]