Add the house system configuration widgets to the Edit tab
It is already filled with data, but it is not functional yet!
This commit is contained in:
parent
1ae2db0232
commit
09d1fe352a
@ -29,6 +29,7 @@ struct _AgWindowPrivate {
|
||||
GtkWidget *minute;
|
||||
GtkWidget *second;
|
||||
GtkWidget *timezone;
|
||||
GtkWidget *house_system;
|
||||
|
||||
GtkWidget *tab_chart;
|
||||
GtkWidget *tab_edit;
|
||||
@ -43,6 +44,7 @@ struct _AgWindowPrivate {
|
||||
gchar *uri;
|
||||
gboolean aspect_table_populated;
|
||||
GtkTextBuffer *note_buffer;
|
||||
GtkListStore *house_system_model;
|
||||
};
|
||||
|
||||
G_DEFINE_QUARK(ag_window_error_quark, ag_window_error);
|
||||
@ -871,11 +873,28 @@ ag_window_display_changed(GSettings *settings, gchar *key, AgWindow *window)
|
||||
ag_window_redraw_aspect_table(window);
|
||||
}
|
||||
|
||||
static void
|
||||
ag_window_add_house_system(GsweHouseSystemInfo *house_system_info,
|
||||
AgWindowPrivate *priv)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
|
||||
gtk_list_store_append(priv->house_system_model, &iter);
|
||||
gtk_list_store_set(
|
||||
priv->house_system_model, &iter,
|
||||
0, gswe_house_system_info_get_house_system(house_system_info),
|
||||
1, gswe_house_system_info_get_name(house_system_info),
|
||||
-1
|
||||
);
|
||||
}
|
||||
|
||||
static void
|
||||
ag_window_init(AgWindow *window)
|
||||
{
|
||||
GtkAccelGroup *accel_group;
|
||||
GSettings *main_settings;
|
||||
GList *house_system_list;
|
||||
GtkCellRenderer *house_system_renderer;
|
||||
AgWindowPrivate *priv = ag_window_get_instance_private(window);
|
||||
|
||||
gtk_widget_init_template(GTK_WIDGET(window));
|
||||
@ -896,6 +915,23 @@ ag_window_init(AgWindow *window)
|
||||
window
|
||||
);
|
||||
|
||||
house_system_list = gswe_all_house_systems();
|
||||
g_list_foreach(house_system_list, (GFunc)ag_window_add_house_system, priv);
|
||||
g_list_free(house_system_list);
|
||||
|
||||
house_system_renderer = gtk_cell_renderer_text_new();
|
||||
gtk_cell_layout_pack_start(
|
||||
GTK_CELL_LAYOUT(priv->house_system),
|
||||
house_system_renderer,
|
||||
TRUE
|
||||
);
|
||||
gtk_cell_layout_set_attributes(
|
||||
GTK_CELL_LAYOUT(priv->house_system),
|
||||
house_system_renderer,
|
||||
"text", 1,
|
||||
NULL
|
||||
);
|
||||
|
||||
gtk_stack_set_visible_child_name(GTK_STACK(priv->stack), "edit");
|
||||
priv->current_tab = priv->tab_edit;
|
||||
g_object_set(
|
||||
@ -996,6 +1032,16 @@ ag_window_class_init(AgWindowClass *klass)
|
||||
AgWindow,
|
||||
longitude
|
||||
);
|
||||
gtk_widget_class_bind_template_child_private(
|
||||
widget_class,
|
||||
AgWindow,
|
||||
house_system_model
|
||||
);
|
||||
gtk_widget_class_bind_template_child_private(
|
||||
widget_class,
|
||||
AgWindow,
|
||||
house_system
|
||||
);
|
||||
gtk_widget_class_bind_template_child_private(
|
||||
widget_class,
|
||||
AgWindow,
|
||||
|
@ -104,6 +104,14 @@
|
||||
<property name="step_increment">1</property>
|
||||
<property name="page_increment">10</property>
|
||||
</object>
|
||||
<object class="GtkListStore" id="house_system_model">
|
||||
<columns>
|
||||
<!-- column-name house-system-id -->
|
||||
<column type="GsweHouseSystem"/>
|
||||
<!-- column-name house-system-name -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkTextBuffer" id="note_buffer">
|
||||
</object>
|
||||
<template class="AgWindow" parent="GtkApplicationWindow">
|
||||
@ -510,8 +518,8 @@
|
||||
<property name="label" translatable="yes" context="Chart edit, Timezone label">Timezone</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">4</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="left_attach">7</property>
|
||||
<property name="top_attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -521,6 +529,29 @@
|
||||
<property name="adjustment">timezone_adjust</property>
|
||||
<property name="digits">1</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">7</property>
|
||||
<property name="top_attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="house_system_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes" context="Chart edit, House system label">House system</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">4</property>
|
||||
<property name="top_attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="house_system">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="model">house_system_model</property>
|
||||
<property name="id_column">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">5</property>
|
||||
<property name="top_attach">5</property>
|
||||
|
Loading…
Reference in New Issue
Block a user