X-Git-Url: http://pileus.org/git/?p=grits;a=blobdiff_plain;f=src%2Faweather-view.c;h=0c765fb32f3e48d50c59d1e7a77073a53eb68c43;hp=fe8bafa462f42384e94ca949b29c80cd7c4991d8;hb=aba05890085cec97c631b5b8a25fd04c960ec203;hpb=4dc81f2eda865c9d457b9a8c0db910cc7aedb240 diff --git a/src/aweather-view.c b/src/aweather-view.c index fe8bafa..0c765fb 100644 --- a/src/aweather-view.c +++ b/src/aweather-view.c @@ -33,6 +33,7 @@ enum { SIG_TIME_CHANGED, SIG_SITE_CHANGED, SIG_LOCATION_CHANGED, + SIG_ROTATION_CHANGED, SIG_REFRESH, SIG_OFFLINE, NUM_SIGNALS, @@ -50,6 +51,9 @@ static void aweather_view_init(AWeatherView *self) self->location[0] = 0; self->location[1] = 0; self->location[2] = -300*1000; + self->rotation[0] = 0; + self->rotation[1] = 0; + self->rotation[2] = 0; self->offline = FALSE; } static void aweather_view_dispose(GObject *gobject) @@ -143,6 +147,19 @@ static void aweather_view_class_init(AWeatherViewClass *klass) G_TYPE_DOUBLE, G_TYPE_DOUBLE, G_TYPE_DOUBLE); + signals[SIG_ROTATION_CHANGED] = g_signal_new( + "rotation-changed", + G_TYPE_FROM_CLASS(gobject_class), + G_SIGNAL_RUN_LAST, + 0, + NULL, + NULL, + aweather_cclosure_marshal_VOID__DOUBLE_DOUBLE_DOUBLE, + G_TYPE_NONE, + 3, + G_TYPE_DOUBLE, + G_TYPE_DOUBLE, + G_TYPE_DOUBLE); signals[SIG_REFRESH] = g_signal_new( "refresh", G_TYPE_FROM_CLASS(gobject_class), @@ -174,6 +191,13 @@ static void _aweather_view_emit_location_changed(AWeatherView *view) view->location[1], view->location[2]); } +static void _aweather_view_emit_rotation_changed(AWeatherView *view) +{ + g_signal_emit(view, signals[SIG_ROTATION_CHANGED], 0, + view->rotation[0], + view->rotation[1], + view->rotation[2]); +} static void _aweather_view_emit_time_changed(AWeatherView *view) { g_signal_emit(view, signals[SIG_TIME_CHANGED], 0, @@ -257,6 +281,35 @@ void aweather_view_zoom(AWeatherView *view, gdouble scale) _aweather_view_emit_location_changed(view); } +void aweather_view_set_rotation(AWeatherView *view, gdouble x, gdouble y, gdouble z) +{ + g_assert(AWEATHER_IS_VIEW(view)); + g_debug("AWeatherView: set_rotation"); + view->rotation[0] = x; + view->rotation[1] = y; + view->rotation[2] = z; + _aweather_view_emit_rotation_changed(view); +} + +void aweather_view_get_rotation(AWeatherView *view, gdouble *x, gdouble *y, gdouble *z) +{ + g_assert(AWEATHER_IS_VIEW(view)); + g_debug("AWeatherView: get_rotation"); + *x = view->rotation[0]; + *y = view->rotation[1]; + *z = view->rotation[2]; +} + +void aweather_view_rotate(AWeatherView *view, gdouble x, gdouble y, gdouble z) +{ + g_assert(AWEATHER_IS_VIEW(view)); + g_debug("AWeatherView: rotate - x=%.0f, y=%.0f, z=%.0f", x, y, z); + view->rotation[0] += x; + view->rotation[1] += y; + view->rotation[2] += z; + _aweather_view_emit_rotation_changed(view); +} + void aweather_view_refresh(AWeatherView *view) { g_debug("AWeatherView: refresh");