gtk-demo: Make icon counter work from ui file

Gets rid of update always being 1 frame late.
This commit is contained in:
Benjamin Otte 2017-01-07 02:05:26 +01:00
parent cd8e41e491
commit 4fdf880b6e
2 changed files with 11 additions and 3 deletions

View File

@ -70,8 +70,7 @@ do_stats (GtkWidget *widget,
n_frames += stats->frame_counter[i];
}
new_label = g_strdup_printf ("%u icons - %.1f fps",
stats->item_counter[stats->stats_index],
new_label = g_strdup_printf ("icons - %.1f fps",
(double) G_USEC_PER_SEC * n_frames
/ (N_STATS * STATS_UPDATE_TIME));
gtk_label_set_label (GTK_LABEL (info_label), new_label);

View File

@ -10,7 +10,16 @@
<child>
<object class="GtkLabel" id="info_label">
<property name="visible">True</property>
<property name="label">0 icons - 0 fps</property>
<property name="label">icons - 0 fps</property>
</object>
<packing>
<property name="pack_type">end</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="label" bind-source="bowl" bind-property="count">0</property>
</object>
<packing>
<property name="pack_type">end</property>