Some porting work on preview-widget.c