[gnome-documents] collection-dialog: show source name in the treeview if != local



commit fafb8690fc93c498b26407148687a2ef39e3f08d
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Feb 29 23:09:08 2012 -0500

    collection-dialog: show source name in the treeview if != local
    
    If the collection source is not local, display it in dim in the
    treeview.

 src/selections.js |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/src/selections.js b/src/selections.js
index 1778f8d..903108a 100644
--- a/src/selections.js
+++ b/src/selections.js
@@ -442,6 +442,12 @@ OrganizeCollectionView.prototype = {
         this._viewCol.add_attribute(this._rendererText,
                                     'text', OrganizeModelColumns.NAME);
 
+        this._rendererDetail = new Gd.StyledTextRenderer({ xpad: 16 });
+        this._rendererDetail.add_class('dim-label');
+        this._viewCol.pack_start(this._rendererDetail, false);
+        this._viewCol.set_cell_data_func(this._rendererDetail,
+                                         Lang.bind(this, this._detailCellFunc));
+
         this._rendererText.connect('edited', Lang.bind(this, this._onTextEdited));
         this._rendererText.connect('editing-canceled', Lang.bind(this, this._onTextEditCanceled));
         this._rendererText.connect('editing-started', Lang.bind(this, this._onTextEditStarted));
@@ -521,6 +527,19 @@ OrganizeCollectionView.prototype = {
         cell.inconsistent = (state & OrganizeCollectionState.INCONSISTENT);
     },
 
+    _detailCellFunc: function(col, cell, model, iter) {
+        let id = model.get_value(iter, OrganizeModelColumns.ID);
+        let item = Global.collectionManager.getItemById(id);
+
+        if (item.identifier.indexOf(Query.LOCAL_COLLECTIONS_IDENTIFIER) == -1) {
+            cell.text = Global.sourceManager.getItemById(item.resourceUrn).name;
+            cell.visible = true;
+        } else {
+            cell.text = '';
+            cell.visible = false;
+        }
+    },
+
     addCollection: function() {
         let iter = this._model.model.append();
         let path = this._model.model.get_path(iter);



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