From c15fba1038c1cfbd032f9c23838366b8affbd217 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Thu, 3 Nov 2011 10:50:21 +0100 Subject: Bug #663286 - Changing view clears Contact preview --- modules/addressbook/e-book-shell-view-private.c | 24 ++++++++++++++++++++++++ modules/addressbook/e-book-shell-view.c | 3 --- 2 files changed, 24 insertions(+), 3 deletions(-) (limited to 'modules/addressbook') diff --git a/modules/addressbook/e-book-shell-view-private.c b/modules/addressbook/e-book-shell-view-private.c index 20fd278f66..b1895c4fb8 100644 --- a/modules/addressbook/e-book-shell-view-private.c +++ b/modules/addressbook/e-book-shell-view-private.c @@ -183,6 +183,25 @@ contacts_removed (EBookShellView *book_shell_view, book_shell_view->priv->preview_index = -1; } +static void +model_query_changed_cb (EBookShellView *book_shell_view, + GParamSpec *param, + EAddressbookModel *model) +{ + EBookShellContent *book_shell_content; + EAddressbookView *current_view; + + book_shell_content = book_shell_view->priv->book_shell_content; + current_view = e_book_shell_content_get_current_view (book_shell_content); + + if (!current_view || e_addressbook_view_get_model (current_view) != model) + return; + + /* clear the contact preview when model's query changed */ + e_book_shell_content_set_preview_contact (book_shell_content, NULL); + book_shell_view->priv->preview_index = -1; +} + static void book_shell_view_loaded_cb (GObject *source_object, GAsyncResult *result, @@ -330,6 +349,11 @@ book_shell_view_activate_selected_source (EBookShellView *book_shell_view, model, "contacts-removed", G_CALLBACK (contacts_removed), book_shell_view, G_CONNECT_SWAPPED); + + g_signal_connect_object ( + model, "notify::query", + G_CALLBACK (model_query_changed_cb), + book_shell_view, G_CONNECT_SWAPPED); } e_book_shell_content_set_current_view ( diff --git a/modules/addressbook/e-book-shell-view.c b/modules/addressbook/e-book-shell-view.c index 57b86c8d86..f0541eb40c 100644 --- a/modules/addressbook/e-book-shell-view.c +++ b/modules/addressbook/e-book-shell-view.c @@ -247,9 +247,6 @@ book_shell_view_execute_search (EShellView *shell_view) view, filter_id, search_id, search_text, advanced_search); g_free (query); g_free (search_text); - - e_book_shell_content_set_preview_contact (book_shell_content, NULL); - priv->preview_index = -1; } static void -- cgit