]> Pileus Git - aweather/commitdiff
Save the http object between sites
authorAndy Spencer <andy753421@gmail.com>
Fri, 12 Feb 2010 21:54:06 +0000 (21:54 +0000)
committerAndy Spencer <andy753421@gmail.com>
Fri, 12 Feb 2010 21:54:06 +0000 (21:54 +0000)
src/aweather-gui.c
src/aweather-gui.h

index 2e05fc46f048dc31639089edf3f9cf1f44eb88be..b54e23a8f307d37c5c0703523ccdde74714caa17 100644 (file)
@@ -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)
index 396955cf35730dbb6d6f5c6d05b52d7d9d75c61d..aa90f93d205d41b84b81554f0c5e0259c5af3646 100644 (file)
@@ -43,6 +43,9 @@ struct _AWeatherGui {
        GisPlugins   *plugins;
        GisPrefs     *prefs;
        GtkListStore *gtk_plugins;
+
+       /* Deprecated */
+       GisHttp *http;
 };
 
 struct _AWeatherGuiClass {