changeset 195:1abed11b59f9

display icons for people
author Myk Melez <myk@mozilla.org>
date Sat, 26 Jul 2008 00:08:02 -0700
parents bdb8643cbeab
children 175375954d44
files extension/content/collections.css extension/content/collections.js extension/modules/collection.js
diffstat 3 files changed, 28 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/extension/content/collections.css	Fri Jul 25 22:32:02 2008 -0700
+++ b/extension/content/collections.css	Sat Jul 26 00:08:02 2008 -0700
@@ -9,4 +9,10 @@
 #sourcesView {
   margin-left: 0;
   margin-right: 0;
-}
\ No newline at end of file
+}
+
+/* Make the tree icons be 16x16 in size even if the image files are larger. */
+#sourcesView > treechildren::-moz-tree-image {
+  width: 16px;
+  height: 16px;
+}
--- a/extension/content/collections.js	Fri Jul 25 22:32:02 2008 -0700
+++ b/extension/content/collections.js	Sat Jul 26 00:08:02 2008 -0700
@@ -170,9 +170,9 @@
     }
   },
 
-  getRowProperties: function (aRow, aProperties) {},
-  getCellProperties: function (aRow, aColumn, aProperties) {},
-  getColumnProperties: function(aColumnID, aColumn, aProperties) {},
+  getRowProperties: function (row, properties) {},
+  getCellProperties: function (row, column, properties) {},
+  getColumnProperties: function(columnID, column, properties) {},
 
   setCellText: function(aRow, aCol, aValue) {
     let statement = SnowlDatastore.createStatement("UPDATE sources SET name = :name WHERE id = :id");
@@ -237,11 +237,12 @@
 
     {
       let grouping = {
-        nameColumn: "authors.name"
-        // FIXME: get a favicon for people
+        nameColumn: "authors.name",
+        iconURLColumn: "authors.iconURL"
       }
       let collection = new SnowlCollection(null, null, grouping);
       collection.name = "People";
+      collection.defaultFaviconURI = URI.get("chrome://snowl/content/icons/user.png");
       this._collections.push(collection);
     }
 
--- a/extension/modules/collection.js	Fri Jul 25 22:32:02 2008 -0700
+++ b/extension/modules/collection.js	Sat Jul 26 00:08:02 2008 -0700
@@ -84,6 +84,9 @@
         if (statement.row.uri)
           group.uri = URI.get(statement.row.uri);
 
+        if (statement.row.iconURL)
+          group.iconURL = URI.get(statement.row.iconURL);
+
         group.defaultFaviconURI = this.grouping.defaultFaviconURI;
         group.level = this.level + 1;
         groups.push(group);
@@ -113,6 +116,15 @@
     else
       columns.push("NULL AS uri");
 
+    // For some reason, trying to access statement.row.uri dies without throwing
+    // an exception if uri isn't defined as a column in the query, so we have to
+    // define it here even if we don't have a URI column.
+    // FIXME: file a bug on this bizarre behavior.
+    if (this.grouping.iconURLColumn)
+      columns.push(this.grouping.iconURLColumn + " AS iconURL");
+    else
+      columns.push("NULL AS iconURL");
+
     let query = 
       "SELECT " + columns.join(", ") + " " +
       "FROM sources JOIN messages ON sources.id = messages.sourceID " +
@@ -149,6 +161,9 @@
   },
 
   get faviconURI() {
+    if (this.iconURL)
+      return this.iconURL;
+
     if (this.uri) {
       try {
         return this._faviconSvc.getFaviconForPage(this.uri);