diff --git a/src/ag-window.c b/src/ag-window.c index f184f44..962b34d 100644 --- a/src/ag-window.c +++ b/src/ag-window.c @@ -556,7 +556,7 @@ ag_window_set_house_system(GtkTreeModel *model, void ag_window_update_from_chart(AgWindow *window) { - gchar *country, + const gchar *country, *city; AgWindowPrivate *priv = ag_window_get_instance_private(window); GsweTimestamp *timestamp = gswe_moment_get_timestamp( @@ -566,6 +566,30 @@ ag_window_update_from_chart(AgWindow *window) GSWE_MOMENT(priv->chart) ); + if ((country = ag_chart_get_country(priv->chart)) != NULL) { + gtk_entry_set_text( + GTK_ENTRY(priv->country), + ag_chart_get_country(priv->chart) + ); + } else { + gtk_entry_set_text( + GTK_ENTRY(priv->country), + "" + ); + } + + if ((city = ag_chart_get_city(priv->chart)) != NULL) { + gtk_entry_set_text( + GTK_ENTRY(priv->city), + ag_chart_get_city(priv->chart) + ); + } else { + gtk_entry_set_text( + GTK_ENTRY(priv->city), + "" + ); + } + gtk_spin_button_set_value( GTK_SPIN_BUTTON(priv->year), gswe_timestamp_get_gregorian_year(timestamp, NULL) @@ -619,30 +643,6 @@ ag_window_update_from_chart(AgWindow *window) gtk_entry_set_text(GTK_ENTRY(priv->name), ag_chart_get_name(priv->chart)); - if ((country = ag_chart_get_country(priv->chart)) != NULL) { - gtk_entry_set_text( - GTK_ENTRY(priv->country), - ag_chart_get_country(priv->chart) - ); - } else { - gtk_entry_set_text( - GTK_ENTRY(priv->country), - "" - ); - } - - if ((city = ag_chart_get_city(priv->chart)) != NULL) { - gtk_entry_set_text( - GTK_ENTRY(priv->city), - ag_chart_get_city(priv->chart) - ); - } else { - gtk_entry_set_text( - GTK_ENTRY(priv->city), - "" - ); - } - if (ag_chart_get_note(priv->chart)) { // TODO: maybe setting length to -1 here is not that good of an idea… gtk_text_buffer_set_text(