[gnome-documents] selections: set the correct initial sensitivity for toolbar items
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-documents] selections: set the correct initial sensitivity for toolbar items
- Date: Tue, 6 Aug 2013 14:51:09 +0000 (UTC)
commit 644c23e59bbdb9dce6cc919da30dfa29160c3643
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Tue Aug 6 16:49:23 2013 +0200
selections: set the correct initial sensitivity for toolbar items
When entering selection mode and no item is selected, we shouldn't show
sensitive items on the toolbar.
src/selections.js | 16 ++++++++++------
1 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/src/selections.js b/src/selections.js
index 3b49c5a..f47edfb 100644
--- a/src/selections.js
+++ b/src/selections.js
@@ -815,15 +815,18 @@ const SelectionToolbar = new Lang.Class({
_setItemVisibility: function() {
let apps = [];
- let showTrash = true;
- let showPrint = true;
- let showProperties = true;
- let showOpen = true;
- let showShare = true;
+ let selection = Application.selectionController.getSelection();
+ let hasSelection = (selection.length > 0);
+
+ let showTrash = hasSelection;
+ let showPrint = hasSelection;
+ let showProperties = hasSelection;
+ let showOpen = hasSelection;
+ let showShare = hasSelection;
+ let showCollection = hasSelection;
this._insideRefresh = true;
- let selection = Application.selectionController.getSelection();
selection.forEach(Lang.bind(this,
function(urn) {
let doc = Application.documentManager.getItemById(urn);
@@ -862,6 +865,7 @@ const SelectionToolbar = new Lang.Class({
this._toolbarTrash.set_sensitive(showTrash);
this._toolbarOpen.set_sensitive(showOpen);
this._toolbarShare.set_sensitive(showShare);
+ this._toolbarCollection.set_sensitive(showCollection);
this._insideRefresh = false;
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]