Make the new house system changer work

This commit is contained in:
Gergely Polonkai 2014-09-29 17:33:17 +02:00
parent 4023bc84c5
commit 4afb24882e
2 changed files with 34 additions and 6 deletions

View File

@ -572,7 +572,7 @@ ag_window_redraw_chart(AgWindow *window)
} }
static gboolean static gboolean
ag_window_set_house_system(GtkTreeModel *model, ag_window_set_model_house_system(GtkTreeModel *model,
GtkTreePath *path, GtkTreePath *path,
GtkTreeIter *iter, GtkTreeIter *iter,
AgWindow *window) AgWindow *window)
@ -683,7 +683,7 @@ ag_window_update_from_chart(AgWindow *window)
gtk_tree_model_foreach( gtk_tree_model_foreach(
GTK_TREE_MODEL(priv->house_system_model), GTK_TREE_MODEL(priv->house_system_model),
(GtkTreeModelForeachFunc)ag_window_set_house_system, (GtkTreeModelForeachFunc)ag_window_set_model_house_system,
window window
); );
@ -711,6 +711,7 @@ ag_window_update_from_chart(AgWindow *window)
static void static void
ag_window_chart_changed(AgChart *chart, AgWindow *window) ag_window_chart_changed(AgChart *chart, AgWindow *window)
{ {
g_debug("Chart changed!");
ag_window_redraw_chart(window); ag_window_redraw_chart(window);
} }
@ -2409,7 +2410,29 @@ ag_window_city_changed_callback(GtkSearchEntry *city, AgWindow *window)
} }
} }
void static void
ag_window_house_system_changed_cb(GtkComboBox *combo_box,
AgWindow *window)
{
GtkTreeIter iter;
GsweHouseSystem house_system;
GET_PRIV(window);
gtk_combo_box_get_active_iter(combo_box, &iter);
gtk_tree_model_get(
GTK_TREE_MODEL(priv->house_system_model), &iter,
0, &house_system,
-1
);
if (priv->chart) {
gswe_moment_set_house_system(GSWE_MOMENT(priv->chart), house_system);
}
g_debug("House system changed: %d", house_system);
}
static void
ag_window_display_theme_changed_cb(GtkComboBox *combo_box, ag_window_display_theme_changed_cb(GtkComboBox *combo_box,
AgWindow *window) AgWindow *window)
{ {
@ -2718,6 +2741,10 @@ ag_window_class_init(AgWindowClass *klass)
widget_class, widget_class,
ag_window_selection_mode_cancel_cb ag_window_selection_mode_cancel_cb
); );
gtk_widget_class_bind_template_callback(
widget_class,
ag_window_house_system_changed_cb
);
} }
static gboolean static gboolean

View File

@ -834,6 +834,7 @@
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="model">house_system_model</property> <property name="model">house_system_model</property>
<property name="id_column">1</property> <property name="id_column">1</property>
<signal name="changed" handler="ag_window_house_system_changed_cb" swapped="no"/>
</object> </object>
<packing> <packing>
<property name="pack_type">start</property> <property name="pack_type">start</property>