Created ag_window_update_from_chart() to update form values from the window's chart

This commit is contained in:
Gergely Polonkai 2013-09-17 22:23:10 +02:00
parent a9977ac54e
commit f8c5415789
2 changed files with 25 additions and 0 deletions

View File

@ -72,6 +72,30 @@ ag_window_redraw_chart(AgWindow *window)
{
}
void
ag_window_update_from_chart(AgWindow *window)
{
GsweTimestamp *timestamp;
GsweCoordinates *coordinates;
timestamp = gswe_moment_get_timestamp(GSWE_MOMENT(window->priv->chart));
coordinates = gswe_moment_get_coordinates(GSWE_MOMENT(window->priv->chart));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->priv->year), gswe_timestamp_get_gregorian_year(timestamp, NULL));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->priv->month), gswe_timestamp_get_gregorian_month(timestamp, NULL));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->priv->day), gswe_timestamp_get_gregorian_day(timestamp, NULL));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->priv->hour), gswe_timestamp_get_gregorian_hour(timestamp, NULL));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->priv->minute), gswe_timestamp_get_gregorian_minute(timestamp, NULL));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->priv->second), gswe_timestamp_get_gregorian_second(timestamp, NULL));
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->priv->longitude), coordinates->longitude);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(window->priv->latitude), coordinates->latitude);
gtk_entry_set_text(GTK_ENTRY(window->priv->name), ag_chart_get_name(window->priv->chart));
g_free(coordinates);
ag_window_redraw_chart(window);
}
static void
chart_changed(AgChart *chart, AgWindow *window)
{

View File

@ -31,6 +31,7 @@ GType ag_window_get_type(void) G_GNUC_CONST;
GtkWidget *ag_window_new(AgApp *app);
void ag_window_set_chart(AgWindow *window, AgChart *chart);
AgChart *ag_window_get_chart(AgWindow *window);
void ag_window_update_from_chart(AgWindow *window);
G_END_DECLS