split out serialize/unserialize code

This splits out the code that relates to serializing/unserializing rig
state and isn't specifically related to loading/saving files. This code
will be shared between the networking and load-save components
rig-pb: make unserialize api take Rig__UI ptr

this changes the rig_pb_unserialize_ui api to take a pointer to a
Rig__UI since the networking interface will be dealing with requests
where the messages have already be decoded into C structures.

Possibly we should encode/decode as verbs in rig-pb.c instead of
serialize/unserialize.
rig-pb: fix compiler warnings

This fixes several compiler warnings about assigning const char *
pointers to non const variables. The problem is that protoc doesn't
codegen structures with const char * members for string types so we need
to explicitly cast to avoid compiler warnings.
rig-rpc-network: include config.h

This fixes a bug caused by differing ideas of how big RigData is caused
by not including config.h which affects some ifdefed members of RigData.
update copyright headers and config.h includes

This updates all the .c files to make sure they have a copyright header
and to make sure the include config.h
Iterates the way we track slave connections

This moves the Rig__Slave_Service into rig-slave.c so we have a sensible
place to implement the slave rpc service.

This adds a RigSlaveMaster object that tracks per-slave connection
state.

This improves the interfaces in rig-rpc-network.c to support managing
multiple client connections.
rply: Add ply_start for reading from memory

This adds a new ply_start function to rply.c to enable reading from a
memory buffer. Since rply was written to use buffered io this is
implemented as a thin shim that uses fmemopen so that we can get a
FILE *fp to access the memory and leave most of rply.c untouched.
slave: stub out LoadAsset request

This adds a new LoadAsset request to the slave rpc service and provides
a stub implementation in rig-slave.c

rig-slave.c has also been changed a bit to have a toplevel RigSlave type
for maintaining slave specific/private state so we can avoid dumping
things in RigData.
rig-pb: don't reference internal enums

protoc-c seems to sometimes spit out enum value to force the compiler to
use an int type but these are not always output (not currently sure what
affects this). This avoids referencing one such private enum which can
would break the build if protoc-c hadn't output the enum.
rig-pb: really don't reference internal enums

The commit 31e3ccb9e244266f tried to remove references to internal
enums but it missed a second bit of code that was doing it too.
Fix the size of the splits array

The number of splits used had changed but the size of the array had
not. This was causing it to crash on exit when it tries to destroy all
of the splits.
Add some debugging for tracking references

This adds a new configure option called --enable-refcount-debug. When
enabled the rut_object_init, rut_refable_ref and rut_refable_unref
functions are augmented with some code to track the ref counts of all
objects in a hash table. By default the configure option is enabled
for non-release builds. The tracking can still be disabled at run-time
using the environment variable RUT_DISABLE_REFCOUNT_DEBUG.

If the debugging is not disabled then when the application exits it
will issue a g_warning if any objects are still alive. A list of the
alive objects will be saved to /tmp/rut-object-log.txt.

Additionally when building with glibc which provides the ‘backtrace’
function, it can also store a backtrace for every ref and unref. This
is enabled by setting the environment varaible RUT_BACKTRACE_LEVEL to
a non-zero value. When enabled the ref count log will include the
backtrace. Rut will try to convert the addresses from the backtrace to
source line numbers by forking the addr2line utility. If that doesn't
work it will resort to the backtrace_symbols function which gives less
useful information.
Don't call rut_simple_refable_(un)?ref directly

Calling the ref implementation functions directly instead of via
rut_refable_(un)?ref messes up the reference count debugging and it
also seems a bit less robust.
rut-entry: Don't ref the context on free

_rut_entry_free was refing the RutContext. Presumably this is a typo
and it is meant to unref.
Fix some leaking references

This cleans up some resources allocated by main.c and RigCameraView.
This is enough to make it usually remove all of the references on the
CoglOnscreen although it looks something can cause it to still leak
such as adding a new component.
pb-c-rpc: check closures after client_failed callback

client_failed() in rig-protobuf-c-rpc.c would save off a pointer to the
closures associated with a client before calling an associated
error_handler callback and then dereference the saved pointer which
could have been invalidated in the error handler. This changes the code
to only check for closures after calling the error handler.
rig-rpc: don't sync destroyed GSource pollfds

After calling protobuf_c_dispatch_dispatch we always follow up by
calling sync_source to update the pollfd state but we weren't
considering that the dispatching may have destroyed the GSource and so
in that case we shouldn't try and synchronize its state.
asset: associate a RutContext with each asset

To be able to determine the full-path for an asset we need to know the
associated context so we can access the assets_location.
slave: pass RigData not RigSlave to rig_engine_paint

This fixes a bug in rig-slave.c where we were passing a RigSlave pointer
to rig_engine_paint instead of a RigData pointer.
slave: Adds support for sending serialized assets

Since slaves will be remote from the editor they can't just load assets
from disk like the editor so this adds support for streaming assets to
slaves and letting them load from memory instead of from disk.