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

5306fb
From b3132648a9a15b9c151bde6733cb0c252dac6a25 Mon Sep 17 00:00:00 2001
580c05
From: =?UTF-8?q?Florian=20M=C3=BCllner?= <fmuellner@gnome.org>
580c05
Date: Mon, 21 Sep 2015 20:18:12 +0200
580c05
Subject: [PATCH] extensionSystem: Notify about extension issues on update
580c05
580c05
---
580c05
 js/ui/extensionSystem.js | 32 ++++++++++++++++++++++++++++++++
580c05
 1 file changed, 32 insertions(+)
580c05
580c05
diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js
5306fb
index c2a11b8a5..5e78618c4 100644
580c05
--- a/js/ui/extensionSystem.js
580c05
+++ b/js/ui/extensionSystem.js
580c05
@@ -7,6 +7,7 @@ const GLib = imports.gi.GLib;
580c05
 const Gio = imports.gi.Gio;
580c05
 const St = imports.gi.St;
580c05
 
580c05
+const Config = imports.misc.config;
580c05
 const ExtensionUtils = imports.misc.extensionUtils;
580c05
 const Main = imports.ui.main;
580c05
 
5306fb
@@ -306,6 +307,36 @@ function _onVersionValidationChanged() {
580c05
     }
580c05
 }
580c05
 
580c05
+function _doUpdateCheck() {
580c05
+    let version = Config.PACKAGE_VERSION.split('.');
580c05
+    if (parseInt(version[1]) % 2 == 0)
580c05
+        version.pop();
580c05
+
580c05
+    let pkgCacheDir = GLib.get_user_cache_dir() + '/gnome-shell/';
580c05
+    let updateStamp = Gio.file_new_for_path(pkgCacheDir +
580c05
+                                            'update-check-' + version.join('.'));
580c05
+    if (updateStamp.query_exists(null))
580c05
+        return;
580c05
+
5306fb
+    GLib.mkdir_with_parents (pkgCacheDir, 0o755);
580c05
+    updateStamp.create(0, null).close(null);
580c05
+
580c05
+   let nOutdated = enabledExtensions.reduce(function(n, uuid) {
580c05
+       let extension = ExtensionUtils.extensions[uuid];
580c05
+       if (extension && extension.state == ExtensionState.OUT_OF_DATE)
580c05
+           n++;
580c05
+       return n;
580c05
+   }, 0);
580c05
+
580c05
+   if (nOutdated == 0)
580c05
+       return;
580c05
+
580c05
+   Main.notify(ngettext("%d extension is out of date",
580c05
+                        "%d extensions are out of date",
580c05
+                        nOutdated).format(nOutdated),
580c05
+               _("You can visit http://extensions.gnome.org for updates"));
580c05
+}
580c05
+
580c05
 function _loadExtensions() {
580c05
     global.settings.connect('changed::' + ENABLED_EXTENSIONS_KEY, onEnabledExtensionsChanged);
5306fb
     global.settings.connect('changed::' + DISABLE_USER_EXTENSIONS_KEY, onEnabledExtensionsChanged);
5306fb
@@ -320,6 +351,7 @@ function _loadExtensions() {
580c05
             extension.type = ExtensionUtils.ExtensionType.SESSION_MODE;
580c05
     });
580c05
     finder.scanExtensions();
580c05
+    _doUpdateCheck();
580c05
 }
580c05
 
580c05
 function enableAllExtensions() {
580c05
-- 
5306fb
2.14.2
580c05