aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--modules/addressbook/e-book-shell-view-private.c24
-rw-r--r--modules/addressbook/e-book-shell-view.c3
2 files changed, 24 insertions, 3 deletions
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
@@ -184,6 +184,25 @@ contacts_removed (EBookShellView *book_shell_view,
}
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,
gpointer user_data)
@@ -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