From 023b1794572cc3ff4c8f283e05f2e6f558cc0c91 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Fri, 18 Jul 2014 00:02:39 +0200 Subject: [PATCH] House system GtkComboBox now indicates the loaded house system --- src/ag-window.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/ag-window.c b/src/ag-window.c index 6b1811a..9db7954 100644 --- a/src/ag-window.c +++ b/src/ag-window.c @@ -635,6 +635,34 @@ ag_window_redraw_chart(AgWindow *window) ag_window_redraw_aspect_table(window); } +static gboolean +ag_window_find_house_system(GtkTreeModel *model, + GtkTreePath *path, + GtkTreeIter *iter, + AgWindow *window) +{ + GsweHouseSystem row_house_system; + AgWindowPrivate *priv = ag_window_get_instance_private(window); + GsweHouseSystem house_system = gswe_moment_get_house_system( + GSWE_MOMENT(priv->chart) + ); + + gtk_tree_model_get( + GTK_TREE_MODEL(priv->house_system_model), + iter, + 0, &row_house_system, + -1 + ); + + if (house_system == row_house_system) { + gtk_combo_box_set_active_iter(GTK_COMBO_BOX(priv->house_system), iter); + + return TRUE; + } + + return FALSE; +} + void ag_window_update_from_chart(AgWindow *window) { @@ -691,6 +719,12 @@ ag_window_update_from_chart(AgWindow *window) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(priv->south_lat), TRUE); } + gtk_tree_model_foreach( + GTK_TREE_MODEL(priv->house_system_model), + (GtkTreeModelForeachFunc)ag_window_find_house_system, + window + ); + gtk_entry_set_text(GTK_ENTRY(priv->name), ag_chart_get_name(priv->chart)); if (ag_chart_get_note(priv->chart)) {