Merge pull request #60 from gergelypolonkai/bug-59

Chart wasn’t updating after manually changing a spin button’s value
This commit is contained in:
Gergely Polonkai 2014-08-22 18:24:34 +02:00
commit bc1b08e9c4

View File

@ -390,6 +390,12 @@ ag_window_redraw_aspect_table(AgWindow *window)
gtk_widget_show_all(priv->aspect_table); gtk_widget_show_all(priv->aspect_table);
} }
/**
* ag_window_redraw_chart:
* @window: the #AgWindow to operate on
*
* Redraw the chart on the chart view.
*/
void void
ag_window_redraw_chart(AgWindow *window) ag_window_redraw_chart(AgWindow *window)
{ {
@ -550,6 +556,7 @@ ag_window_recalculate_chart(AgWindow *window, gboolean set_everything)
GtkTextIter start_iter, GtkTextIter start_iter,
end_iter; end_iter;
GsweTimestamp *timestamp; GsweTimestamp *timestamp;
GtkWidget *current;
gint db_id = (priv->saved_data) ? priv->saved_data->db_id : -1; gint db_id = (priv->saved_data) ? priv->saved_data->db_id : -1;
south = gtk_toggle_button_get_active( south = gtk_toggle_button_get_active(
@ -560,6 +567,15 @@ ag_window_recalculate_chart(AgWindow *window, gboolean set_everything)
GTK_TOGGLE_BUTTON(priv->west_long) GTK_TOGGLE_BUTTON(priv->west_long)
); );
// If the current widget is a spin button, force it to update. This is
// required when the user enters a new value in a spin button, but doesn't
// leave the spin entry before switching to the chart tab with an accel.
current = gtk_window_get_focus(GTK_WINDOW(window));
if (GTK_IS_SPIN_BUTTON(current)) {
gtk_spin_button_update(GTK_SPIN_BUTTON(current));
}
edit_data = g_new0(AgDbSave, 1); edit_data = g_new0(AgDbSave, 1);
edit_data->db_id = db_id; edit_data->db_id = db_id;
@ -1044,6 +1060,7 @@ ag_window_tab_changed_cb(GtkStack *stack, GParamSpec *pspec, AgWindow *window)
// not the real active one! // not the real active one!
if (priv->current_tab == priv->tab_edit) { if (priv->current_tab == priv->tab_edit) {
ag_window_recalculate_chart(window, FALSE); ag_window_recalculate_chart(window, FALSE);
ag_window_redraw_chart(window);
} }
} }