[gnome-shell/wip/fmuellner/calendar-refresh: 7/15] messageList: Make canClear public and notify on changes



commit 3ba3909f2295335d6d6cdbaf43c092808c8d7529
Author: Florian Müllner <fmuellner gnome org>
Date:   Sun Feb 26 22:23:11 2017 +0100

    messageList: Make canClear public and notify on changes
    
    The latest mockups contain a button to clear all sections at once.
    As some elements cannot be cleared, we need to provide that information
    to avoid offering an action that has no effect.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=775763

 js/ui/messageList.js |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/messageList.js b/js/ui/messageList.js
index 325f5a3..9dde309 100644
--- a/js/ui/messageList.js
+++ b/js/ui/messageList.js
@@ -563,6 +563,7 @@ const MessageListSection = new Lang.Class({
         this._messages = new Map();
         this._date = new Date();
         this.empty = true;
+        this.canClear = false;
         this._sync();
     },
 
@@ -719,7 +720,14 @@ const MessageListSection = new Lang.Class({
         if (changed)
             this.emit('empty-changed');
 
-        this._closeButton.visible = this._canClear();
+        let canClear = this._canClear();
+        changed = this.canClear !== canClear;
+        this.canClear = canClear;
+
+        if (changed)
+            this.emit('can-clear-changed');
+
+        this._closeButton.visible = this.canClear;
         this.actor.visible = this.allowed && this._shouldShow();
     }
 });


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