From 3d61e18c6b19607751a0ecb00c7f0d21fc07c898 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Fri, 22 Aug 2014 15:45:09 +0200 Subject: [PATCH 01/11] 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 02/11] =?UTF-8?q?Force=20update=20of=20the=20focused=20wid?= =?UTF-8?q?get=20on=20the=20Edit=20tab=20if=20it=E2=80=99s=20a=20GtkSpinBu?= =?UTF-8?q?tton?= 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; From 3f143870187cd534d98a0b89bec71850efdb4c1a Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Tue, 26 Aug 2014 13:19:17 +0200 Subject: [PATCH 03/11] Unify AgChart API, so ag_chart_get_*() that return strings are const --- src/ag-chart.c | 28 ++++++++++++---------------- src/ag-chart.h | 6 +++--- src/ag-window.c | 6 ------ 3 files changed, 15 insertions(+), 25 deletions(-) diff --git a/src/ag-chart.c b/src/ag-chart.c index f9279e4..8a4273c 100644 --- a/src/ag-chart.c +++ b/src/ag-chart.c @@ -403,12 +403,12 @@ ag_chart_set_name(AgChart *chart, const gchar *name) g_object_notify_by_pspec(G_OBJECT(chart), properties[PROP_NAME]); } -gchar * +const gchar * ag_chart_get_name(AgChart *chart) { AgChartPrivate *priv = ag_chart_get_instance_private(chart); - return g_strdup(priv->name); + return priv->name; } void @@ -425,12 +425,12 @@ ag_chart_set_country(AgChart *chart, const gchar *country) g_object_notify_by_pspec(G_OBJECT(chart), properties[PROP_COUNTRY]); } -gchar * +const gchar * ag_chart_get_country(AgChart *chart) { AgChartPrivate *priv = ag_chart_get_instance_private(chart); - return g_strdup(priv->country); + return priv->country; } void @@ -447,12 +447,12 @@ ag_chart_set_city(AgChart *chart, const gchar *city) g_object_notify_by_pspec(G_OBJECT(chart), properties[PROP_CITY]); } -gchar * +const gchar * ag_chart_get_city(AgChart *chart) { AgChartPrivate *priv = ag_chart_get_instance_private(chart); - return g_strdup(priv->city); + return priv->city; } /** @@ -1353,6 +1353,7 @@ create_save_doc(AgChart *chart) GsweTimestamp *timestamp; GEnumClass *house_system_class; GEnumValue *enum_value; + AgChartPrivate *priv = ag_chart_get_instance_private(chart); doc = xmlNewDoc(BAD_CAST "1.0"); root_node = xmlNewNode(NULL, BAD_CAST "chartinfo"); @@ -1361,20 +1362,14 @@ create_save_doc(AgChart *chart) // Begin node data_node = xmlNewChild(root_node, NULL, BAD_CAST "data", NULL); - value = ag_chart_get_name(chart); - xmlNewChild(data_node, NULL, BAD_CAST "name", BAD_CAST value); - g_free(value); + xmlNewChild(data_node, NULL, BAD_CAST "name", BAD_CAST priv->name); // Begin node place_node = xmlNewChild(data_node, NULL, BAD_CAST "place", NULL); - value = ag_chart_get_country(chart); - xmlNewChild(place_node, NULL, BAD_CAST "country", BAD_CAST value); - g_free(value); + xmlNewChild(place_node, NULL, BAD_CAST "country", BAD_CAST priv->country); - value = ag_chart_get_city(chart); - xmlNewChild(place_node, NULL, BAD_CAST "city", BAD_CAST value); - g_free(value); + xmlNewChild(place_node, NULL, BAD_CAST "city", BAD_CAST priv->city); coordinates = gswe_moment_get_coordinates(GSWE_MOMENT(chart)); @@ -1895,7 +1890,8 @@ ag_chart_set_note(AgChart *chart, const gchar *note) g_object_notify_by_pspec(G_OBJECT(chart), properties[PROP_NOTE]); } -const gchar *ag_chart_get_note(AgChart *chart) +const gchar * +ag_chart_get_note(AgChart *chart) { AgChartPrivate *priv = ag_chart_get_instance_private(chart); diff --git a/src/ag-chart.h b/src/ag-chart.h index f5296c7..08cc3dc 100644 --- a/src/ag-chart.h +++ b/src/ag-chart.h @@ -70,17 +70,17 @@ void ag_chart_export_svg_to_file(AgChart *chart, void ag_chart_set_name(AgChart *chart, const gchar *name); -gchar *ag_chart_get_name(AgChart *chart); +const gchar *ag_chart_get_name(AgChart *chart); void ag_chart_set_country(AgChart *chart, const gchar *country); -gchar *ag_chart_get_country(AgChart *chart); +const gchar *ag_chart_get_country(AgChart *chart); void ag_chart_set_city(AgChart *chart, const gchar *city); -gchar *ag_chart_get_city(AgChart *chart); +const gchar *ag_chart_get_city(AgChart *chart); gchar *ag_chart_create_svg(AgChart *chart, gsize *length, diff --git a/src/ag-window.c b/src/ag-window.c index 31bf686..2492e94 100644 --- a/src/ag-window.c +++ b/src/ag-window.c @@ -720,8 +720,6 @@ ag_window_export_svg(AgWindow *window, GError **err) name = ag_chart_get_name(priv->chart); if ((name == NULL) || (*name == 0)) { - g_free(name); - ag_app_message_dialog( GTK_WIDGET(window), GTK_MESSAGE_ERROR, @@ -737,7 +735,6 @@ ag_window_export_svg(AgWindow *window, GError **err) } file_name = g_strdup_printf("%s.svg", name); - g_free(name); fs = gtk_file_chooser_dialog_new(_("Export Chart as SVG"), GTK_WINDOW(window), @@ -813,8 +810,6 @@ ag_window_export(AgWindow *window, GError **err) name = ag_chart_get_name(priv->chart); if ((name == NULL) || (*name == 0)) { - g_free(name); - ag_app_message_dialog( GTK_WIDGET(window), GTK_MESSAGE_ERROR, @@ -830,7 +825,6 @@ ag_window_export(AgWindow *window, GError **err) } file_name = g_strdup_printf("%s.agc", name); - g_free(name); fs = gtk_file_chooser_dialog_new(_("Export Chart"), GTK_WINDOW(window), From fe41945cb5bfea6c08263e85d4539349a559a402 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Tue, 26 Aug 2014 13:19:44 +0200 Subject: [PATCH 04/11] Set header subtitle to the chart name upon updating Fixes #61 --- src/ag-window.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ag-window.c b/src/ag-window.c index 2492e94..8aca174 100644 --- a/src/ag-window.c +++ b/src/ag-window.c @@ -526,6 +526,11 @@ ag_window_update_from_chart(AgWindow *window) ); } + gtk_header_bar_set_subtitle( + GTK_HEADER_BAR(priv->header_bar), + ag_chart_get_name(priv->chart) + ); + g_free(coordinates); ag_window_redraw_chart(window); From 1bdf0ee31b742837f138f4b55ab3e7641d55d2f6 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Tue, 26 Aug 2014 18:51:01 +0200 Subject: [PATCH 05/11] Add a "retrograde" attribute to tags in the generated XML --- src/ag-chart.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/ag-chart.c b/src/ag-chart.c index 8a4273c..b88c74a 100644 --- a/src/ag-chart.c +++ b/src/ag-chart.c @@ -1682,6 +1682,16 @@ ag_chart_create_svg(AgChart *chart, gsize *length, GError **err) xmlNewProp(node, BAD_CAST "degree", BAD_CAST value); g_free(value); + xmlNewProp( + node, + BAD_CAST "retrograde", + BAD_CAST ( + gswe_planet_data_get_retrograde(planet_data) + ? "True" + : "False" + ) + ); + value = g_strdup_printf("%d", dist); xmlNewProp(node, BAD_CAST "dist", BAD_CAST value); g_free(value); From 12e3514ce24320b1d9fb1470a7a2414634f9b7ce Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Tue, 26 Aug 2014 19:16:36 +0200 Subject: [PATCH 06/11] Update chart-default.xsl to show retrograde mark --- src/resources/ui/chart-default.xsl | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/resources/ui/chart-default.xsl b/src/resources/ui/chart-default.xsl index a01f465..c6954b6 100644 --- a/src/resources/ui/chart-default.xsl +++ b/src/resources/ui/chart-default.xsl @@ -569,6 +569,14 @@ + + + + + R + + + From 931d184be52fef2f42c6216867aeb28096cfe40d Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Tue, 26 Aug 2014 22:14:32 +0200 Subject: [PATCH 07/11] Fix accel for chart edit For some reason it was the same as the gear menu --- src/ag-app.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ag-app.c b/src/ag-app.c index a50ad0d..916b6c3 100644 --- a/src/ag-app.c +++ b/src/ag-app.c @@ -308,7 +308,7 @@ const gchar *action_accels[] = { "app.help", "F1", NULL, "win.change-tab::chart", "F5", NULL, "win.change-tab::aspects", "F9", NULL, - "win.change-tab::edit", "F10", NULL, + "win.change-tab::edit", "F4", NULL, NULL }; From 2c225e4830d4f8e1cb0fd3249144ff06ea386e44 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Tue, 26 Aug 2014 22:15:34 +0200 Subject: [PATCH 08/11] Updated libgd dependency --- libgd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libgd b/libgd index 62f9b8b..4d0e605 160000 --- a/libgd +++ b/libgd @@ -1 +1 @@ -Subproject commit 62f9b8b92599b38d986bd26d5780edd400d318c9 +Subproject commit 4d0e605e81517beb550c212fd14d5060eefe321c From bc6d5b65eeb063f71f3b6707c6147286ea66aecf Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Tue, 26 Aug 2014 22:14:32 +0200 Subject: [PATCH 09/11] Fix accel for chart edit For some reason it was the same as the gear menu --- src/ag-app.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ag-app.c b/src/ag-app.c index a50ad0d..916b6c3 100644 --- a/src/ag-app.c +++ b/src/ag-app.c @@ -308,7 +308,7 @@ const gchar *action_accels[] = { "app.help", "F1", NULL, "win.change-tab::chart", "F5", NULL, "win.change-tab::aspects", "F9", NULL, - "win.change-tab::edit", "F10", NULL, + "win.change-tab::edit", "F4", NULL, NULL }; From 7df99eb1da3ec01ceb4b43144ee973365e0ab822 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Tue, 26 Aug 2014 22:15:34 +0200 Subject: [PATCH 10/11] Updated libgd dependency --- libgd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libgd b/libgd index 62f9b8b..4d0e605 160000 --- a/libgd +++ b/libgd @@ -1 +1 @@ -Subproject commit 62f9b8b92599b38d986bd26d5780edd400d318c9 +Subproject commit 4d0e605e81517beb550c212fd14d5060eefe321c From 09efcfeeb6370246d881e648eac75452c1035a6a Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Tue, 26 Aug 2014 23:55:29 +0200 Subject: [PATCH 11/11] Fix retrograde mark location --- src/resources/ui/chart-default.xsl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resources/ui/chart-default.xsl b/src/resources/ui/chart-default.xsl index c6954b6..99d0034 100644 --- a/src/resources/ui/chart-default.xsl +++ b/src/resources/ui/chart-default.xsl @@ -572,7 +572,7 @@ - + R