From 3d61e18c6b19607751a0ecb00c7f0d21fc07c898 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Fri, 22 Aug 2014 15:45:09 +0200 Subject: [PATCH 1/2] Redraw chart when changing to the chart tab Fixes #59 --- src/ag-window.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ag-window.c b/src/ag-window.c index 31bf686..26c272f 100644 --- a/src/ag-window.c +++ b/src/ag-window.c @@ -390,6 +390,12 @@ ag_window_redraw_aspect_table(AgWindow *window) 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 ag_window_redraw_chart(AgWindow *window) { @@ -1044,6 +1050,7 @@ ag_window_tab_changed_cb(GtkStack *stack, GParamSpec *pspec, AgWindow *window) // not the real active one! if (priv->current_tab == priv->tab_edit) { ag_window_recalculate_chart(window, FALSE); + ag_window_redraw_chart(window); } } From 2d0b093faf986ae6c3f34f678ef0b07d6eb14322 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Fri, 22 Aug 2014 18:21:48 +0200 Subject: [PATCH 2/2] =?UTF-8?q?Force=20update=20of=20the=20focused=20widge?= =?UTF-8?q?t=20on=20the=20Edit=20tab=20if=20it=E2=80=99s=20a=20GtkSpinButt?= =?UTF-8?q?on?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is required because when the user changes tabs with an accel after manually changing a spin button’s value, but without pressing Enter ("activate") or leaving the spin button, the spin button will reflect the old value instead. --- src/ag-window.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/ag-window.c b/src/ag-window.c index 26c272f..3e5fe5d 100644 --- a/src/ag-window.c +++ b/src/ag-window.c @@ -556,6 +556,7 @@ ag_window_recalculate_chart(AgWindow *window, gboolean set_everything) GtkTextIter start_iter, end_iter; GsweTimestamp *timestamp; + GtkWidget *current; gint db_id = (priv->saved_data) ? priv->saved_data->db_id : -1; south = gtk_toggle_button_get_active( @@ -566,6 +567,15 @@ ag_window_recalculate_chart(AgWindow *window, gboolean set_everything) 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->db_id = db_id;