Add another glass with the remaining water

This commit is contained in:
Gergely Polonkai 2018-07-27 18:53:31 +02:00
parent 1503eea2d2
commit 8ddaa8c5a2
2 changed files with 34 additions and 7 deletions

View File

@ -6,9 +6,33 @@
<property name="can_focus">False</property>
<property name="default_width">600</property>
<property name="default_height">300</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="homogeneous">True</property>
<child>
<object class="GwrWaterLevel" id="remaining">
<property name="visible">True</property>
<property name="level">1.0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GwrWaterLevel" id="level">
<property name="visible">True</property>
<property name="level">0.0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<child type="titlebar">

View File

@ -27,6 +27,7 @@ struct _GwrWindow
/* Template widgets */
GtkHeaderBar *header_bar;
GwrWaterLevel *level;
GwrWaterLevel *remaining;
};
G_DEFINE_TYPE (GwrWindow, gwr_window, GTK_TYPE_APPLICATION_WINDOW)
@ -47,6 +48,7 @@ gwr_window_class_init (GwrWindowClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/eu/polonkai/gergely/GnomeWaterReminder/gwr-window.ui");
gtk_widget_class_bind_template_child (widget_class, GwrWindow, header_bar);
gtk_widget_class_bind_template_child (widget_class, GwrWindow, level);
gtk_widget_class_bind_template_child (widget_class, GwrWindow, remaining);
}
static void
@ -66,5 +68,6 @@ static void
{
GwrWindow *self = GWR_WINDOW(user_data);
gwr_water_level_set_level (self->remaining, gwr_water_level_get_level (self->remaining) - 0.1);
gwr_water_level_set_level (self->level, gwr_water_level_get_level (self->level) + 0.1);
}