Blame SOURCES/0001-extensionSystem-Notify-about-extension-issues-on-upd.patch

35159f
From d1a20dc80c3414ba4cb7bf839a25de49d30ab400 Mon Sep 17 00:00:00 2001
35159f
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
35159f
Date: Mon, 21 Sep 2015 20:18:12 +0200
35159f
Subject: [PATCH] extensionSystem: Notify about extension issues on update
35159f
35159f
---
35159f
 js/ui/extensionSystem.js | 34 +++++++++++++++++++++++++++++++++-
35159f
 1 file changed, 33 insertions(+), 1 deletion(-)
35159f
35159f
diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js
35159f
index 9ffdb4f3d..eb820ba4f 100644
35159f
--- a/js/ui/extensionSystem.js
35159f
+++ b/js/ui/extensionSystem.js
35159f
@@ -1,8 +1,9 @@
35159f
 // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
35159f
 
35159f
-const { Gio, St } = imports.gi;
35159f
+const { Gio, GLib, St } = imports.gi;
35159f
 const Signals = imports.signals;
35159f
 
35159f
+const Config = imports.misc.config;
35159f
 const ExtensionUtils = imports.misc.extensionUtils;
35159f
 const Main = imports.ui.main;
35159f
 
35159f
@@ -312,6 +313,36 @@ function _onVersionValidationChanged() {
35159f
     }
35159f
 }
35159f
 
35159f
+function _doUpdateCheck() {
35159f
+    let version = Config.PACKAGE_VERSION.split('.');
35159f
+    if (parseInt(version[1]) % 2 == 0)
35159f
+        version.pop();
35159f
+
35159f
+    let pkgCacheDir = GLib.get_user_cache_dir() + '/gnome-shell/';
35159f
+    let updateStamp = Gio.file_new_for_path(pkgCacheDir +
35159f
+                                            'update-check-' + version.join('.'));
35159f
+    if (updateStamp.query_exists(null))
35159f
+        return;
35159f
+
35159f
+    GLib.mkdir_with_parents (pkgCacheDir, 0o755);
35159f
+    updateStamp.create(0, null).close(null);
35159f
+
35159f
+   let nOutdated = enabledExtensions.reduce(function(n, uuid) {
35159f
+       let extension = ExtensionUtils.extensions[uuid];
35159f
+       if (extension && extension.state == ExtensionState.OUT_OF_DATE)
35159f
+           n++;
35159f
+       return n;
35159f
+   }, 0);
35159f
+
35159f
+   if (nOutdated == 0)
35159f
+       return;
35159f
+
35159f
+   Main.notify(ngettext("%d extension is out of date",
35159f
+                        "%d extensions are out of date",
35159f
+                        nOutdated).format(nOutdated),
35159f
+               _("You can visit http://extensions.gnome.org for updates"));
35159f
+}
35159f
+
35159f
 function _loadExtensions() {
35159f
     global.settings.connect('changed::' + ENABLED_EXTENSIONS_KEY, onEnabledExtensionsChanged);
35159f
     global.settings.connect('changed::' + DISABLE_USER_EXTENSIONS_KEY, onEnabledExtensionsChanged);
35159f
@@ -326,6 +357,7 @@ function _loadExtensions() {
35159f
             extension.type = ExtensionUtils.ExtensionType.SESSION_MODE;
35159f
     });
35159f
     finder.scanExtensions();
35159f
+    _doUpdateCheck();
35159f
 }
35159f
 
35159f
 function enableAllExtensions() {
35159f
-- 
35159f
2.21.0
35159f