[gnome-shell] dash: Make the tooltip and hover effect sync up to the real insensitivity



commit 245e43ea8c3ab754bab05eccfcb088995f5421d8
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Wed Oct 3 02:17:07 2012 -0300

    dash: Make the tooltip and hover effect sync up to the real insensitivity
    
    We shouldn't display "Remove from Favorites" when dropping on the button
    will do nothing.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=685313

 js/ui/dash.js |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/dash.js b/js/ui/dash.js
index 3a7828c..427802a 100644
--- a/js/ui/dash.js
+++ b/js/ui/dash.js
@@ -262,7 +262,7 @@ const ShowAppsIcon = new Lang.Class({
         this.toggleButton._delegate = this;
 
         this.setChild(this.toggleButton);
-        this.setHover(false);
+        this.setDragApp(null);
         this.toggleButton.label_actor = this.label;
     },
 
@@ -274,12 +274,23 @@ const ShowAppsIcon = new Lang.Class({
         return this._iconActor;
     },
 
-    setHover: function(hovered) {
-        this.toggleButton.set_hover(hovered);
+    _canRemoveApp: function(app) {
+        if (app == null)
+            return false;
+
+        let id = app.get_id();
+        let isFavorite = AppFavorites.getAppFavorites().isFavorite(id);
+        return isFavorite;
+    },
+
+    setDragApp: function(app) {
+        let canRemove = this._canRemoveApp(app);
+
+        this.toggleButton.set_hover(canRemove);
         if (this._iconActor)
-            this._iconActor.set_hover(hovered);
+            this._iconActor.set_hover(canRemove);
 
-        if (hovered)
+        if (canRemove)
             this.setLabelText(_("Remove from Favorites"));
         else
             this.setLabelText(_("Show Applications"));
@@ -453,7 +464,10 @@ const Dash = new Lang.Class({
         if (!this._box.contains(dragEvent.targetActor) || showAppsHovered)
             this._clearDragPlaceholder();
 
-        this._showAppsIcon.setHover(showAppsHovered);
+        if (showAppsHovered)
+            this._showAppsIcon.setDragApp(app);
+        else
+            this._showAppsIcon.setDragApp(null);
 
         return DND.DragMotionResult.CONTINUE;
     },



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