[gnome-shell] Do not show "More" next to "Recent Docs" if there are no docs (bug #582037)



commit 36b11ee8c7eda335d61f4d0210c5361ff06787b7
Author: Siegfried-Angel Gevatter Pujals <rainct ubuntu com>
Date:   Fri Sep 25 20:54:40 2009 +0200

    Do not show "More" next to "Recent Docs" if there are no docs (bug #582037)

 js/ui/dash.js       |   17 +++++++++++++++--
 js/ui/docDisplay.js |    8 ++++++--
 2 files changed, 21 insertions(+), 4 deletions(-)
---
diff --git a/js/ui/dash.js b/js/ui/dash.js
index 6d8c1a4..88eb76c 100644
--- a/js/ui/dash.js
+++ b/js/ui/dash.js
@@ -506,6 +506,13 @@ SectionHeader.prototype = {
             this.backLink.actor.hide();
     },
 
+    setMoreLinkVisible : function(visible) {
+        if (visible)
+            this.moreLink.actor.show();
+        else
+            this.moreLink.actor.hide();
+    },
+
     setCountText : function(countText) {
         if (countText == "") {
             this.countText.hide();
@@ -782,8 +789,8 @@ Dash.prototype = {
 
         this._docsSection = new Section(_("RECENT DOCUMENTS"));
 
-        let docDisplay = new DocDisplay.DashDocDisplay();
-        this._docsSection.content.append(docDisplay.actor, Big.BoxPackFlags.EXPAND);
+        this._docDisplay = new DocDisplay.DashDocDisplay();
+        this._docsSection.content.append(this._docDisplay.actor, Big.BoxPackFlags.EXPAND);
 
         this._moreDocsPane = null;
         this._docsSection.header.moreLink.connect('activated', Lang.bind(this, function (link) {
@@ -795,6 +802,12 @@ Dash.prototype = {
            }
         }));
 
+        this._docDisplay.connect('changed', Lang.bind(this, function () {
+            this._docsSection.header.setMoreLinkVisible(
+                this._docDisplay.actor.get_children().length > 0);
+        }));
+        this._docDisplay.emit('changed');
+
         this.sectionArea.append(this._docsSection.actor, Big.BoxPackFlags.EXPAND);
 
         /***** Search Results *****/
diff --git a/js/ui/docDisplay.js b/js/ui/docDisplay.js
index 6e7f91d..74e2c3d 100644
--- a/js/ui/docDisplay.js
+++ b/js/ui/docDisplay.js
@@ -302,7 +302,7 @@ DashDocDisplayItem.prototype = {
     shellWorkspaceLaunch: function () {
         this._info.launch();
     }
-}
+};
 
 /**
  * Class used to display two column recent documents in the dash
@@ -436,5 +436,9 @@ DashDocDisplay.prototype = {
             let display = new DashDocDisplayItem(docInfo);
             this.actor.add_actor(display.actor);
         }
+        this.emit('changed');
     }
-}
+};
+
+Signals.addSignalMethods(DashDocDisplay.prototype);
+



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