From 84f62487596769d7da6aaf88a8d95bb98cc151e8 Mon Sep 17 00:00:00 2001 From: Claudio Saavedra Date: Mon, 26 Apr 2010 12:34:10 +0300 Subject: [HildonLiveSearch] Use selection map only when not in GTK_SELECTION_NONE It is not necessary to maintain a selection mapping when the GtkTreeView's selection mode is GTK_SELECTION_NONE, so don't waste time on it. --- hildon/hildon-live-search.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/hildon/hildon-live-search.c b/hildon/hildon-live-search.c index cc82699..b8fccda 100644 --- a/hildon/hildon-live-search.c +++ b/hildon/hildon-live-search.c @@ -325,11 +325,18 @@ refilter (HildonLiveSearch *livesearch) { HildonLiveSearchPrivate *priv = livesearch->priv; gboolean handled = FALSE; + gboolean needs_mapping; + + needs_mapping = GTK_IS_TREE_VIEW (priv->kb_focus_widget) && + gtk_tree_selection_get_mode (gtk_tree_view_get_selection ( + GTK_TREE_VIEW (priv->kb_focus_widget))) != GTK_SELECTION_NONE; /* Create/update selection map from current selection */ - if (priv->selection_map == NULL) - selection_map_create (priv); - selection_map_update_map_from_selection (priv); + if (needs_mapping) { + if (priv->selection_map == NULL) + selection_map_create (priv); + selection_map_update_map_from_selection (priv); + } /* Filter the model */ g_signal_emit (livesearch, signals[REFILTER], 0, &handled); @@ -337,7 +344,8 @@ refilter (HildonLiveSearch *livesearch) gtk_tree_model_filter_refilter (priv->filter); /* Restore selection from mapping */ - selection_map_update_selection_from_map (priv); + if (needs_mapping) + selection_map_update_selection_from_map (priv); } static void -- cgit v1.2.3-18-g5258