From f65cb50f8e9525afe02115361e8d0ff8b294b979 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Thu, 3 Jul 2014 23:24:11 +0200 Subject: [PATCH] Incorporate first icon in the aspect table Sun is now represented by an (oversized) icon in the aspects table. --- src/ag-window.c | 18 +++++- src/ag.gresource.xml | 2 + src/resources/default-icons/planet-sun.svg | 69 ++++++++++++++++++++++ 3 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 src/resources/default-icons/planet-sun.svg diff --git a/src/ag-window.c b/src/ag-window.c index 0fa1491..9f31cc4 100644 --- a/src/ag-window.c +++ b/src/ag-window.c @@ -256,6 +256,20 @@ ag_window_export_svg_action(GSimpleAction *action, GVariant *parameter, gpointer // TODO: Check err! } +GtkWidget * +ag_window_create_planet_widget(GswePlanetInfo *planet_info) +{ + GtkWidget *widget; + + if (gswe_planet_info_get_planet(planet_info) == GSWE_PLANET_SUN) { + widget = gtk_image_new_from_resource("/eu/polonkai/gergely/Astrognome/default-icons/planet-sun.svg"); + } else { + widget = gtk_label_new(gswe_planet_info_get_name(planet_info)); + } + + return widget; +} + void ag_window_redraw_chart(AgWindow *window) { @@ -298,11 +312,11 @@ ag_window_redraw_chart(AgWindow *window) planet_data = gswe_moment_get_planet(GSWE_MOMENT(priv->chart), planet_id, NULL); planet_info = gswe_planet_data_get_planet_info(planet_data); - label_hor = gtk_label_new(gswe_planet_info_get_name(planet_info)); + label_hor = ag_window_create_planet_widget(planet_info); gtk_grid_attach(GTK_GRID(priv->aspect_table), label_hor, i + 1, i, 1, 1); if (i > 0) { - label_ver = gtk_label_new(gswe_planet_info_get_name(planet_info)); + label_ver = ag_window_create_planet_widget(planet_info); gtk_grid_attach(GTK_GRID(priv->aspect_table), label_ver, 0, i, 1, 1); } } diff --git a/src/ag.gresource.xml b/src/ag.gresource.xml index 111d846..28f286b 100644 --- a/src/ag.gresource.xml +++ b/src/ag.gresource.xml @@ -4,5 +4,7 @@ ui/astrognome.ui ui/ag-window.ui ui/ag-preferences.ui + + default-icons/planet-sun.svg diff --git a/src/resources/default-icons/planet-sun.svg b/src/resources/default-icons/planet-sun.svg new file mode 100644 index 0000000..df5c8b1 --- /dev/null +++ b/src/resources/default-icons/planet-sun.svg @@ -0,0 +1,69 @@ + + + + + + + + + + image/svg+xml + + + + + + + + +