NULL the handle after a failed open so the offline handler won't think

2001-10-26  Iain Holmes  <iain@ximian.com>

	* e-summary-rdf.c (open_callback): NULL the handle after a failed
	open so the offline handler won't think they're still open.
	(e_summary_rdf_set_online): Cancel all the open connections when the
	summary goes offline.

	* e-summary-weather.c (open_callback): NULL the handle after a failed
	open so the offline handler won't think they're still open.
	(e_summary_weather_set_online): Cancel all the open connections when the
	summary goes offline.

	* e-summary.c (e_summary_set_online): Call the callback if it's not
	NULL.

svn path=/trunk/; revision=14183
This commit is contained in:
Iain Holmes
2001-10-26 23:15:19 +00:00
committed by Ettore Perazzoli
parent c944779866
commit 0b5c3e9f8b
6 changed files with 58 additions and 7 deletions

View File

@ -1,3 +1,18 @@
2001-10-26 Iain Holmes <iain@ximian.com>
* e-summary-rdf.c (open_callback): NULL the handle after a failed
open so the offline handler won't think they're still open.
(e_summary_rdf_set_online): Cancel all the open connections when the
summary goes offline.
* e-summary-weather.c (open_callback): NULL the handle after a failed
open so the offline handler won't think they're still open.
(e_summary_weather_set_online): Cancel all the open connections when the
summary goes offline.
* e-summary.c (e_summary_set_online): Call the callback if it's not
NULL.
2001-10-25 Jon Trowbridge <trow@ximian.com>
* e-summary-tasks.c (sort_uids): It is possible for

View File

@ -564,6 +564,10 @@ e_summary_mail_free (ESummary *summary)
mail = summary->mail;
bonobo_object_release_unref (mail->folder_info, NULL);
mail->folder_info = CORBA_OBJECT_NIL;
gtk_signal_disconnect_by_func (GTK_OBJECT (mail->listener),
GTK_SIGNAL_FUNC (mail_change_notify), summary);
bonobo_object_unref (BONOBO_OBJECT (mail->listener));
g_hash_table_foreach (mail->folders, free_folder, NULL);

View File

@ -51,9 +51,10 @@ e_summary_offline_handler_create_connection_list (ESummary *summary)
list = GNOME_Evolution_ConnectionList__alloc ();
list->_length = 0;
list->_maximum = e_summary_count_connections (summary);
list->_maximum = e_summary_count_connections (summary) + 1;
list->_buffer = CORBA_sequence_GNOME_Evolution_Connection_allocbuf (list->_maximum);
g_print ("_length: %d\n_maximum: %d\n", list->_length, list->_maximum);
connections = e_summary_add_connections (summary);
for (p = connections; p; p = p->next) {
ESummaryConnectionData *data;
@ -116,13 +117,13 @@ went_offline (ESummary *summary,
CORBA_exception_init (&ev);
g_warning ("Went offline");
GNOME_Evolution_OfflineProgressListener_updateProgress (priv->listener_interface, connection_list, &ev);
if (BONOBO_EX (&ev)) {
g_warning ("Error updating offline progress: %s",
CORBA_exception_id (&ev));
}
GNOME_Evolution_OfflineProgressListener_updateProgress (priv->listener_interface, connection_list, &ev);
if (BONOBO_EX (&ev)) {
g_warning ("Error updating offline progress: %s",
CORBA_exception_id (&ev));
}
CORBA_exception_free (&ev);
CORBA_exception_free (&ev);
}
static void

View File

@ -411,6 +411,7 @@ open_callback (GnomeVFSAsyncHandle *handle,
if (result != GNOME_VFS_OK) {
char *str;
r->handle = NULL;
g_free (r->html);
str = g_strdup_printf ("<b>%s:</b><br>%s", _("Error downloading RDF"),
r->uri);
@ -456,6 +457,7 @@ e_summary_rdf_update (ESummary *summary)
rdf->string = NULL;
}
g_warning ("Opening %s", rdf->uri);
gnome_vfs_async_open (&rdf->handle, rdf->uri,
GNOME_VFS_OPEN_READ,
(GnomeVFSAsyncOpenCallback) open_callback, rdf);
@ -581,6 +583,7 @@ e_summary_rdf_set_online (ESummary *summary,
void *data)
{
ESummaryRDF *rdf;
GList *p;
rdf = summary->rdf;
if (rdf->online == online) {
@ -593,6 +596,16 @@ e_summary_rdf_set_online (ESummary *summary,
(GtkFunction) e_summary_rdf_update,
summary);
} else {
for (p = rdf->rdfs; p; p = p->next) {
RDF *r;
r = p->data;
if (r->handle) {
gnome_vfs_async_cancel (r->handle);
r->handle = NULL;
}
}
gtk_timeout_remove (rdf->timeout);
rdf->timeout = 0;
}

View File

@ -353,6 +353,7 @@ open_callback (GnomeVFSAsyncHandle *handle,
w->html = g_strdup ("<dd> </dd>");
}
w->handle = NULL;
e_summary_draw (w->summary);
return;
}
@ -590,6 +591,7 @@ e_summary_weather_set_online (ESummary *summary,
void *data)
{
ESummaryWeather *weather;
GList *p;
weather = summary->weather;
if (weather->online == online) {
@ -602,6 +604,16 @@ e_summary_weather_set_online (ESummary *summary,
(GtkFunction) e_summary_weather_update,
summary);
} else {
for (p = weather->weathers; p; p = p->next) {
Weather *w;
w = p->data;
if (w->handle) {
gnome_vfs_async_cancel (w->handle);
w->handle = NULL;
}
}
gtk_timeout_remove (weather->timeout);
weather->timeout = 0;
}

View File

@ -777,6 +777,7 @@ e_summary_count_connections (ESummary *summary)
count += c->count (summary, c->closure);
}
g_print ("Count: %d", count);
return count;
}
@ -824,6 +825,11 @@ e_summary_set_online (ESummary *summary,
c->callback_closure = closure;
c->set_online (summary, progress, online, c->closure);
g_print ("Setting %s\n", online ? "online" : "offline");
if (callback != NULL) {
callback (summary, closure);
}
}
}