Log time between network drops -- from online to offline.

Rewrite most of metrics_daemon. Convert to low-level D-Bus API -- this
simplifies the code a little and also allows us to catch the power
state signal. I still suspect we may be abusing D-Bus a little but it
seems to work.

snanda@ -- please review the power state code specifically.

BUG=none
TEST=tested on target platform and arm-generic builds

Review URL: http://codereview.chromium.org/1799001
diff --git a/metrics/Makefile b/metrics/Makefile
index 0b04736..54b9f53 100644
--- a/metrics/Makefile
+++ b/metrics/Makefile
@@ -8,7 +8,7 @@
 CCONFIG = $(shell $(PKG_CONFIG) --cflags dbus-1 glib-2.0 dbus-glib-1)
 LDCONFIG = $(shell $(PKG_CONFIG) --libs dbus-1 glib-2.0 gthread-2.0 dbus-glib-1)
 
-CFLAGS = -Wall -Werror -I/usr/include -fpic -O2 $(CCONFIG)
+CFLAGS = -Wall -Werror -I/usr/include -fPIC -O2 $(CCONFIG)
 CXXFLAGS = $(CFLAGS) -fno-exceptions
 
 CLIENT = metrics_client
@@ -22,11 +22,9 @@
 LIB_OBJS = \
 	metrics_library.o
 DAEMON_OBJS = \
-	marshal_void__string_boxed.o \
 	metrics_daemon.o \
 	metrics_daemon_main.o
 TESTDAEMON_OBJS = \
-	marshal_void__string_boxed.o \
 	metrics_daemon.o \
 	metrics_daemon_unittest.o
 
@@ -56,26 +54,16 @@
 %.o: %.c
 	$(CC) $(CFLAGS) -c $< -o $@
 
-%.c: %.list
-	glib-genmarshal --body --prefix=marshal $< > $@
-
-%.h: %.list
-	glib-genmarshal --header --prefix=marshal $< > $@
-
 # dependencies in addition to those defined by the rules
 
 metrics_daemon.o: \
-	marshal_void__string_boxed.h \
 	metrics_daemon.h \
-	network_states.h
+	network_states.h \
+	power_states.h
 metrics_daemon_unittest.o: \
-	marshal_void__string_boxed.h \
 	metrics_daemon.h \
-	network_states.h
-marshal_void__string_boxed.o: \
-	marshal_void__string_boxed.h
-
-.PRECIOUS: marshal_void__string_boxed.c  # keep around for debugging
+	network_states.h \
+	power_states.h
 
 install:
 	install $(CLIENT) $(DESTDIR)/usr/bin
@@ -87,5 +75,4 @@
 	install omaha_tracker.sh $(DESTDIR)/usr/sbin
 
 clean:
-	rm -f $(CLIENT) $(DAEMON) $(LIB) $(SHAREDLIB) $(TESTDAEMON)
-	rm -f *.o marshal_void__string_boxed.[ch]
+	rm -f $(CLIENT) $(DAEMON) $(LIB) $(SHAREDLIB) $(TESTDAEMON) *.o