refactor share button creation

This is the first step to create a more general controlbox module
By extracting the creation of the share buttons and its control box
into methods.
These methods will be part of that module, after being generalized
 a bit.