gtk-demo: Update listbox example with longer list

Desktop / GNOME / GTK - Benjamin Otte [redhat.com] - 24 August 2015 14:28 UTC

Add all 388 tweets of the @GTKtoolkit account. This shows the performance behavior of the listbox (not good with that many rows) and allows us to quickly notice when things get worse (or better).

And just so I have a place where I can dump how I generated this file:

First, I got Timm Bäder to download me the json for the twitter feed into a file gtk.json, then I ran the jq tool on it like this:

jq ".[] | if .retweeted_status then .retweeted_status.user.name + \"|\" + .retweeted_status.user.screen_name else .user.name + \"|\" + .user.screen_name end + \"|\" + .text" gtk.json | cat -n | sed "s/\\s*\([0-9]*\)\t\"\(.*\)\"/\\1|\\2/" > messages.start

jq ".[] | .created_at" gtk.json | sed "s/\"\(.*\)\"/\1/" | while read in; do date +%s -d "$in"; done > dates

jq ".[] | \"0|\" + if .retweeted_status then .user.screen_name else \"\" end + \"|\" + (.favorite_count | tostring) + \"|\" + (.retweet_count | tostring)" gtk.json | sed "s/\"\(.*\)\"/\\1/" > messages.end

paste -d\| messages.start dates messages.end > messages.txt

This whole machinery of going through 3 intermediate files was only necessary to onvert the dates from ISO format to unix timestamps, otherwise this could have been a single line.

df5ee78 gtk-demo: Update listbox example with longer list
demos/gtk-demo/messages.txt | 396 ++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 388 insertions(+), 8 deletions(-)

Upstream: git.gnome.org


  • Share