[tracker/search-bar] TrackerResultsWindow: Cache the pixbufs in the model.
- From: Carlos Garnacho <carlosg src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker/search-bar] TrackerResultsWindow: Cache the pixbufs in the model.
- Date: Thu, 24 Sep 2009 12:01:33 +0000 (UTC)
commit 533c2cb18c3ccb7eca097f4a01be2acd0bb98350
Author: Carlos Garnacho <carlos lanedo com>
Date: Thu Sep 24 13:59:59 2009 +0200
TrackerResultsWindow: Cache the pixbufs in the model.
Getting the icons can be quite expensive, these are now cached in the model.
src/tracker-search-bar/tracker-results-window.c | 39 ++++++++++------------
1 files changed, 18 insertions(+), 21 deletions(-)
---
diff --git a/src/tracker-search-bar/tracker-results-window.c b/src/tracker-search-bar/tracker-results-window.c
index 27612b4..83edb0c 100644
--- a/src/tracker-search-bar/tracker-results-window.c
+++ b/src/tracker-search-bar/tracker-results-window.c
@@ -821,39 +821,36 @@ model_pixbuf_cell_data_func (GtkTreeViewColumn *tree_column,
GtkTreeIter *iter,
TrackerResultsWindow *window)
{
- TrackerCategory category = CATEGORY_NONE;
- gchar *urn;
GdkPixbuf *pixbuf = NULL;
gtk_tree_model_get (model, iter,
COL_IMAGE, &pixbuf,
-1);
- /* If a pixbuf, use it */
- if (pixbuf) {
- g_object_set (cell,
- "visible", TRUE,
- "pixbuf", pixbuf,
- NULL);
- g_object_unref (pixbuf);
+ if (!pixbuf) {
+ TrackerCategory category = CATEGORY_NONE;
+ gchar *urn;
- return;
+ gtk_tree_model_get (model, iter,
+ COL_CATEGORY_ID, &category,
+ COL_URN, &urn,
+ -1);
+
+ /* FIXME: Should use category */
+ pixbuf = pixbuf_get (window, urn, (category & CATEGORY_IMAGE));
+ g_free (urn);
+
+ /* Cache it in the store */
+ gtk_list_store_set (GTK_LIST_STORE (model), iter,
+ COL_IMAGE, pixbuf,
+ -1);
}
- gtk_tree_model_get (model, iter,
- COL_CATEGORY_ID, &category,
- COL_URN, &urn,
- -1);
-
- /* FIXME: Should use category */
- pixbuf = pixbuf_get (window, urn, (category & CATEGORY_IMAGE));
- g_free (urn);
-
g_object_set (cell,
- "visible", TRUE,
+ "visible", (pixbuf != NULL),
"pixbuf", pixbuf,
NULL);
-
+
if (pixbuf) {
g_object_unref (pixbuf);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]