diff --git a/src/application.vala b/src/application.vala
index 6e68f11..8dab814 100644
--- a/src/application.vala
+++ b/src/application.vala
@@ -37,20 +37,25 @@ namespace Hamlocator {
public override void activate () {
base.activate ();
- var win = this.active_window;
+ var win = (Hamlocator.Window) this.active_window;
if (win == null) {
- win = new Hamlocator.Window (this);
+ win = new Hamlocator.Window (this, this.refresh_location);
}
+ refresh_location();
win.present ();
+ }
+ private void refresh_location() {
+ var win = (Hamlocator.Window) this.active_window;
+ win.SetRefreshButtonEnabled(false);
location.get_current_location.begin((obj, res) => {
- var w = (Hamlocator.Window) this.active_window;
GClue.Location pos = location.get_current_location.end(res);
if (pos == null) {
- w.SetLabel("unable to get location");
+ win.SetLabel("unable to get location");
} else {
- w.SetLabel(@"got location: lat:$(pos.latitude) lon:$(pos.longitude)");
+ win.SetLabel(@"got location: lat:$(pos.latitude) lon:$(pos.longitude)");
}
+ win.SetRefreshButtonEnabled(true);
});
}
diff --git a/src/window.ui b/src/window.ui
index 1057ca1..3429e20 100644
--- a/src/window.ui
+++ b/src/window.ui
@@ -6,6 +6,11 @@
300