Add another glass with the remaining water
This commit is contained in:
parent
1503eea2d2
commit
8ddaa8c5a2
@ -7,8 +7,32 @@
|
||||
<property name="default_width">600</property>
|
||||
<property name="default_height">300</property>
|
||||
<child>
|
||||
<object class="GwrWaterLevel" id="level">
|
||||
<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">
|
||||
|
@ -22,11 +22,12 @@
|
||||
|
||||
struct _GwrWindow
|
||||
{
|
||||
GtkApplicationWindow parent_instance;
|
||||
GtkApplicationWindow parent_instance;
|
||||
|
||||
/* Template widgets */
|
||||
GtkHeaderBar *header_bar;
|
||||
GwrWaterLevel *level;
|
||||
/* Template widgets */
|
||||
GtkHeaderBar *header_bar;
|
||||
GwrWaterLevel *level;
|
||||
GwrWaterLevel *remaining;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GwrWindow, gwr_window, GTK_TYPE_APPLICATION_WINDOW)
|
||||
@ -47,14 +48,15 @@ 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
|
||||
gwr_window_init (GwrWindow *self)
|
||||
{
|
||||
g_type_ensure(GWR_TYPE_WATER_LEVEL);
|
||||
g_type_ensure(GWR_TYPE_WATER_LEVEL);
|
||||
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
|
||||
g_action_map_add_action_entries(G_ACTION_MAP(self), win_entries, G_N_ELEMENTS(win_entries), self);
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user