From 9f6d470e753e1b909a304208cb06f104bb0cb324 Mon Sep 17 00:00:00 2001 From: Iain Holmes Date: Wed, 31 Oct 2001 12:53:18 +0000 Subject: Fix bug if you remove all folders, or all rdfs or all weather stations where settings were reset svn path=/trunk/; revision=14534 --- my-evolution/ChangeLog | 12 ++++++++++++ my-evolution/e-summary-preferences.c | 33 +++++++++++++++++++++++++++------ my-evolution/e-summary-rdf.c | 2 +- my-evolution/e-summary-weather.c | 2 +- 4 files changed, 41 insertions(+), 8 deletions(-) diff --git a/my-evolution/ChangeLog b/my-evolution/ChangeLog index b6465ad9a6..d10864fd18 100644 --- a/my-evolution/ChangeLog +++ b/my-evolution/ChangeLog @@ -1,3 +1,15 @@ +2001-10-31 Iain Holmes + + * e-summary-preferences.c (make_initial_rdf_list): Put this back. + (make_initial_weather_list): This too plus fixed a memory leak. + (vector_from_str_list): Allow a NULL list. Return "" instead of NULL. + (e_summary_preferences_restore): Allow the display_folders, rdf_urls, + and stations to be NULL. + + * e-summary-weather.c (e_summary_weather_init): Revert the last changes + + * e-summary-rdf.c (e_summary_rdf_init): Same. + 2001-10-30 Iain Holmes * e-summary-preferences.c (find_name_from_url): Check a for NULL values diff --git a/my-evolution/e-summary-preferences.c b/my-evolution/e-summary-preferences.c index ea05ae5959..3b3192e0ca 100644 --- a/my-evolution/e-summary-preferences.c +++ b/my-evolution/e-summary-preferences.c @@ -62,13 +62,32 @@ make_initial_mail_list (ESummaryPrefs *prefs) static void make_initial_rdf_list (ESummaryPrefs *prefs) { - prefs->rdf_urls = NULL; + GList *rdfs; + + rdfs = g_list_prepend (NULL, g_strdup ("http://www.cnn.com/cnn.rss")); + + prefs->rdf_urls = rdfs; } static void make_initial_weather_list (ESummaryPrefs *prefs) { - prefs->stations = NULL; + /* translators: Put a list of codes for locations you want to see in + My Evolution by default here. You can find the list of all + stations and their codes in Evolution sources. + (evolution/my-evolution/Locations) + Codes are seperated with : eg. "KBOS:EGAA"*/ + char *default_stations = _("KBOS"), **stations_v, **p; + GList *stations = NULL; + + stations_v = g_strsplit (default_stations, ":", 0); + g_assert (stations_v != NULL); + for (p = stations_v; *p != NULL; p++) { + stations = g_list_prepend (stations, *p); + } + g_strfreev (stations_v); + + prefs->stations = g_list_reverse (stations); } /* Load the prefs off disk */ @@ -79,7 +98,9 @@ vector_from_str_list (GList *strlist) char *vector; GString *str; - g_return_val_if_fail (strlist != NULL, NULL); + if (strlist == NULL) { + return g_strdup (""); + } str = g_string_new (""); for (; strlist; strlist = strlist->next) { @@ -138,7 +159,7 @@ e_summary_preferences_restore (ESummaryPrefs *prefs) CORBA_exception_free (&ev); vector = bonobo_config_get_string (db, "My-Evolution/Mail/display_folders", &ev); - if (BONOBO_EX (&ev) || vector == NULL) { + if (BONOBO_EX (&ev)) { g_warning ("Error getting Mail/display_folders"); CORBA_exception_free (&ev); bonobo_object_release_unref (db, NULL); @@ -157,7 +178,7 @@ e_summary_preferences_restore (ESummaryPrefs *prefs) vector = bonobo_config_get_string (db, "My-Evolution/RDF/rdf_urls", &ev); - if (BONOBO_EX (&ev) || vector == NULL) { + if (BONOBO_EX (&ev)) { g_warning ("Error getting RDF/rdf_urls"); CORBA_exception_free (&ev); bonobo_object_release_unref (db, NULL); @@ -171,7 +192,7 @@ e_summary_preferences_restore (ESummaryPrefs *prefs) prefs->limit = bonobo_config_get_long_with_default (db, "My-Evolution/RDF/limit", 10, NULL); vector = bonobo_config_get_string (db, "My-Evolution/Weather/stations", &ev); - if (BONOBO_EX (&ev) || vector == NULL) { + if (BONOBO_EX (&ev)) { g_warning ("Error getting Weather/stations"); CORBA_exception_free (&ev); bonobo_object_release_unref (db, NULL); diff --git a/my-evolution/e-summary-rdf.c b/my-evolution/e-summary-rdf.c index 9981e09198..7fab2f8957 100644 --- a/my-evolution/e-summary-rdf.c +++ b/my-evolution/e-summary-rdf.c @@ -640,7 +640,7 @@ 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 || prefs->rdf_urls == NULL) { + if (prefs == NULL) { e_summary_rdf_add_uri (summary, "http://www.cnn.com/cnn.rss"); timeout = 600; } else { diff --git a/my-evolution/e-summary-weather.c b/my-evolution/e-summary-weather.c index e057584534..2787989277 100644 --- a/my-evolution/e-summary-weather.c +++ b/my-evolution/e-summary-weather.c @@ -653,7 +653,7 @@ e_summary_weather_init (ESummary *summary) e_summary_add_protocol_listener (summary, "weather", e_summary_weather_protocol, weather); - if (prefs == NULL || prefs->stations == NULL) { + if (prefs == NULL) { /* translators: Put here a list of codes for locations you want to see in My Evolution by default. You can find the list of all stations and their codes in Evolution sources -- cgit v1.2.3