From: Andy Spencer Date: Fri, 12 Feb 2010 21:54:06 +0000 (+0000) Subject: Save the http object between sites X-Git-Tag: v0.4~39 X-Git-Url: http://pileus.org/git/?p=aweather;a=commitdiff_plain;h=09654a91f1251a083f435728cc1523c68d770ef3 Save the http object between sites --- diff --git a/src/aweather-gui.c b/src/aweather-gui.c index 2e05fc4..b54e23a 100644 --- a/src/aweather-gui.c +++ b/src/aweather-gui.c @@ -353,13 +353,11 @@ static void update_times(AWeatherGui *self, GisViewer *viewer, char *site) g_free(path); update_times_gtk(self, times); } else { - GisHttp *http = gis_http_new("/nexrad/level2/"); gchar *base = gis_prefs_get_string(self->prefs, "aweather/nexrad_url", NULL); gchar *local = g_strdup_printf("%s/dir.list", site); gchar *uri = g_strconcat(base, "/", local, NULL); - gchar *path = gis_http_fetch(http, uri, local, GIS_REFRESH, NULL, NULL); + gchar *path = gis_http_fetch(self->http, uri, local, GIS_REFRESH, NULL, NULL); update_times_online_cb(path, TRUE, self); - gis_http_free(http); /* update_times_gtk from update_times_online_cb */ } } @@ -527,6 +525,7 @@ static void aweather_gui_init(AWeatherGui *self) aweather_gui_get_object(self, "offline")); /* deprecated site stuff */ + self->http = gis_http_new("/nexrad/level2/"); g_signal_connect(self->viewer, "location-changed", G_CALLBACK(on_gis_location_changed), self); g_signal_connect(self->viewer, "refresh", @@ -563,6 +562,10 @@ static void aweather_gui_dispose(GObject *_self) g_object_unref(self->prefs); self->prefs = NULL; } + if (self->http) { + gis_http_free(self->http); + self->http = NULL; + } G_OBJECT_CLASS(aweather_gui_parent_class)->dispose(_self); } static void aweather_gui_finalize(GObject *_self) diff --git a/src/aweather-gui.h b/src/aweather-gui.h index 396955c..aa90f93 100644 --- a/src/aweather-gui.h +++ b/src/aweather-gui.h @@ -43,6 +43,9 @@ struct _AWeatherGui { GisPlugins *plugins; GisPrefs *prefs; GtkListStore *gtk_plugins; + + /* Deprecated */ + GisHttp *http; }; struct _AWeatherGuiClass {