[evolution] Bug #632671 - "Search interrupted" status message forever



commit b4651e66b17164b460c89514de44344c12e92aba
Author: Milan Crha <mcrha redhat com>
Date:   Tue Nov 9 10:23:01 2010 +0100

    Bug #632671 - "Search interrupted" status message forever

 addressbook/gui/widgets/e-addressbook-model.c |   27 +++++++++++++++++++++++++
 addressbook/gui/widgets/e-addressbook-view.c  |    2 +-
 2 files changed, 28 insertions(+), 1 deletions(-)
---
diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c
index 7fa827a..e6b24ab 100644
--- a/addressbook/gui/widgets/e-addressbook-model.c
+++ b/addressbook/gui/widgets/e-addressbook-model.c
@@ -49,6 +49,7 @@ struct _EAddressbookModelPrivate {
 	gulong writable_status_id;
 	gulong view_complete_id;
 	gulong backend_died_id;
+	guint remove_status_id;
 
 	guint search_in_progress	: 1;
 	guint editable			: 1;
@@ -114,12 +115,15 @@ remove_book_view (EAddressbookModel *model)
 		g_signal_handler_disconnect (
 			model->priv->book_view,
 			model->priv->view_complete_id);
+	if (model->priv->remove_status_id)
+		g_source_remove (model->priv->remove_status_id);
 
 	model->priv->create_contact_id = 0;
 	model->priv->remove_contact_id = 0;
 	model->priv->modify_contact_id = 0;
 	model->priv->status_message_id = 0;
 	model->priv->view_complete_id = 0;
+	model->priv->remove_status_id = 0;
 
 	model->priv->search_in_progress = FALSE;
 
@@ -127,6 +131,8 @@ remove_book_view (EAddressbookModel *model)
 		e_book_view_stop (model->priv->book_view);
 		g_object_unref (model->priv->book_view);
 		model->priv->book_view = NULL;
+
+		g_signal_emit (model, signals[STATUS_MESSAGE], 0, NULL);
 	}
 }
 
@@ -271,6 +277,10 @@ status_message (EBookView *book_view,
 		gchar * status,
 		EAddressbookModel *model)
 {
+	if (model->priv->remove_status_id)
+		g_source_remove (model->priv->remove_status_id);
+	model->priv->remove_status_id = 0;
+
 	g_signal_emit (model, signals[STATUS_MESSAGE], 0, status);
 }
 
@@ -394,6 +404,20 @@ addressbook_model_idle_cb (EAddressbookModel *model)
 	return FALSE;
 }
 
+static gboolean
+remove_status_cb (gpointer data)
+{
+	EAddressbookModel *model = data;
+
+	g_return_val_if_fail (model != NULL, FALSE);
+	g_return_val_if_fail (E_IS_ADDRESSBOOK_MODEL (model), FALSE);
+
+	g_signal_emit (model, signals[STATUS_MESSAGE], 0, NULL);
+	model->priv->remove_status_id = 0;
+
+	return FALSE;
+}
+
 static void
 addressbook_model_set_property (GObject *object,
                                 guint property_id,
@@ -716,6 +740,9 @@ e_addressbook_model_stop (EAddressbookModel *model)
 	message = _("Search Interrupted");
 	g_signal_emit (model, signals[STOP_STATE_CHANGED], 0);
 	g_signal_emit (model, signals[STATUS_MESSAGE], 0, message);
+
+	if (!model->priv->remove_status_id)
+		model->priv->remove_status_id = g_timeout_add_seconds (3, remove_status_cb, model);
 }
 
 gboolean
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index fcf4dd3..bb5fc15 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -1075,9 +1075,9 @@ status_message (EAddressbookView *view,
 
 	if (status == NULL || *status == '\0') {
 		if (activity != NULL) {
+			view->priv->activity = NULL;
 			e_activity_set_state (activity, E_ACTIVITY_COMPLETED);
 			g_object_unref (activity);
-			view->priv->activity = NULL;
 		}
 
 	} else if (activity == NULL) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]