devhelp r1159 - in trunk: . src



Author: rhult
Date: Mon Oct  6 18:10:16 2008
New Revision: 1159
URL: http://svn.gnome.org/viewvc/devhelp?rev=1159&view=rev

Log:
2008-10-06  Richard Hult  <richard imendio com>

	* src/dh-keyword-model.c: (keyword_model_get_iter),
	(keyword_model_iter_n_children), (dh_keyword_model_filter): No
	need to go through the hit list constantly in the tree model
	implementation, just keep the result that we already have after
	updating the list.


Modified:
   trunk/ChangeLog
   trunk/src/dh-keyword-model.c

Modified: trunk/src/dh-keyword-model.c
==============================================================================
--- trunk/src/dh-keyword-model.c	(original)
+++ trunk/src/dh-keyword-model.c	Mon Oct  6 18:10:16 2008
@@ -29,7 +29,9 @@
 
 struct _DhKeywordModelPriv {
         GList *original_list;
+
         GList *keyword_words;
+        gint   keyword_words_length;
 
         gint   stamp;
 };
@@ -125,7 +127,7 @@
                 return FALSE;
         }
 
-        if (indices[0] >= g_list_length (priv->keyword_words)) {
+        if (indices[0] >= priv->keyword_words_length) {
                 return FALSE;
         }
 
@@ -243,7 +245,7 @@
         priv = DH_KEYWORD_MODEL (tree_model)->priv;
 
         if (iter == NULL) {
-                return g_list_length (priv->keyword_words);
+                return priv->keyword_words_length;
         }
 
         g_return_val_if_fail (priv->stamp == iter->stamp, -1);
@@ -355,7 +357,7 @@
          * on all rows that is included in the new list and remove on all
          * outside it.
          */
-        old_length = g_list_length (priv->keyword_words);
+        old_length = priv->keyword_words_length;
 
         if (!strcmp ("", string)) {
                 new_list = NULL;
@@ -460,6 +462,7 @@
         }
 
         priv->keyword_words = new_list;
+        priv->keyword_words_length = new_length;
 
         /* Update rows 0 - new_length. */
         for (i = 0; i < new_length; ++i) {



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