diff options
author | Claudio Saavedra <csaavedra@igalia.com> | 2010-04-26 12:34:10 +0300 |
---|---|---|
committer | Claudio Saavedra <csaavedra@igalia.com> | 2010-04-29 17:10:36 +0300 |
commit | 84f62487596769d7da6aaf88a8d95bb98cc151e8 (patch) | |
tree | 234f25038e56b77ffaad25e2bffb0de92b6fe919 /hildon/hildon-live-search.c | |
parent | 77903905a219dd6d48bf58a4f89b4b2226f1ffe4 (diff) |
[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.
Diffstat (limited to 'hildon/hildon-live-search.c')
-rw-r--r-- | hildon/hildon-live-search.c | 16 |
1 files 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 |