From cdac8a4da759cb6a90f6709a434c3a38f2060345 Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Wed, 5 Mar 2003 17:13:34 +0000 Subject: Likewise, assume weather_refresh_time of zero means "never update the * e-summary-weather.c (e_summary_weather_set_online): Likewise, assume weather_refresh_time of zero means "never update the weather". (e_summary_weather_init): Likewise here. (e_summary_weather_reconfigure): And here. * e-summary-rdf.c (e_summary_rdf_init): Don't add the news feeds here -- it should be handled with a GConf schema. Also, assume that prefs is always not NULL (as is the case with the current code), and interpret a timeout value of zero as "never update automatically". (e_summary_rdf_reconfigure): Likewise here. If rdf->timeout is zero, assume there is no pending timeout. (e_summary_rdf_set_online): Likewise here. Sigh, so much duplication in this code. svn path=/trunk/; revision=20174 --- my-evolution/ChangeLog | 18 ++++++++++++++++ my-evolution/e-summary-rdf.c | 46 +++++++++++++++++++++++----------------- my-evolution/e-summary-weather.c | 27 +++++++++++++++-------- my-evolution/e-summary.c | 2 -- 4 files changed, 63 insertions(+), 30 deletions(-) diff --git a/my-evolution/ChangeLog b/my-evolution/ChangeLog index c9cb446e6c..208729ac31 100644 --- a/my-evolution/ChangeLog +++ b/my-evolution/ChangeLog @@ -1,3 +1,21 @@ +2003-03-05 Ettore Perazzoli + + * e-summary-weather.c (e_summary_weather_set_online): Likewise, + assume weather_refresh_time of zero means "never update the + weather". + (e_summary_weather_init): Likewise here. + (e_summary_weather_reconfigure): And here. + + * e-summary-rdf.c (e_summary_rdf_init): Don't add the news feeds + here -- it should be handled with a GConf schema. Also, assume + that prefs is always not NULL (as is the case with the current + code), and interpret a timeout value of zero as "never update + automatically". + (e_summary_rdf_reconfigure): Likewise here. If rdf->timeout is + zero, assume there is no pending timeout. + (e_summary_rdf_set_online): Likewise here. Sigh, so much + duplication in this code. + 2003-03-05 Not Zed * component-factory.c (owner_unset_cb): dont call bonobo_main_quit diff --git a/my-evolution/e-summary-rdf.c b/my-evolution/e-summary-rdf.c index 4a3145849d..578b559c5e 100644 --- a/my-evolution/e-summary-rdf.c +++ b/my-evolution/e-summary-rdf.c @@ -505,9 +505,11 @@ e_summary_rdf_set_online (ESummary *summary, if (online == TRUE) { e_summary_rdf_update (summary); - rdf->timeout = gtk_timeout_add (summary->preferences->rdf_refresh_time * 1000, - (GtkFunction) e_summary_rdf_update, - summary); + + if (summary->preferences->rdf_refresh_time != 0) + rdf->timeout = gtk_timeout_add (summary->preferences->rdf_refresh_time * 1000, + (GtkFunction) e_summary_rdf_update, + summary); } else { for (p = rdf->rdfs; p; p = p->next) { RDF *r; @@ -532,12 +534,15 @@ e_summary_rdf_init (ESummary *summary) ESummaryPrefs *prefs; ESummaryRDF *rdf; ESummaryConnection *connection; + GSList *p; int timeout; g_return_if_fail (summary != NULL); g_return_if_fail (IS_E_SUMMARY (summary)); prefs = summary->preferences; + g_assert (prefs != NULL); + rdf = g_new0 (ESummaryRDF, 1); summary->rdf = rdf; @@ -554,22 +559,19 @@ e_summary_rdf_init (ESummary *summary) e_summary_add_online_connection (summary, connection); e_summary_add_protocol_listener (summary, "rdf", e_summary_rdf_protocol, rdf); - if (prefs == NULL) { - e_summary_rdf_add_uri (summary, "http://linuxtoday.com/backend/my-netscape.rdf"); - e_summary_rdf_add_uri (summary, "http://www.salon.com/feed/RDF/salon_use.rdf"); - timeout = 600; - } else { - GSList *p; - for (p = prefs->rdf_urls; p; p = p->next) { - e_summary_rdf_add_uri (summary, p->data); - } - timeout = prefs->rdf_refresh_time; + for (p = prefs->rdf_urls; p; p = p->next) { + e_summary_rdf_add_uri (summary, p->data); } + timeout = prefs->rdf_refresh_time; e_summary_rdf_update (summary); - rdf->timeout = gtk_timeout_add (timeout * 1000, - (GtkFunction) e_summary_rdf_update, summary); + + if (rdf->timeout == 0) + rdf->timeout = 0; + else + rdf->timeout = gtk_timeout_add (timeout * 1000, + (GtkFunction) e_summary_rdf_update, summary); return; } @@ -587,7 +589,10 @@ e_summary_rdf_reconfigure (ESummary *summary) rdf = summary->rdf; /* Stop timeout */ - gtk_timeout_remove (rdf->timeout); + if (rdf->timeout != 0) { + gtk_timeout_remove (rdf->timeout); + rdf->timeout = 0; + } old = rdf->rdfs; rdf->rdfs = NULL; @@ -603,7 +608,10 @@ e_summary_rdf_reconfigure (ESummary *summary) e_summary_rdf_add_uri (summary, sp->data); } - rdf->timeout = gtk_timeout_add (summary->preferences->rdf_refresh_time * 1000, (GtkFunction) e_summary_rdf_update, summary); + if (summary->preferences->rdf_refresh_time != 0) + rdf->timeout = gtk_timeout_add (summary->preferences->rdf_refresh_time * 1000, + (GtkFunction) e_summary_rdf_update, summary); + e_summary_rdf_update (summary); } @@ -618,9 +626,9 @@ e_summary_rdf_free (ESummary *summary) rdf = summary->rdf; - if (rdf->timeout != 0) { + if (rdf->timeout != 0) gtk_timeout_remove (rdf->timeout); - } + for (p = rdf->rdfs; p; p = p->next) { RDF *r = p->data; diff --git a/my-evolution/e-summary-weather.c b/my-evolution/e-summary-weather.c index 3bafa212e9..221c96b7b9 100644 --- a/my-evolution/e-summary-weather.c +++ b/my-evolution/e-summary-weather.c @@ -530,9 +530,11 @@ e_summary_weather_set_online (ESummary *summary, if (online == TRUE) { e_summary_weather_update (summary); - weather->timeout = gtk_timeout_add (summary->preferences->weather_refresh_time * 1000, - (GtkFunction) e_summary_weather_update, - summary); + + if (summary->preferences->weather_refresh_time != 0) + weather->timeout = gtk_timeout_add (summary->preferences->weather_refresh_time * 1000, + (GtkFunction) e_summary_weather_update, + summary); } else { for (p = weather->weathers; p; p = p->next) { Weather *w; @@ -608,10 +610,13 @@ e_summary_weather_init (ESummary *summary) } e_summary_weather_update (summary); - - weather->timeout = gtk_timeout_add (timeout * 1000, - (GtkFunction) e_summary_weather_update, - summary); + + if (timeout == 0) + weather->timeout = 0; + else + weather->timeout = gtk_timeout_add (timeout * 1000, + (GtkFunction) e_summary_weather_update, + summary); return; } @@ -789,8 +794,12 @@ e_summary_weather_reconfigure (ESummary *summary) e_summary_weather_add_location (summary, p->data); } - weather->timeout = gtk_timeout_add (summary->preferences->weather_refresh_time * 1000, - (GtkFunction) e_summary_weather_update, summary); + if (summary->preferences->weather_refresh_time == 0) + weather->timeout = 0; + else + weather->timeout = gtk_timeout_add (summary->preferences->weather_refresh_time * 1000, + (GtkFunction) e_summary_weather_update, summary); + e_summary_weather_update (summary); } diff --git a/my-evolution/e-summary.c b/my-evolution/e-summary.c index c32bd5bb5b..4da070762e 100644 --- a/my-evolution/e-summary.c +++ b/my-evolution/e-summary.c @@ -574,8 +574,6 @@ e_summary_new (const GNOME_Evolution_Shell shell, e_summary_rdf_init (summary); e_summary_weather_init (summary); -/* e_summary_draw (summary); */ - all_summaries = g_list_prepend (all_summaries, summary); return GTK_WIDGET (summary); } -- cgit v1.2.3