[evolution] Remove usage of deprecated e_client_is_opened().



commit 3fa4dfc54dd08d75076d4881207bdc45c3ee29ee
Author: Matthew Barnes <mbarnes redhat com>
Date:   Fri Jan 25 15:18:25 2013 -0500

    Remove usage of deprecated e_client_is_opened().
    
    e_client_is_opened() always returns TRUE, so skip it.

 calendar/gui/e-cal-model.c                   |   88 +-------------------------
 calendar/gui/gnome-cal.c                     |    4 -
 calendar/gui/tag-calendar.c                  |    3 -
 e-util/e-client-utils.c                      |    7 +--
 e-util/e-contact-store.c                     |   14 +---
 modules/calendar/e-cal-shell-view-private.c  |    3 +-
 modules/calendar/e-memo-shell-view-private.c |    3 +-
 modules/calendar/e-task-shell-view-private.c |    3 +-
 8 files changed, 10 insertions(+), 115 deletions(-)
---
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index 617399b..8ed2e52 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -1457,8 +1457,7 @@ ecm_append_row (ETableModel *etm,
 	if (comp_data->client)
 		g_object_ref (comp_data->client);
 
-	/* guard against saving before the calendar is open */
-	if (!comp_data->client || !e_client_is_opened (E_CLIENT (comp_data->client))) {
+	if (!comp_data->client) {
 		g_object_unref (comp_data);
 		return;
 	}
@@ -2923,10 +2922,6 @@ update_e_cal_view_for_client (ECalModel *model,
 
 	priv = model->priv;
 
-	/* Skip if this client has not finished loading yet */
-	if (!e_client_is_opened (E_CLIENT (client_data->client)))
-		return;
-
 	/* free the previous view, if any */
 	if (client_data->view) {
 		g_signal_handlers_disconnect_matched (
@@ -2980,69 +2975,6 @@ backend_died_cb (ECalClient *client,
 	e_cal_model_remove_client (model, client);
 }
 
-static void
-cal_model_retrieve_capabilies_cb (GObject *source_object,
-                                  GAsyncResult *result,
-                                  gpointer user_data)
-{
-	ECalClient *client = E_CAL_CLIENT (source_object);
-	ECalModel *model = user_data;
-	ECalModelClient *client_data;
-	gchar *capabilities = NULL;
-
-	g_return_if_fail (client != NULL);
-	g_return_if_fail (model != NULL);
-
-	e_client_retrieve_capabilities_finish (
-		E_CLIENT (client), result, &capabilities, NULL);
-	g_free (capabilities);
-
-	e_cal_model_update_status_message (model, NULL, -1.0);
-
-	client_data = find_client_data (model, client);
-	g_return_if_fail (client_data);
-
-	update_e_cal_view_for_client (model, client_data);
-}
-
-static void
-client_opened_cb (GObject *source_object,
-                  GAsyncResult *result,
-                  gpointer user_data)
-{
-	ECalClient *client = E_CAL_CLIENT (source_object);
-	ECalModel *model = (ECalModel *) user_data;
-	GError *error = NULL;
-
-	e_client_open_finish (E_CLIENT (client), result, &error);
-
-	if (g_error_matches (error, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
-	    g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
-		g_error_free (error);
-		return;
-	}
-
-	if (error != NULL) {
-		ESource *source;
-
-		source = e_client_get_source (E_CLIENT (client));
-		e_cal_model_remove_client (model, client);
-		g_warning (
-			"%s: Failed to open '%s': %s",
-			G_STRFUNC,
-			e_source_get_display_name (source),
-			error->message);
-		g_error_free (error);
-		e_cal_model_update_status_message (model, NULL, -1.0);
-		return;
-	}
-
-	/* to have them ready for later use */
-	e_client_retrieve_capabilities (
-		E_CLIENT (client), model->priv->loading_clients,
-		cal_model_retrieve_capabilies_cb, model);
-}
-
 static ECalModelClient *
 add_new_client (ECalModel *model,
                 ECalClient *client,
@@ -3081,23 +3013,7 @@ add_new_client (ECalModel *model,
 		G_CALLBACK (backend_died_cb), model);
 
  load:
-	if (e_client_is_opened (E_CLIENT (client))) {
-		update_e_cal_view_for_client (model, client_data);
-	} else {
-		ESource *source;
-		const gchar *display_name;
-		gchar *msg;
-
-		source = e_client_get_source (E_CLIENT (client));
-		display_name = e_source_get_display_name (source);
-		msg = g_strdup_printf (_("Opening %s"), display_name);
-		e_cal_model_update_status_message (model, msg, -1.0);
-		g_free (msg);
-
-		e_cal_client_set_default_timezone (client, e_cal_model_get_timezone (model));
-
-		e_client_open (E_CLIENT (client), TRUE, model->priv->loading_clients, client_opened_cb, model);
-	}
+	update_e_cal_view_for_client (model, client_data);
 
 	return client_data;
 }
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 66bb52a..c418c32 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -1177,10 +1177,6 @@ update_query_async (struct _date_query_msg *msg)
 		ECalClient *client = E_CAL_CLIENT (iter->data);
 		GError *error = NULL;
 
-		/* don't create queries for clients not loaded yet */
-		if (!e_client_is_opened (E_CLIENT (client)))
-			continue;
-
 		new_view = NULL;
 		if (!e_cal_client_get_view_sync (client, real_sexp, &new_view, NULL, &error)) {
 			g_warning (G_STRLOC ": Could not create the view: %s ", error->message);
diff --git a/calendar/gui/tag-calendar.c b/calendar/gui/tag-calendar.c
index f681641..06e2bb0 100644
--- a/calendar/gui/tag-calendar.c
+++ b/calendar/gui/tag-calendar.c
@@ -165,9 +165,6 @@ tag_calendar_by_client (ECalendar *ecal,
 	if (!gtk_widget_get_visible (GTK_WIDGET (ecal)))
 		return;
 
-	if (!e_client_is_opened (E_CLIENT (client)))
-		return;
-
 	closure = g_new0 (struct calendar_tag_closure, 1);
 
 	if (!prepare_tag (ecal, closure, NULL, TRUE)) {
diff --git a/e-util/e-client-utils.c b/e-util/e-client-utils.c
index 04efbe8..167c1af 100644
--- a/e-util/e-client-utils.c
+++ b/e-util/e-client-utils.c
@@ -312,12 +312,7 @@ client_utils_open_new_async_cb (GObject *source_object,
 		return;
 	}
 
-	if (e_client_is_opened (async_data->client)) {
-		client_utils_open_new_done (async_data);
-		return;
-	}
-
-	/* wait for 'opened' signal, which is received in client_utils_opened_cb */
+	client_utils_open_new_done (async_data);
 }
 
 /**
diff --git a/e-util/e-contact-store.c b/e-util/e-contact-store.c
index 4e49399..acfbe71 100644
--- a/e-util/e-contact-store.c
+++ b/e-util/e-contact-store.c
@@ -881,7 +881,7 @@ static void
 query_contact_source (EContactStore *contact_store,
                       ContactSource *source)
 {
-	gboolean is_opened;
+	gchar *query_str;
 
 	g_assert (source->book_client != NULL);
 
@@ -890,8 +890,6 @@ query_contact_source (EContactStore *contact_store,
 		return;
 	}
 
-	is_opened = e_client_is_opened (E_CLIENT (source->book_client));
-
 	if (source->client_view) {
 		if (source->client_view_pending) {
 			stop_view (contact_store, source->client_view_pending);
@@ -902,13 +900,9 @@ query_contact_source (EContactStore *contact_store,
 		}
 	}
 
-	if (is_opened) {
-		gchar *query_str;
-
-		query_str = e_book_query_to_string (contact_store->priv->query);
-		e_book_client_get_view (source->book_client, query_str, NULL, client_view_ready_cb, g_object_ref (contact_store));
-		g_free (query_str);
-	}
+	query_str = e_book_query_to_string (contact_store->priv->query);
+	e_book_client_get_view (source->book_client, query_str, NULL, client_view_ready_cb, g_object_ref (contact_store));
+	g_free (query_str);
 }
 
 /* ----------------- *
diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c
index d62b977b..10e67e8 100644
--- a/modules/calendar/e-cal-shell-view-private.c
+++ b/modules/calendar/e-cal-shell-view-private.c
@@ -1188,8 +1188,7 @@ e_cal_shell_view_update_timezone (ECalShellView *cal_shell_view)
 	for (iter = clients; iter != NULL; iter = iter->next) {
 		ECalClient *client = iter->data;
 
-		if (e_client_is_opened (E_CLIENT (client)))
-			e_cal_client_set_default_timezone (client, timezone);
+		e_cal_client_set_default_timezone (client, timezone);
 	}
 
 	g_list_free (clients);
diff --git a/modules/calendar/e-memo-shell-view-private.c b/modules/calendar/e-memo-shell-view-private.c
index 27ffad3..d881c8c 100644
--- a/modules/calendar/e-memo-shell-view-private.c
+++ b/modules/calendar/e-memo-shell-view-private.c
@@ -456,8 +456,7 @@ e_memo_shell_view_update_timezone (EMemoShellView *memo_shell_view)
 	for (iter = clients; iter != NULL; iter = iter->next) {
 		ECalClient *client = iter->data;
 
-		if (e_client_is_opened (E_CLIENT (client)))
-			e_cal_client_set_default_timezone (client, timezone);
+		e_cal_client_set_default_timezone (client, timezone);
 	}
 
 	g_list_free (clients);
diff --git a/modules/calendar/e-task-shell-view-private.c b/modules/calendar/e-task-shell-view-private.c
index 816b853..028661b 100644
--- a/modules/calendar/e-task-shell-view-private.c
+++ b/modules/calendar/e-task-shell-view-private.c
@@ -637,8 +637,7 @@ e_task_shell_view_update_timezone (ETaskShellView *task_shell_view)
 	for (iter = clients; iter != NULL; iter = iter->next) {
 		ECalClient *client = iter->data;
 
-		if (e_client_is_opened (E_CLIENT (client)))
-			e_cal_client_set_default_timezone (client, timezone);
+		e_cal_client_set_default_timezone (client, timezone);
 	}
 
 	g_list_free (clients);



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