Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions src/EventEdition/LocationPanel.vala
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,10 @@ public class Maya.View.EventEdition.LocationPanel : Gtk.Box {
need_relocation = false;
point.latitude = latitude;
point.longitude = longitude;
if (latitude == 0 && longitude == 0)
if (latitude == 0 && longitude == 0) {
need_relocation = true;
}

}
}

Expand Down Expand Up @@ -169,8 +171,10 @@ public class Maya.View.EventEdition.LocationPanel : Gtk.Box {
}

private async void compute_location (string loc) {
if (search_cancellable != null)
if (search_cancellable != null) {
search_cancellable.cancel ();
}

search_cancellable = new GLib.Cancellable ();
var forward = new Geocode.Forward.for_string (loc);
try {
Expand All @@ -180,16 +184,19 @@ public class Maya.View.EventEdition.LocationPanel : Gtk.Box {
point.latitude = place.location.latitude;
point.longitude = place.location.longitude;
Idle.add (() => {
if (search_cancellable.is_cancelled () == false)
if (search_cancellable.is_cancelled () == false) {
champlain_embed.champlain_view.go_to (point.latitude, point.longitude);
}

return false;
});
}

if (loc == location_entry.text)
if (loc == location_entry.text) {
map_selected = true;
}

location_entry.has_focus = true;
location_entry.grab_focus ();
} catch (Error error) {
debug (error.message);
}
Expand Down Expand Up @@ -236,8 +243,10 @@ public class Maya.View.EventEdition.LocationPanel : Gtk.Box {
point.latitude = simple.location.latitude;
point.longitude = simple.location.longitude;
Idle.add (() => {
if (search_cancellable.is_cancelled () == false)
if (search_cancellable.is_cancelled () == false) {
champlain_embed.champlain_view.go_to (point.latitude, point.longitude);
}

return false;
});

Expand Down
Loading