Commit 42b029b1 authored by Georges Basile Stavracas Neto's avatar Georges Basile Stavracas Neto
Browse files

view: Trivial code shuffling

Move shumate_view_go_to_with_duration() to up in the file.
parent cbbd9b3c
......@@ -466,6 +466,40 @@ on_motion_controller_motion (ShumateView *self,
priv->current_y = y;
}
static void
shumate_view_go_to_with_duration (ShumateView *view,
double latitude,
double longitude,
guint duration) /* In ms */
{
ShumateViewPrivate *priv = shumate_view_get_instance_private (view);
GoToContext *ctx;
g_return_if_fail (SHUMATE_IS_VIEW (view));
if (duration == 0)
{
shumate_view_center_on (view, latitude, longitude);
return;
}
shumate_view_stop_go_to (view);
ctx = g_slice_new (GoToContext);
ctx->start_us = g_get_monotonic_time ();
ctx->duration_us = ms_to_us (duration);
ctx->from_latitude = shumate_location_get_latitude (SHUMATE_LOCATION (priv->viewport));
ctx->from_longitude = shumate_location_get_longitude (SHUMATE_LOCATION (priv->viewport));
ctx->to_latitude = latitude;
ctx->to_longitude = longitude;
ctx->view = view;
/* We keep a reference for stop */
priv->goto_context = ctx;
ctx->tick_id = gtk_widget_add_tick_callback (GTK_WIDGET (view), go_to_tick_cb, ctx, NULL);
}
static void
shumate_view_get_property (GObject *object,
guint prop_id,
......@@ -918,41 +952,6 @@ shumate_view_go_to (ShumateView *view,
shumate_view_go_to_with_duration (view, latitude, longitude, duration);
}
static void
shumate_view_go_to_with_duration (ShumateView *view,
double latitude,
double longitude,
guint duration) /* In ms */
{
ShumateViewPrivate *priv = shumate_view_get_instance_private (view);
GoToContext *ctx;
g_return_if_fail (SHUMATE_IS_VIEW (view));
if (duration == 0)
{
shumate_view_center_on (view, latitude, longitude);
return;
}
shumate_view_stop_go_to (view);
ctx = g_slice_new (GoToContext);
ctx->start_us = g_get_monotonic_time ();
ctx->duration_us = ms_to_us (duration);
ctx->from_latitude = shumate_location_get_latitude (SHUMATE_LOCATION (priv->viewport));
ctx->from_longitude = shumate_location_get_longitude (SHUMATE_LOCATION (priv->viewport));
ctx->to_latitude = latitude;
ctx->to_longitude = longitude;
ctx->view = view;
/* We keep a reference for stop */
priv->goto_context = ctx;
ctx->tick_id = gtk_widget_add_tick_callback (GTK_WIDGET (view), go_to_tick_cb, ctx, NULL);
}
/**
* shumate_view_get_go_to_duration:
* @self: a #ShumateView
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment