[gnome-documents] documents: simplify the GtkTreeModel



commit e105f1f3ed5560cc54c64500e4392541a446ca53
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sun Aug 28 21:59:54 2011 -0400

    documents: simplify the GtkTreeModel

 src/documents.js   |   22 ++++++++--------------
 src/lib/gd-utils.c |   34 ++++++----------------------------
 src/lib/gd-utils.h |   11 +----------
 3 files changed, 15 insertions(+), 52 deletions(-)
---
diff --git a/src/documents.js b/src/documents.js
index 13c35a5..d0c68a3 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -323,13 +323,9 @@ Signals.addSignalMethods(DocumentManager.prototype);
 
 const ModelColumns = {
     URN: 0,
-    URI: 1,
-    TITLE: 2,
-    AUTHOR: 3,
-    MTIME: 4,
-    ICON: 5,
-    RESOURCE_URN: 6,
-    FAVORITE: 7
+    TITLE: 1,
+    AUTHOR: 2,
+    ICON: 3
 };
 
 function DocumentModel() {
@@ -359,20 +355,18 @@ DocumentModel.prototype = {
         let treePath = this.model.get_path(iter);
 
         Gd.store_set(this.model, iter,
-                     doc.urn, doc.uri,
+                     doc.urn,
                      doc.title, doc.author,
-                     doc.mtime, doc.pixbuf,
-                     doc.resourceUrn, doc.favorite);
+                     doc.pixbuf);
 
         doc.connect('info-updated', Lang.bind(this,
             function() {
                 let objectIter = this.model.get_iter(treePath)[1];
                 if (objectIter)
                     Gd.store_set(this.model, iter,
-                                 doc.urn, doc.uri,
+                                 doc.urn,
                                  doc.title, doc.author,
-                                 doc.mtime, doc.pixbuf,
-                                 doc.resourceUrn, doc.favorite);
+                                 doc.pixbuf);
             }));
     }
-};
\ No newline at end of file
+};
diff --git a/src/lib/gd-utils.c b/src/lib/gd-utils.c
index fab5009..0da2141 100644
--- a/src/lib/gd-utils.c
+++ b/src/lib/gd-utils.c
@@ -37,48 +37,26 @@
 GtkListStore *
 gd_create_list_store (void)
 {
-  return gtk_list_store_new (8,
+  return gtk_list_store_new (4,
                              G_TYPE_STRING, // URN
-                             G_TYPE_STRING, // URI
                              G_TYPE_STRING, // TITLE
                              G_TYPE_STRING, // AUTHOR
-                             G_TYPE_STRING, // MTIME
-                             GDK_TYPE_PIXBUF, // ICON
-                             G_TYPE_STRING, // RESOURCE_URN
-                             G_TYPE_BOOLEAN); // FAVORITE
+                             GDK_TYPE_PIXBUF); // ICON
 }
 
 void
 gd_store_set (GtkListStore *store,
               GtkTreeIter *iter,
               const gchar *urn,
-              const gchar *uri,
               const gchar *title,
               const gchar *author,
-              const gchar *mtime,
-              GdkPixbuf *icon,
-              const gchar *resource_urn,
-              gboolean favorite)
+              GdkPixbuf *icon)
 {
   gtk_list_store_set (store, iter,
                       0, urn,
-                      1, uri,
-                      2, title,
-                      3, author,
-                      4, mtime,
-                      5, icon,
-                      6, resource_urn,
-                      7, favorite,
-                      -1);
-}
-
-void
-gd_store_update_icon (GtkListStore *store,
-                      GtkTreeIter *iter,
-                      GdkPixbuf *icon)
-{
-  gtk_list_store_set (store, iter,
-                      5, icon,
+                      1, title,
+                      2, author,
+                      3, icon,
                       -1);
 }
 
diff --git a/src/lib/gd-utils.h b/src/lib/gd-utils.h
index 8979a3a..eab4d6e 100644
--- a/src/lib/gd-utils.h
+++ b/src/lib/gd-utils.h
@@ -25,21 +25,12 @@
 #include <gtk/gtk.h>
 
 GtkListStore* gd_create_list_store (void);
-
 void gd_store_set (GtkListStore *store,
                    GtkTreeIter *iter,
                    const gchar *urn,
-                   const gchar *uri,
                    const gchar *title,
                    const gchar *author,
-                   const gchar *mtime,
-                   GdkPixbuf *icon,
-                   const gchar *resource_urn,
-                   gboolean favorite);
-
-void gd_store_update_icon (GtkListStore *store,
-                           GtkTreeIter *iter,
-                           GdkPixbuf *icon);
+                   GdkPixbuf *icon);
 
 GtkListStore* gd_create_sources_store (void);
 void gd_sources_store_set (GtkListStore *store,



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