Fix deprecation warnings

https://bugzilla.gnome.org/show_bug.cgi?id=724985
WIP: Port to C++