Patch for #59222, and small code cleanup
- From: Kristian Rietveld <kristian planet nl>
- To: Jonathan Blandford <jrb redhat com>, GTK Development list <gtk-devel-list gnome org>
- Subject: Patch for #59222, and small code cleanup
- Date: Sun, 2 Sep 2001 13:27:53 +0200 (CEST)
Hi,
Here's a patch that fixes #59222. It also contains some small code
cleanups of the treeview search code. Details are in ChangeLog.
Ok to commit?
regards,
Kris
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/gtk+/ChangeLog,v
retrieving revision 1.2237
diff -u -r1.2237 ChangeLog
--- ChangeLog 2001/09/01 20:56:40 1.2237
+++ ChangeLog 2001/09/02 11:20:23
@@ -1,3 +1,12 @@
+Sun Sep 2 13:15:07 2001 Kristian Rietveld <kristian planet nl>
+
+ * gtk/gtktreeview.c (gtk_tree_view_search_iter): code cleaup,
+ fix for bug #59222.
+
+ * gtk/gtktreeview.c (gtk_tree_view_search_equal_func): add
+ gpointer search_data argument to function definition and
+ prototype, to match GtkTreeViewSearchEqualFunc typedef.
+
Sat Sep 1 21:57:27 2001 Kristian Rietveld <kristian planet nl>
* gtk/gtkrbtree.c (_gtk_rbtree_reorder): add warnings
Index: gtk/gtktreeview.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktreeview.c,v
retrieving revision 1.131
diff -u -r1.131 gtktreeview.c
--- gtk/gtktreeview.c 2001/09/01 04:14:24 1.131
+++ gtk/gtktreeview.c 2001/09/02 11:20:33
@@ -364,7 +364,8 @@
static gboolean gtk_tree_view_search_equal_func (GtkTreeModel *model,
gint column,
gchar *key,
- GtkTreeIter *iter);
+ GtkTreeIter *iter,
+ gpointer search_data);
static gboolean gtk_tree_view_search_iter (GtkTreeModel *model,
GtkTreeSelection *selection,
GtkTreeIter *iter,
@@ -8865,7 +8866,8 @@
gtk_tree_view_search_equal_func (GtkTreeModel *model,
gint column,
gchar *key,
- GtkTreeIter *iter)
+ GtkTreeIter *iter,
+ gpointer search_data)
{
gboolean retval = TRUE;
gchar *normalized_string;
@@ -8906,61 +8908,36 @@
GtkTreeView *tree_view = gtk_tree_selection_get_tree_view (selection);
GtkTreeViewColumn *column =
gtk_tree_view_get_column (tree_view, tree_view->priv->search_column);
-
- if (! tree_view->priv->search_equal_func (model, tree_view->priv->search_column, text, iter, tree_view->priv->search_user_data))
- {
- (*count)++;
-
- if (*count == n)
- {
- GtkTreePath *path;
-
- gtk_tree_selection_select_iter (selection, iter);
-
- path = gtk_tree_model_get_path (model, iter);
- gtk_tree_view_scroll_to_cell (tree_view, path, column, TRUE, 0.5, 0.5);
- gtk_tree_view_real_set_cursor (tree_view, path, FALSE);
- gtk_tree_path_free (path);
-
- return TRUE;
- }
- }
-
- if (gtk_tree_model_iter_has_child (model, iter))
+
+ do
{
- gboolean ret;
- GtkTreeIter child;
-
- gtk_tree_model_iter_children (model, &child, iter);
- ret = gtk_tree_view_search_iter (model, selection,
- &child, text,
- count, n);
+ GtkRBTree *tree = NULL;
+ GtkRBNode *node = NULL;
+ GtkTreePath *path;
- if (ret)
- return TRUE; /* iter found and selected */
- }
-
- while (gtk_tree_model_iter_next (model, iter))
- {
+ path = gtk_tree_model_get_path (model, iter);
+ _gtk_tree_view_find_node (tree_view, path, &tree, &node);
+
if (! tree_view->priv->search_equal_func (model, tree_view->priv->search_column, text, iter, tree_view->priv->search_user_data))
{
(*count)++;
if (*count == n)
{
- GtkTreePath *path;
-
gtk_tree_selection_select_iter (selection, iter);
-
- path = gtk_tree_model_get_path (model, iter);
- gtk_tree_view_scroll_to_cell (tree_view, path, column, TRUE, 0.5, 0.5);
+ gtk_tree_view_scroll_to_cell (tree_view, path, column,
+ TRUE, 0.5, 0.5);
gtk_tree_view_real_set_cursor (tree_view, path, FALSE);
- gtk_tree_path_free (path);
+ gtk_tree_path_free (path);
return TRUE;
}
}
+
+ if (path)
+ gtk_tree_path_free (path);
- if (gtk_tree_model_iter_has_child (model, iter))
+ if (node->children &&
+ gtk_tree_model_iter_has_child (model, iter))
{
gboolean ret;
GtkTreeIter child;
@@ -8974,7 +8951,8 @@
return TRUE; /* iter found and selected */
}
}
-
+ while (gtk_tree_model_iter_next (model, iter));
+
return FALSE;
}
--
Odi et amo. Quare id faciam, fortasse requiris?
Nescio, sed fieri sentio et excrucior.
-Catullus (Carmen 85)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]