diff options
author | Milan Crha <mcrha@redhat.com> | 2010-02-19 21:26:32 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2010-02-19 21:26:32 +0800 |
commit | 6633112f54ffbff1a331b93de1cc00d6c849fc0d (patch) | |
tree | 3eef72ec70bf447037aa3cc88f6cf3ad9c8a7505 | |
parent | 320ec4b32e74fa948f122868ba5474a81fad5875 (diff) | |
download | gsoc2013-evolution-6633112f54ffbff1a331b93de1cc00d6c849fc0d.tar.gz gsoc2013-evolution-6633112f54ffbff1a331b93de1cc00d6c849fc0d.tar.zst gsoc2013-evolution-6633112f54ffbff1a331b93de1cc00d6c849fc0d.zip |
Bug #610061 - Do not re-run book view on same book with same query
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-model.c | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c index 1906f665a2..4d40ced9e8 100644 --- a/addressbook/gui/widgets/e-addressbook-model.c +++ b/addressbook/gui/widgets/e-addressbook-model.c @@ -783,6 +783,9 @@ e_addressbook_model_set_book (EAddressbookModel *model, g_return_if_fail (E_IS_BOOK (book)); if (model->priv->book != NULL) { + if (model->priv->book == book) + return; + if (model->priv->writable_status_id != 0) g_signal_handler_disconnect ( model->priv->book, @@ -856,15 +859,34 @@ void e_addressbook_model_set_query (EAddressbookModel *model, const gchar *query) { - g_return_if_fail (E_IS_ADDRESSBOOK_MODEL (model)); + EBookQuery *book_query; - if (model->priv->query != NULL) - e_book_query_unref (model->priv->query); + g_return_if_fail (E_IS_ADDRESSBOOK_MODEL (model)); if (query == NULL) - model->priv->query = e_book_query_any_field_contains (""); + book_query = e_book_query_any_field_contains (""); else - model->priv->query = e_book_query_from_string (query); + book_query = e_book_query_from_string (query); + + if (model->priv->query != NULL) { + gchar *old_query, *new_query; + + old_query = e_book_query_to_string (model->priv->query); + new_query = e_book_query_to_string (book_query); + + if (old_query && new_query && g_str_equal (old_query, new_query)) { + g_free (old_query); + g_free (new_query); + e_book_query_unref (book_query); + return; + } + + g_free (old_query); + g_free (new_query); + e_book_query_unref (model->priv->query); + } + + model->priv->query = book_query; if (model->priv->book_view_idle_id == 0) model->priv->book_view_idle_id = g_idle_add ( |