summary refs log tree commit diff
path: root/test
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2010-11-29 00:47:11 +0100
committerMichael Biebl <biebl@debian.org>2010-11-29 00:47:11 +0100
commit9fae01fa351805b2903e535736e06971bc0b925e (patch)
treec19bccf84c9f894e50fae678ba6ee2b2044e2d30 /test
Imported Upstream version 0.8.1 upstream/0.8.1
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am39
-rw-r--r--test/Makefile.in662
-rw-r--r--test/libnm-glib-test.c113
-rw-r--r--test/nm-online.c210
-rw-r--r--test/nm-tool.c721
5 files changed, 1745 insertions, 0 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
new file mode 100644
index 00000000..8e235e43
--- /dev/null
+++ b/test/Makefile.am
@@ -0,0 +1,39 @@
+INCLUDES = -I${top_srcdir}                    \
+           -I${top_srcdir}/libnm-util         \
+           -I${top_srcdir}/libnm-glib         \
+           -I${top_srcdir}/include
+
+AM_CPPFLAGS = \
+	$(DBUS_CFLAGS) \
+	$(GLIB_CFLAGS) \
+	-DBINDIR=\"$(bindir)\" \
+	-DNM_RUN_DIR=\"$(rundir)\" \
+	-DDATADIR=\"$(datadir)\"
+
+bin_PROGRAMS = nm-tool
+
+noinst_PROGRAMS = nm-online libnm-glib-test
+
+nm_tool_SOURCES = nm-tool.c
+nm_tool_LDADD = \
+	$(top_builddir)/libnm-glib/libnm-glib.la \
+	$(top_builddir)/libnm-util/libnm-util.la \
+	$(DBUS_LIBS) \
+	$(GLIB_LIBS)
+
+nm_online_SOURCES = nm-online.c
+nm_online_LDADD = \
+	$(top_builddir)/libnm-util/libnm-util.la \
+	$(DBUS_LIBS) \
+	$(GLIB_LIBS)
+
+libnm_glib_test_SOURCES = libnm-glib-test.c
+libnm_glib_test_CFLAGS = \
+	-Wno-deprecated-declarations \
+	-Wno-deprecated
+libnm_glib_test_LDADD = \
+	$(top_builddir)/libnm-glib/libnm-glib.la \
+	$(top_builddir)/libnm-util/libnm-util.la \
+	$(DBUS_LIBS) \
+	$(GLIB_LIBS)
+
diff --git a/test/Makefile.in b/test/Makefile.in
new file mode 100644
index 00000000..7164f4d2
--- /dev/null
+++ b/test/Makefile.in
@@ -0,0 +1,662 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = nm-tool$(EXEEXT)
+noinst_PROGRAMS = nm-online$(EXEEXT) libnm-glib-test$(EXEEXT)
+subdir = test
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \
+	$(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/intltool.m4 \
+	$(top_srcdir)/m4/libnl-check.m4 $(top_srcdir)/m4/libtool.m4 \
+	$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+	$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+	$(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+	$(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
+am_libnm_glib_test_OBJECTS =  \
+	libnm_glib_test-libnm-glib-test.$(OBJEXT)
+libnm_glib_test_OBJECTS = $(am_libnm_glib_test_OBJECTS)
+am__DEPENDENCIES_1 =
+libnm_glib_test_DEPENDENCIES =  \
+	$(top_builddir)/libnm-glib/libnm-glib.la \
+	$(top_builddir)/libnm-util/libnm-util.la $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1)
+libnm_glib_test_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+	$(LIBTOOLFLAGS) --mode=link $(CCLD) $(libnm_glib_test_CFLAGS) \
+	$(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_nm_online_OBJECTS = nm-online.$(OBJEXT)
+nm_online_OBJECTS = $(am_nm_online_OBJECTS)
+nm_online_DEPENDENCIES = $(top_builddir)/libnm-util/libnm-util.la \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+am_nm_tool_OBJECTS = nm-tool.$(OBJEXT)
+nm_tool_OBJECTS = $(am_nm_tool_OBJECTS)
+nm_tool_DEPENDENCIES = $(top_builddir)/libnm-glib/libnm-glib.la \
+	$(top_builddir)/libnm-util/libnm-util.la $(am__DEPENDENCIES_1) \
+	$(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+	$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+	--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+	$(LDFLAGS) -o $@
+SOURCES = $(libnm_glib_test_SOURCES) $(nm_online_SOURCES) \
+	$(nm_tool_SOURCES)
+DIST_SOURCES = $(libnm_glib_test_SOURCES) $(nm_online_SOURCES) \
+	$(nm_tool_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ACLOCAL_AMFLAGS = @ACLOCAL_AMFLAGS@
+ALL_LINGUAS = @ALL_LINGUAS@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATADIRNAME = @DATADIRNAME@
+DBUS_CFLAGS = @DBUS_CFLAGS@
+DBUS_LIBS = @DBUS_LIBS@
+DBUS_SYS_DIR = @DBUS_SYS_DIR@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DHCLIENT_PATH = @DHCLIENT_PATH@
+DHCPCD_PATH = @DHCPCD_PATH@
+DISABLE_DEPRECATED = @DISABLE_DEPRECATED@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+GIO_CFLAGS = @GIO_CFLAGS@
+GIO_LIBS = @GIO_LIBS@
+GLIB_CFLAGS = @GLIB_CFLAGS@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+GLIB_LIBS = @GLIB_LIBS@
+GMODULE_CFLAGS = @GMODULE_CFLAGS@
+GMODULE_LIBS = @GMODULE_LIBS@
+GMOFILES = @GMOFILES@
+GMSGFMT = @GMSGFMT@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
+GREP = @GREP@
+GTKDOC_CHECK = @GTKDOC_CHECK@
+GTKDOC_MKPDF = @GTKDOC_MKPDF@
+GTKDOC_REBASE = @GTKDOC_REBASE@
+GUDEV_CFLAGS = @GUDEV_CFLAGS@
+GUDEV_LIBS = @GUDEV_LIBS@
+HTML_DIR = @HTML_DIR@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INSTOBJEXT = @INSTOBJEXT@
+INTLLIBS = @INTLLIBS@
+INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
+INTLTOOL_MERGE = @INTLTOOL_MERGE@
+INTLTOOL_PERL = @INTLTOOL_PERL@
+INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
+IPTABLES_PATH = @IPTABLES_PATH@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBDL = @LIBDL@
+LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+LIBM = @LIBM@
+LIBNL_CFLAGS = @LIBNL_CFLAGS@
+LIBNL_LIBS = @LIBNL_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MSGFMT = @MSGFMT@
+MSGFMT_OPTS = @MSGFMT_OPTS@
+MSGMERGE = @MSGMERGE@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NSS_CFLAGS = @NSS_CFLAGS@
+NSS_LIBS = @NSS_LIBS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+POFILES = @POFILES@
+POLKIT_CFLAGS = @POLKIT_CFLAGS@
+POLKIT_LIBS = @POLKIT_LIBS@
+POSUB = @POSUB@
+PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@
+PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@
+PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@
+RANLIB = @RANLIB@
+RESOLVCONF_PATH = @RESOLVCONF_PATH@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+SYSTEM_CA_PATH = @SYSTEM_CA_PATH@
+UDEV_BASE_DIR = @UDEV_BASE_DIR@
+USE_NLS = @USE_NLS@
+UUID_CFLAGS = @UUID_CFLAGS@
+UUID_LIBS = @UUID_LIBS@
+VERSION = @VERSION@
+XGETTEXT = @XGETTEXT@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+INCLUDES = -I${top_srcdir}                    \
+           -I${top_srcdir}/libnm-util         \
+           -I${top_srcdir}/libnm-glib         \
+           -I${top_srcdir}/include
+
+AM_CPPFLAGS = \
+	$(DBUS_CFLAGS) \
+	$(GLIB_CFLAGS) \
+	-DBINDIR=\"$(bindir)\" \
+	-DNM_RUN_DIR=\"$(rundir)\" \
+	-DDATADIR=\"$(datadir)\"
+
+nm_tool_SOURCES = nm-tool.c
+nm_tool_LDADD = \
+	$(top_builddir)/libnm-glib/libnm-glib.la \
+	$(top_builddir)/libnm-util/libnm-util.la \
+	$(DBUS_LIBS) \
+	$(GLIB_LIBS)
+
+nm_online_SOURCES = nm-online.c
+nm_online_LDADD = \
+	$(top_builddir)/libnm-util/libnm-util.la \
+	$(DBUS_LIBS) \
+	$(GLIB_LIBS)
+
+libnm_glib_test_SOURCES = libnm-glib-test.c
+libnm_glib_test_CFLAGS = \
+	-Wno-deprecated-declarations \
+	-Wno-deprecated
+
+libnm_glib_test_LDADD = \
+	$(top_builddir)/libnm-glib/libnm-glib.la \
+	$(top_builddir)/libnm-util/libnm-util.la \
+	$(DBUS_LIBS) \
+	$(GLIB_LIBS)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
+	@for dep in $?; do \
+	  case '$(am__configure_deps)' in \
+	    *$$dep*) \
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+	        && { if test -f $@; then exit 0; else break; fi; }; \
+	      exit 1;; \
+	  esac; \
+	done; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test/Makefile'; \
+	$(am__cd) $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu test/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+	@case '$?' in \
+	  *config.status*) \
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+	  *) \
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+	esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+	@$(NORMAL_INSTALL)
+	test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+	for p in $$list; do echo "$$p $$p"; done | \
+	sed 's/$(EXEEXT)$$//' | \
+	while read p p1; do if test -f $$p || test -f $$p1; \
+	  then echo "$$p"; echo "$$p"; else :; fi; \
+	done | \
+	sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+	    -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+	sed 'N;N;N;s,\n, ,g' | \
+	$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+	  { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+	    if ($$2 == $$4) files[d] = files[d] " " $$1; \
+	    else { print "f", $$3 "/" $$4, $$1; } } \
+	  END { for (d in files) print "f", d, files[d] }' | \
+	while read type dir files; do \
+	    if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+	    test -z "$$files" || { \
+	    echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+	    $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+	    } \
+	; done
+
+uninstall-binPROGRAMS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+	files=`for p in $$list; do echo "$$p"; done | \
+	  sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+	      -e 's/$$/$(EXEEXT)/' `; \
+	test -n "$$list" || exit 0; \
+	echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+	cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+	@list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+
+clean-noinstPROGRAMS:
+	@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
+	echo " rm -f" $$list; \
+	rm -f $$list || exit $$?; \
+	test -n "$(EXEEXT)" || exit 0; \
+	list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+	echo " rm -f" $$list; \
+	rm -f $$list
+libnm-glib-test$(EXEEXT): $(libnm_glib_test_OBJECTS) $(libnm_glib_test_DEPENDENCIES) 
+	@rm -f libnm-glib-test$(EXEEXT)
+	$(libnm_glib_test_LINK) $(libnm_glib_test_OBJECTS) $(libnm_glib_test_LDADD) $(LIBS)
+nm-online$(EXEEXT): $(nm_online_OBJECTS) $(nm_online_DEPENDENCIES) 
+	@rm -f nm-online$(EXEEXT)
+	$(LINK) $(nm_online_OBJECTS) $(nm_online_LDADD) $(LIBS)
+nm-tool$(EXEEXT): $(nm_tool_OBJECTS) $(nm_tool_DEPENDENCIES) 
+	@rm -f nm-tool$(EXEEXT)
+	$(LINK) $(nm_tool_OBJECTS) $(nm_tool_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT)
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_glib_test-libnm-glib-test.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-online.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-tool.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c -o $@ $<
+
+.c.obj:
+@am__fastdepCC_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@am__fastdepCC_TRUE@	$(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@	depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+@am__fastdepCC_TRUE@	$(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@	$(am__mv) $$depbase.Tpo $$depbase.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(LTCOMPILE) -c -o $@ $<
+
+libnm_glib_test-libnm-glib-test.o: libnm-glib-test.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnm_glib_test_CFLAGS) $(CFLAGS) -MT libnm_glib_test-libnm-glib-test.o -MD -MP -MF $(DEPDIR)/libnm_glib_test-libnm-glib-test.Tpo -c -o libnm_glib_test-libnm-glib-test.o `test -f 'libnm-glib-test.c' || echo '$(srcdir)/'`libnm-glib-test.c
+@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libnm_glib_test-libnm-glib-test.Tpo $(DEPDIR)/libnm_glib_test-libnm-glib-test.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='libnm-glib-test.c' object='libnm_glib_test-libnm-glib-test.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnm_glib_test_CFLAGS) $(CFLAGS) -c -o libnm_glib_test-libnm-glib-test.o `test -f 'libnm-glib-test.c' || echo '$(srcdir)/'`libnm-glib-test.c
+
+libnm_glib_test-libnm-glib-test.obj: libnm-glib-test.c
+@am__fastdepCC_TRUE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnm_glib_test_CFLAGS) $(CFLAGS) -MT libnm_glib_test-libnm-glib-test.obj -MD -MP -MF $(DEPDIR)/libnm_glib_test-libnm-glib-test.Tpo -c -o libnm_glib_test-libnm-glib-test.obj `if test -f 'libnm-glib-test.c'; then $(CYGPATH_W) 'libnm-glib-test.c'; else $(CYGPATH_W) '$(srcdir)/libnm-glib-test.c'; fi`
+@am__fastdepCC_TRUE@	$(am__mv) $(DEPDIR)/libnm_glib_test-libnm-glib-test.Tpo $(DEPDIR)/libnm_glib_test-libnm-glib-test.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	source='libnm-glib-test.c' object='libnm_glib_test-libnm-glib-test.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnm_glib_test_CFLAGS) $(CFLAGS) -c -o libnm_glib_test-libnm-glib-test.obj `if test -f 'libnm-glib-test.c'; then $(CYGPATH_W) 'libnm-glib-test.c'; else $(CYGPATH_W) '$(srcdir)/libnm-glib-test.c'; fi`
+
+mostlyclean-libtool:
+	-rm -f *.lo
+
+clean-libtool:
+	-rm -rf .libs _libs
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	mkid -fID $$unique
+tags: TAGS
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	set x; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	shift; \
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+	  test -n "$$unique" || unique=$$empty_fix; \
+	  if test $$# -gt 0; then \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      "$$@" $$unique; \
+	  else \
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	      $$unique; \
+	  fi; \
+	fi
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
+	test -z "$(CTAGS_ARGS)$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && $(am__cd) $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+	list='$(DISTFILES)'; \
+	  dist_files=`for file in $$list; do echo $$file; done | \
+	  sed -e "s|^$$srcdirstrip/||;t" \
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+	case $$dist_files in \
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+			   sort -u` ;; \
+	esac; \
+	for file in $$dist_files; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  if test -d $$d/$$file; then \
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+	    if test -d "$(distdir)/$$file"; then \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+	    fi; \
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+	  else \
+	    test -f "$(distdir)/$$file" \
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+	for dir in "$(DESTDIR)$(bindir)"; do \
+	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+	done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+	clean-noinstPROGRAMS mostlyclean-am
+
+distclean: distclean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+	distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+	-rm -rf ./$(DEPDIR)
+	-rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+	mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+	clean-generic clean-libtool clean-noinstPROGRAMS ctags \
+	distclean distclean-compile distclean-generic \
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
+	html-am info info-am install install-am install-binPROGRAMS \
+	install-data install-data-am install-dvi install-dvi-am \
+	install-exec install-exec-am install-html install-html-am \
+	install-info install-info-am install-man install-pdf \
+	install-pdf-am install-ps install-ps-am install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+	tags uninstall uninstall-am uninstall-binPROGRAMS
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/test/libnm-glib-test.c b/test/libnm-glib-test.c
new file mode 100644
index 00000000..9ad1dc0a
--- /dev/null
+++ b/test/libnm-glib-test.c
@@ -0,0 +1,113 @@
+/* libnm_glib_test - test app for libnm_glib
+ *
+ * Dan Williams <dcbw@redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * (C) Copyright 2005 Red Hat, Inc.
+ */
+
+#include <glib.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+
+#include "libnm_glib.h"
+
+
+static void status_printer (libnm_glib_ctx *ctx, gpointer user_data)
+{
+	libnm_glib_state	state;
+
+	g_return_if_fail (ctx != NULL);
+
+	state = libnm_glib_get_network_state (ctx);
+	switch (state)
+	{
+		case LIBNM_NO_DBUS:
+			fprintf (stderr, "Status: No DBUS\n");
+			break;
+		case LIBNM_NO_NETWORKMANAGER:
+			fprintf (stderr, "Status: No NetworkManager\n");
+			break;
+		case LIBNM_NO_NETWORK_CONNECTION:
+			fprintf (stderr, "Status: No Connection\n");
+			break;
+		case LIBNM_ACTIVE_NETWORK_CONNECTION:
+			fprintf (stderr, "Status: Active Connection\n");
+			break;
+		case LIBNM_INVALID_CONTEXT:
+			fprintf (stderr, "Status: Error\n");
+			break;
+		default:
+			fprintf (stderr, "Status: unknown\n");
+			break;
+	}
+}
+
+static GMainLoop *loop = NULL;
+
+static void
+signal_handler (int signo)
+{
+	if (signo == SIGINT || signo == SIGTERM) {
+		g_message ("Caught signal %d, shutting down...", signo);
+		g_main_loop_quit (loop);
+	}
+}
+
+static void
+setup_signals (void)
+{
+	struct sigaction action;
+	sigset_t mask;
+
+	sigemptyset (&mask);
+	action.sa_handler = signal_handler;
+	action.sa_mask = mask;
+	action.sa_flags = 0;
+	sigaction (SIGTERM,  &action, NULL);
+	sigaction (SIGINT,  &action, NULL);
+}
+
+int main( int argc, char *argv[] )
+{
+	libnm_glib_ctx *ctx;
+	guint id;
+
+	ctx = libnm_glib_init ();
+	if (!ctx)
+	{
+		fprintf (stderr, "Could not initialize libnm.\n");
+		exit (1);
+	}
+
+	id = libnm_glib_register_callback (ctx, status_printer, ctx, NULL);
+	fprintf (stderr, "Registered Callback with ID %d\n", id);
+	libnm_glib_unregister_callback (ctx, id);
+	fprintf (stderr, "Unregistered Callback with ID %d\n", id);
+
+	id = libnm_glib_register_callback (ctx, status_printer, ctx, NULL);
+	fprintf (stderr, "Registered Callback with ID %d\n", id);
+
+	loop = g_main_loop_new (NULL, FALSE);
+	setup_signals ();
+	g_main_loop_run (loop);
+
+	libnm_glib_shutdown (ctx);
+
+	exit (0);
+}
diff --git a/test/nm-online.c b/test/nm-online.c
new file mode 100644
index 00000000..27bf1789
--- /dev/null
+++ b/test/nm-online.c
@@ -0,0 +1,210 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2006 - 2008 Novell, Inc.
+ *
+ */
+
+/*
+ * nm-online.c - Are we online?
+ *
+ * Return values:
+ *
+ * 	0	: already online or connection established within given timeout
+ *	1	: offline or not online within given timeout
+ *	2	: unspecified error
+ *
+ * Robert Love <rml@novell.com>
+ */
+
+#define PROGRESS_STEPS 15
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <getopt.h>
+
+#include <glib.h>
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib-lowlevel.h>
+#include <dbus/dbus-glib.h>
+
+#include "NetworkManager.h"
+#include "nm-glib-compat.h"
+
+typedef struct 
+{
+	int value;
+	double norm;
+	gboolean quiet;
+} Timeout;
+
+static GMainLoop *loop;
+
+static DBusHandlerResult dbus_filter (DBusConnection *connection G_GNUC_UNUSED,
+				      DBusMessage *message,
+				      void *user_data G_GNUC_UNUSED)
+{
+	NMState state;
+
+	if (!dbus_message_is_signal (message, NM_DBUS_INTERFACE, "StateChanged"))
+		return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+	if (!dbus_message_get_args (message, NULL, DBUS_TYPE_UINT32, &state, DBUS_TYPE_INVALID))
+		return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
+	if (state == NM_STATE_CONNECTED)
+		g_main_loop_quit (loop);
+
+	return DBUS_HANDLER_RESULT_HANDLED;
+}
+
+static NMState check_online (DBusConnection *connection)
+{
+	DBusMessage *message, *reply;
+	DBusError error;
+	dbus_uint32_t state;
+	
+	message = dbus_message_new_method_call (NM_DBUS_SERVICE, NM_DBUS_PATH,
+						NM_DBUS_INTERFACE, "state");
+	if (!message)
+		exit (2);
+
+	dbus_error_init (&error);
+	reply = dbus_connection_send_with_reply_and_block (connection, message,
+							   -1, &error);
+	dbus_message_unref (message);
+	if (!reply) 
+		return NM_STATE_UNKNOWN;
+
+	if (!dbus_message_get_args (reply, NULL, DBUS_TYPE_UINT32, &state,
+				    DBUS_TYPE_INVALID))
+		exit (2);
+
+	return state;
+}
+
+static gboolean handle_timeout (gpointer data)
+{
+	int i = PROGRESS_STEPS;
+	Timeout *timeout = (Timeout *) data;
+
+	if (!timeout->quiet) {
+		g_print ("\rConnecting");
+		for (; i > 0; i--)
+			putchar ((timeout->value >= (i * timeout->norm)) ? ' ' : '.');
+		if (timeout->value)
+			g_print (" %4is", timeout->value);
+		fflush (stdout);
+	}
+
+	timeout->value--;
+	if (timeout->value < 0) {
+		if (!timeout->quiet)
+			g_print ("\n");
+		exit (1);
+	}
+
+	return TRUE;
+}
+
+int main (int argc, char *argv[])
+{
+	DBusConnection *connection;
+	DBusError error;
+	NMState state;
+	gint t_secs = -1;
+	gboolean exit_no_nm = FALSE;
+	gboolean quiet = FALSE;
+	Timeout timeout;
+	GOptionContext *opt_ctx = NULL;
+	gboolean success;
+
+	GOptionEntry options[] = {
+		{"timeout", 't', 0, G_OPTION_ARG_INT, &t_secs, "Time to wait for a connection, in seconds (default is 30)", NULL},
+		{"exit", 'x', 0, G_OPTION_ARG_NONE, &exit_no_nm, "Exit immediately if NetworkManager is not running or connecting", NULL},
+		{"quiet", 'q', 0, G_OPTION_ARG_NONE, &quiet, "Don't print anything", NULL},
+		{NULL}
+	};
+
+	opt_ctx = g_option_context_new ("");
+	g_option_context_set_translation_domain (opt_ctx, "UTF-8");
+	g_option_context_set_ignore_unknown_options (opt_ctx, FALSE);
+	g_option_context_set_help_enabled (opt_ctx, TRUE);
+	g_option_context_add_main_entries (opt_ctx, options, NULL);
+
+	g_option_context_set_summary (opt_ctx,
+		"Waits for a successful connection in NetworkManager.");
+
+	success = g_option_context_parse (opt_ctx, &argc, &argv, NULL);
+	g_option_context_free (opt_ctx);
+
+	if (!success) {
+		g_warning ("Invalid option.  Please use --help to see a list of valid options.");
+		return 2;
+	}
+	
+	if (t_secs > -1)
+		timeout.value = t_secs;
+	else
+		timeout.value = 30;
+	if (timeout.value < 0 || timeout.value > 3600)  {
+		g_warning ("Invalid option.  Please use --help to see a list of valid options.");
+		return 2;
+	}
+
+	g_type_init ();
+	loop = g_main_loop_new (NULL, FALSE);
+
+	dbus_error_init (&error);
+	connection = dbus_bus_get (DBUS_BUS_SYSTEM, &error);
+	if (connection == NULL) {
+		dbus_error_free (&error);
+		return 2;
+	}
+
+	dbus_connection_setup_with_g_main (connection, NULL);
+
+	if (!dbus_connection_add_filter (connection, dbus_filter, NULL, NULL))
+		return 2;
+
+	dbus_bus_add_match (connection,
+			    "type='signal',"
+			    "interface='" NM_DBUS_INTERFACE "',"
+			    "sender='" NM_DBUS_SERVICE "',"
+			    "path='" NM_DBUS_PATH "'", &error);
+	if (dbus_error_is_set (&error)) {
+		dbus_error_free (&error);
+		return 2;
+	}
+
+	/* Check after we setup the filter to ensure that we cannot race. */
+	state = check_online (connection);
+	if (state == NM_STATE_CONNECTED)
+		return 0;
+	if (exit_no_nm && (state != NM_STATE_CONNECTING))
+		return 1;
+
+	if (timeout.value) {
+		timeout.norm = (double) timeout.value / (double) PROGRESS_STEPS;
+		g_timeout_add_seconds (1, handle_timeout, &timeout);
+	}
+	timeout.quiet = quiet;
+
+	g_main_loop_run (loop);
+
+	return 0;
+}
diff --git a/test/nm-tool.c b/test/nm-tool.c
new file mode 100644
index 00000000..df0c15ed
--- /dev/null
+++ b/test/nm-tool.c
@@ -0,0 +1,721 @@
+/* nm-tool - information tool for NetworkManager
+ *
+ * Dan Williams <dcbw@redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * (C) Copyright 2005 - 2009 Red Hat, Inc.
+ * (C) Copyright 2007 Novell, Inc.
+ */
+
+#include <glib.h>
+#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+#include <nm-client.h>
+#include <nm-device.h>
+#include <nm-device-ethernet.h>
+#include <nm-device-wifi.h>
+#include <nm-gsm-device.h>
+#include <nm-cdma-device.h>
+#include <nm-device-bt.h>
+#include <nm-utils.h>
+#include <nm-setting-ip4-config.h>
+#include <nm-setting-ip6-config.h>
+#include <nm-vpn-connection.h>
+#include <nm-setting-connection.h>
+
+/* Don't use nm-dbus-glib-types.h so that we can keep nm-tool
+ * building standalone outside of the NM tree.
+ */
+#define DBUS_TYPE_G_MAP_OF_VARIANT          (dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, G_TYPE_VALUE))
+#define DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT   (dbus_g_type_get_map ("GHashTable", G_TYPE_STRING, DBUS_TYPE_G_MAP_OF_VARIANT))
+#define DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH    (dbus_g_type_get_collection ("GPtrArray", DBUS_TYPE_G_OBJECT_PATH))
+
+static GHashTable *user_connections = NULL;
+static GHashTable *system_connections = NULL;
+
+static gboolean
+get_nm_state (NMClient *client)
+{
+	NMState state;
+	char *state_string;
+	gboolean success = TRUE;
+
+	state = nm_client_get_state (client);
+
+	switch (state) {
+	case NM_STATE_ASLEEP:
+		state_string = "asleep";
+		break;
+
+	case NM_STATE_CONNECTING:
+		state_string = "connecting";
+		break;
+
+	case NM_STATE_CONNECTED:
+		state_string = "connected";
+		break;
+
+	case NM_STATE_DISCONNECTED:
+		state_string = "disconnected";
+		break;
+
+	case NM_STATE_UNKNOWN:
+	default:
+		state_string = "unknown";
+		success = FALSE;
+		break;
+	}
+
+	printf ("State: %s\n\n", state_string);
+
+	return success;
+}
+
+static void
+print_header (const char *label, const char *iface, const char *connection)
+{
+	GString *string;
+
+	string = g_string_sized_new (79);
+	g_string_append_printf (string, "- %s: ", label);
+	if (iface)
+		g_string_append_printf (string, "%s ", iface);
+	if (connection)
+		g_string_append_printf (string, " [%s] ", connection);
+
+	while (string->len < 80)
+		g_string_append_c (string, '-');
+
+	printf ("%s\n", string->str);
+
+	g_string_free (string, TRUE);
+}
+
+static void
+print_string (const char *label, const char *data)
+{
+#define SPACING 18
+	int label_len = 0;
+	char spaces[50];
+	int i;
+
+	g_return_if_fail (label != NULL);
+	g_return_if_fail (data != NULL);
+
+	label_len = strlen (label);
+	if (label_len > SPACING)
+		label_len = SPACING - 1;
+	for (i = 0; i < (SPACING - label_len); i++)
+		spaces[i] = 0x20;
+	spaces[i] = 0x00;
+
+	printf ("  %s:%s%s\n", label, &spaces[0], data);
+}
+
+
+static void
+detail_access_point (gpointer data, gpointer user_data)
+{
+	NMAccessPoint *ap = NM_ACCESS_POINT (data);
+	const char *active_bssid = (const char *) user_data;
+	GString *str;
+	gboolean active = FALSE;
+	guint32 flags, wpa_flags, rsn_flags;
+	const GByteArray * ssid;
+	char *tmp;
+
+	flags = nm_access_point_get_flags (ap);
+	wpa_flags = nm_access_point_get_wpa_flags (ap);
+	rsn_flags = nm_access_point_get_rsn_flags (ap);
+
+	if (active_bssid) {
+		const char *current_bssid = nm_access_point_get_hw_address (ap);
+		if (current_bssid && !strcmp (current_bssid, active_bssid))
+			active = TRUE;
+	}
+
+	str = g_string_new (NULL);
+	g_string_append_printf (str,
+	                        "%s, %s, Freq %d MHz, Rate %d Mb/s, Strength %d",
+	                        (nm_access_point_get_mode (ap) == NM_802_11_MODE_INFRA) ? "Infra" : "Ad-Hoc",
+	                        nm_access_point_get_hw_address (ap),
+	                        nm_access_point_get_frequency (ap),
+	                        nm_access_point_get_max_bitrate (ap) / 1000,
+	                        nm_access_point_get_strength (ap));
+
+	if (   !(flags & NM_802_11_AP_FLAGS_PRIVACY)
+	    &&  (wpa_flags != NM_802_11_AP_SEC_NONE)
+	    &&  (rsn_flags != NM_802_11_AP_SEC_NONE))
+		g_string_append (str, ", Encrypted: ");
+
+	if (   (flags & NM_802_11_AP_FLAGS_PRIVACY)
+	    && (wpa_flags == NM_802_11_AP_SEC_NONE)
+	    && (rsn_flags == NM_802_11_AP_SEC_NONE))
+		g_string_append (str, " WEP");
+	if (wpa_flags != NM_802_11_AP_SEC_NONE)
+		g_string_append (str, " WPA");
+	if (rsn_flags != NM_802_11_AP_SEC_NONE)
+		g_string_append (str, " WPA2");
+	if (   (wpa_flags & NM_802_11_AP_SEC_KEY_MGMT_802_1X)
+	    || (rsn_flags & NM_802_11_AP_SEC_KEY_MGMT_802_1X))
+		g_string_append (str, " Enterprise");
+
+	/* FIXME: broadcast/hidden */
+
+	ssid = nm_access_point_get_ssid (ap);
+	tmp = g_strdup_printf ("  %s%s", active ? "*" : "",
+	                       ssid ? nm_utils_escape_ssid (ssid->data, ssid->len) : "(none)");
+
+	print_string (tmp, str->str);
+
+	g_string_free (str, TRUE);
+	g_free (tmp);
+}
+
+static gchar *
+ip4_address_as_string (guint32 ip)
+{
+	struct in_addr tmp_addr;
+	char buf[INET_ADDRSTRLEN+1];
+
+	memset (&buf, '\0', sizeof (buf));
+	tmp_addr.s_addr = ip;
+
+	if (inet_ntop (AF_INET, &tmp_addr, buf, INET_ADDRSTRLEN)) {
+		return g_strdup (buf);
+	} else {
+		nm_warning ("%s: error converting IP4 address 0x%X",
+		            __func__, ntohl (tmp_addr.s_addr));
+		return NULL;
+	}
+}
+
+static gchar *
+ip6_address_as_string (const struct in6_addr *ip)
+{
+	char buf[INET6_ADDRSTRLEN];
+
+	memset (&buf, '\0', sizeof (buf));
+
+	if (inet_ntop (AF_INET6, ip, buf, INET6_ADDRSTRLEN)) {
+		return g_strdup (buf);
+	} else {
+		int j;
+		GString *ip6_str = g_string_new (NULL);
+		g_string_append_printf (ip6_str, "%02X", ip->s6_addr[0]);
+		for (j = 1; j < 16; j++)
+			g_string_append_printf (ip6_str, " %02X", ip->s6_addr[j]);
+		nm_warning ("%s: error converting IP6 address %s",
+		            __func__, ip6_str->str);
+		g_string_free (ip6_str, TRUE);
+		return NULL;
+	}
+}
+
+static const char *
+get_dev_state_string (NMDeviceState state)
+{
+	if (state == NM_DEVICE_STATE_UNMANAGED)
+		return "unmanaged";
+	else if (state == NM_DEVICE_STATE_UNAVAILABLE)
+		return "unavailable";
+	else if (state == NM_DEVICE_STATE_DISCONNECTED)
+		return "disconnected";
+	else if (state == NM_DEVICE_STATE_PREPARE)
+		return "connecting (prepare)";
+	else if (state == NM_DEVICE_STATE_CONFIG)
+		return "connecting (configuring)";
+	else if (state == NM_DEVICE_STATE_NEED_AUTH)
+		return "connecting (need authentication)";
+	else if (state == NM_DEVICE_STATE_IP_CONFIG)
+		return "connecting (getting IP configuration)";
+	else if (state == NM_DEVICE_STATE_ACTIVATED)
+		return "connected";
+	else if (state == NM_DEVICE_STATE_FAILED)
+		return "connection failed";
+	return "unknown";
+}
+
+static NMConnection *
+get_connection_for_active (NMActiveConnection *active)
+{
+	NMConnectionScope scope;
+	const char *path;
+
+	g_return_val_if_fail (active != NULL, NULL);
+
+	path = nm_active_connection_get_connection (active);
+	g_return_val_if_fail (path != NULL, NULL);
+
+	scope = nm_active_connection_get_scope (active);
+	if (scope == NM_CONNECTION_SCOPE_USER)
+		return (NMConnection *) g_hash_table_lookup (user_connections, path);
+	else if (scope == NM_CONNECTION_SCOPE_SYSTEM)
+		return (NMConnection *) g_hash_table_lookup (system_connections, path);
+
+	g_warning ("error: unknown connection scope");
+	return NULL;
+}
+
+struct cb_info {
+	NMClient *client;
+	const GPtrArray *active;
+};
+
+static void
+detail_device (gpointer data, gpointer user_data)
+{
+	NMDevice *device = NM_DEVICE (data);
+	struct cb_info *info = user_data;
+	char *tmp;
+	NMDeviceState state;
+	guint32 caps;
+	guint32 speed;
+	const GArray *array;
+	int j;
+	gboolean is_default = FALSE;
+	const char *id = NULL;
+
+	state = nm_device_get_state (device);
+
+	for (j = 0; info->active && (j < info->active->len); j++) {
+		NMActiveConnection *candidate = g_ptr_array_index (info->active, j);
+		const GPtrArray *devices = nm_active_connection_get_devices (candidate);
+		NMDevice *candidate_dev;
+		NMConnection *connection;
+		NMSettingConnection *s_con;
+
+		if (!devices || !devices->len)
+			continue;
+		candidate_dev = g_ptr_array_index (devices, 0);
+
+		if (candidate_dev == device) {
+			if (nm_active_connection_get_default (candidate))
+				is_default = TRUE;
+
+			connection = get_connection_for_active (candidate);
+			if (!connection)
+				break;
+
+			s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
+			if (s_con)
+				id = nm_setting_connection_get_id (s_con);
+			break;
+		}
+	}
+
+	print_header ("Device", nm_device_get_iface (device), id);
+
+	/* General information */
+	if (NM_IS_DEVICE_ETHERNET (device))
+		print_string ("Type", "Wired");
+	else if (NM_IS_DEVICE_WIFI (device))
+		print_string ("Type", "802.11 WiFi");
+	else if (NM_IS_GSM_DEVICE (device))
+		print_string ("Type", "Mobile Broadband (GSM)");
+	else if (NM_IS_CDMA_DEVICE (device))
+		print_string ("Type", "Mobile Broadband (CDMA)");
+	else if (NM_IS_DEVICE_BT (device))
+		print_string ("Type", "Bluetooth");
+
+	print_string ("Driver", nm_device_get_driver (device) ? nm_device_get_driver (device) : "(unknown)");
+
+	print_string ("State", get_dev_state_string (state));
+
+	if (is_default)
+		print_string ("Default", "yes");
+	else
+		print_string ("Default", "no");
+
+	tmp = NULL;
+	if (NM_IS_DEVICE_ETHERNET (device))
+		tmp = g_strdup (nm_device_ethernet_get_hw_address (NM_DEVICE_ETHERNET (device)));
+	else if (NM_IS_DEVICE_WIFI (device))
+		tmp = g_strdup (nm_device_wifi_get_hw_address (NM_DEVICE_WIFI (device)));
+
+	if (tmp) {
+		print_string ("HW Address", tmp);
+		g_free (tmp);
+	}
+
+	/* Capabilities */
+	caps = nm_device_get_capabilities (device);
+	printf ("\n  Capabilities:\n");
+	if (caps & NM_DEVICE_CAP_CARRIER_DETECT)
+		print_string ("  Carrier Detect", "yes");
+
+	speed = 0;
+	if (NM_IS_DEVICE_ETHERNET (device)) {
+		/* Speed in Mb/s */
+		speed = nm_device_ethernet_get_speed (NM_DEVICE_ETHERNET (device));
+	} else if (NM_IS_DEVICE_WIFI (device)) {
+		/* Speed in b/s */
+		speed = nm_device_wifi_get_bitrate (NM_DEVICE_WIFI (device));
+		speed /= 1000;
+	}
+
+	if (speed) {
+		char *speed_string;
+
+		speed_string = g_strdup_printf ("%u Mb/s", speed);
+		print_string ("  Speed", speed_string);
+		g_free (speed_string);
+	}
+
+	/* Wireless specific information */
+	if ((NM_IS_DEVICE_WIFI (device))) {
+		guint32 wcaps;
+		NMAccessPoint *active_ap = NULL;
+		const char *active_bssid = NULL;
+		const GPtrArray *aps;
+
+		printf ("\n  Wireless Properties\n");
+
+		wcaps = nm_device_wifi_get_capabilities (NM_DEVICE_WIFI (device));
+
+		if (wcaps & (NM_WIFI_DEVICE_CAP_CIPHER_WEP40 | NM_WIFI_DEVICE_CAP_CIPHER_WEP104))
+			print_string ("  WEP Encryption", "yes");
+		if (wcaps & NM_WIFI_DEVICE_CAP_WPA)
+			print_string ("  WPA Encryption", "yes");
+		if (wcaps & NM_WIFI_DEVICE_CAP_RSN)
+			print_string ("  WPA2 Encryption", "yes");
+
+		if (nm_device_get_state (device) == NM_DEVICE_STATE_ACTIVATED) {
+			active_ap = nm_device_wifi_get_active_access_point (NM_DEVICE_WIFI (device));
+			active_bssid = active_ap ? nm_access_point_get_hw_address (active_ap) : NULL;
+		}
+
+		printf ("\n  Wireless Access Points %s\n", active_ap ? "(* = current AP)" : "");
+
+		aps = nm_device_wifi_get_access_points (NM_DEVICE_WIFI (device));
+		if (aps && aps->len)
+			g_ptr_array_foreach ((GPtrArray *) aps, detail_access_point, (gpointer) active_bssid);
+	} else if (NM_IS_DEVICE_ETHERNET (device)) {
+		printf ("\n  Wired Properties\n");
+
+		if (nm_device_ethernet_get_carrier (NM_DEVICE_ETHERNET (device)))
+			print_string ("  Carrier", "on");
+		else
+			print_string ("  Carrier", "off");
+	}
+
+	/* IP Setup info */
+	if (state == NM_DEVICE_STATE_ACTIVATED) {
+		NMIP4Config *cfg4 = nm_device_get_ip4_config (device);
+		NMIP6Config *cfg6 = nm_device_get_ip6_config (device);
+		GSList *iter;
+
+		if (cfg4) {
+			printf ("\n  IPv4 Settings:\n");
+
+			for (iter = (GSList *) nm_ip4_config_get_addresses (cfg4); iter; iter = g_slist_next (iter)) {
+				NMIP4Address *addr = (NMIP4Address *) iter->data;
+				guint32 prefix = nm_ip4_address_get_prefix (addr);
+				char *tmp2;
+
+				tmp = ip4_address_as_string (nm_ip4_address_get_address (addr));
+				print_string ("  Address", tmp);
+				g_free (tmp);
+
+				tmp2 = ip4_address_as_string (nm_utils_ip4_prefix_to_netmask (prefix));
+				tmp = g_strdup_printf ("%d (%s)", prefix, tmp2);
+				g_free (tmp2);
+				print_string ("  Prefix", tmp);
+				g_free (tmp);
+
+				tmp = ip4_address_as_string (nm_ip4_address_get_gateway (addr));
+				print_string ("  Gateway", tmp);
+				g_free (tmp);
+				printf ("\n");
+			}
+
+			array = nm_ip4_config_get_nameservers (cfg4);
+			if (array) {
+				int i;
+
+				for (i = 0; i < array->len; i++) {
+					tmp = ip4_address_as_string (g_array_index (array, guint32, i));
+					print_string ("  DNS", tmp);
+					g_free (tmp);
+				}
+			}
+		}
+
+		if (cfg6) {
+			printf ("\n  IPv6 Settings:\n");
+
+			for (iter = (GSList *) nm_ip6_config_get_addresses (cfg6); iter; iter = g_slist_next (iter)) {
+				NMIP6Address *addr = (NMIP6Address *) iter->data;
+				guint32 prefix = nm_ip6_address_get_prefix (addr);
+
+				tmp = ip6_address_as_string (nm_ip6_address_get_address (addr));
+				print_string ("  Address", tmp);
+				g_free (tmp);
+
+				tmp = g_strdup_printf ("%d", prefix);
+				print_string ("  Prefix", tmp);
+				g_free (tmp);
+
+				tmp = ip6_address_as_string (nm_ip6_address_get_gateway (addr));
+				print_string ("  Gateway", tmp);
+				g_free (tmp);
+				printf ("\n");
+			}
+
+			for (iter = (GSList *) nm_ip6_config_get_nameservers (cfg6); iter; iter = g_slist_next (iter)) {
+				tmp = ip6_address_as_string (iter->data);
+				print_string ("  DNS", tmp);
+				g_free (tmp);
+			}
+		}
+	}
+
+	printf ("\n\n");
+}
+
+static const char *
+get_vpn_state_string (NMVPNConnectionState state)
+{
+	switch (state) {
+	case NM_VPN_CONNECTION_STATE_PREPARE:
+		return "connecting (prepare)";
+	case NM_VPN_CONNECTION_STATE_NEED_AUTH:
+		return "connecting (need authentication)";
+	case NM_VPN_CONNECTION_STATE_CONNECT:
+		return "connecting";
+	case NM_VPN_CONNECTION_STATE_IP_CONFIG_GET:
+		return "connecting (getting IP configuration)";
+	case NM_VPN_CONNECTION_STATE_ACTIVATED:
+		return "connected";
+	case NM_VPN_CONNECTION_STATE_FAILED:
+		return "connection failed";
+	case NM_VPN_CONNECTION_STATE_DISCONNECTED:
+		return "disconnected";
+	default:
+		break;
+	}
+
+	return "unknown";
+}
+
+static void
+detail_vpn (gpointer data, gpointer user_data)
+{
+	NMActiveConnection *active = NM_ACTIVE_CONNECTION (data);
+	NMConnection *connection;
+	NMSettingConnection *s_con;
+	NMVPNConnectionState state;
+	const char *banner;
+
+	if (!NM_IS_VPN_CONNECTION (active))
+		return;
+
+	connection = get_connection_for_active (active);
+	g_return_if_fail (connection != NULL);
+
+	s_con = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
+	g_return_if_fail (connection != NULL);
+
+	print_header ("VPN", NULL, nm_setting_connection_get_id (s_con));
+
+	state = nm_vpn_connection_get_vpn_state (NM_VPN_CONNECTION (active));
+	print_string ("State", get_vpn_state_string (state));
+
+	if (nm_active_connection_get_default (active))
+		print_string ("Default", "yes");
+	else
+		print_string ("Default", "no");
+
+	banner = nm_vpn_connection_get_banner (NM_VPN_CONNECTION (active));
+	if (banner) {
+		char **lines, **iter;
+
+		printf ("\n  Message:\n");
+		lines = g_strsplit_set (banner, "\n\r", -1);
+		for (iter = lines; *iter; iter++) {
+			if (*iter && strlen (*iter))
+				printf ("    %s\n", *iter);
+		}
+		g_strfreev (lines);
+	}
+
+	printf ("\n\n");
+}
+
+static void
+get_one_connection (DBusGConnection *bus,
+                    const char *path,
+                    NMConnectionScope scope,
+                    GHashTable *table)
+{
+	DBusGProxy *proxy;
+	NMConnection *connection = NULL;
+	const char *service;
+	GError *error = NULL;
+	GHashTable *settings = NULL;
+
+	g_return_if_fail (bus != NULL);
+	g_return_if_fail (path != NULL);
+	g_return_if_fail (table != NULL);
+
+	service = (scope == NM_CONNECTION_SCOPE_SYSTEM) ?
+		NM_DBUS_SERVICE_SYSTEM_SETTINGS : NM_DBUS_SERVICE_USER_SETTINGS;
+
+	proxy = dbus_g_proxy_new_for_name (bus, service, path, NM_DBUS_IFACE_SETTINGS_CONNECTION);
+	if (!proxy)
+		return;
+
+	if (!dbus_g_proxy_call (proxy, "GetSettings", &error,
+	                        G_TYPE_INVALID,
+	                        DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, &settings,
+	                        G_TYPE_INVALID)) {
+		nm_warning ("error: cannot retrieve connection: %s", error ? error->message : "(unknown)");
+		goto out;
+	}
+
+	connection = nm_connection_new_from_hash (settings, &error);
+	g_hash_table_destroy (settings);
+
+	if (!connection) {
+		nm_warning ("error: invalid connection: '%s' / '%s' invalid: %d",
+		            error ? g_type_name (nm_connection_lookup_setting_type_by_quark (error->domain)) : "(unknown)",
+		            error ? error->message : "(unknown)",
+		            error ? error->code : -1);
+		goto out;
+	}
+
+	nm_connection_set_scope (connection, scope);
+	nm_connection_set_path (connection, path);
+	g_hash_table_insert (table, g_strdup (path), g_object_ref (connection));
+
+out:
+	g_clear_error (&error);
+	if (connection)
+		g_object_unref (connection);
+	g_object_unref (proxy);
+}
+
+static void
+get_connections_for_service (DBusGConnection *bus,
+                             NMConnectionScope scope,
+                             GHashTable *table)
+{
+	GError *error = NULL;
+	DBusGProxy *proxy;
+	GPtrArray *paths = NULL;
+	int i;
+	const char *service;
+
+	service = (scope == NM_CONNECTION_SCOPE_SYSTEM) ?
+		NM_DBUS_SERVICE_SYSTEM_SETTINGS : NM_DBUS_SERVICE_USER_SETTINGS;
+
+	proxy = dbus_g_proxy_new_for_name (bus,
+	                                   service,
+	                                   NM_DBUS_PATH_SETTINGS,
+	                                   NM_DBUS_IFACE_SETTINGS);
+	if (!proxy) {
+		g_warning ("error: failed to create DBus proxy for %s", service);
+		return;
+	}
+
+	if (!dbus_g_proxy_call (proxy, "ListConnections", &error,
+                                G_TYPE_INVALID,
+                                DBUS_TYPE_G_ARRAY_OF_OBJECT_PATH, &paths,
+                                G_TYPE_INVALID)) {
+		g_warning ("error: failed to read connections from %s:\n    %s",
+		           service, error ? error->message : "(unknown)");
+		g_clear_error (&error);
+		goto out;
+	}
+
+	for (i = 0; paths && (i < paths->len); i++)
+		get_one_connection (bus, g_ptr_array_index (paths, i), scope, table);
+
+out:
+	g_object_unref (proxy);
+}
+
+static gboolean
+get_all_connections (void)
+{
+	DBusGConnection *bus;
+	GError *error = NULL;
+
+	bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
+	if (error || !bus) {
+		g_warning ("error: could not connect to dbus");
+		return FALSE;
+	}
+
+	user_connections = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
+	get_connections_for_service (bus, NM_CONNECTION_SCOPE_USER, user_connections);
+
+	system_connections = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
+	get_connections_for_service (bus, NM_CONNECTION_SCOPE_SYSTEM, system_connections);
+
+	dbus_g_connection_unref (bus);
+	return TRUE;
+}
+
+int
+main (int argc, char *argv[])
+{
+	NMClient *client;
+	const GPtrArray *devices;
+	struct cb_info info;
+
+	g_type_init ();
+
+	client = nm_client_new ();
+	if (!client) {
+		exit (1);
+	}
+
+	printf ("\nNetworkManager Tool\n\n");
+
+	if (!get_nm_state (client)) {
+		g_warning ("error: could not connect to NetworkManager");
+		exit (1);
+	}
+
+	if (!get_all_connections ())
+		exit (1);
+
+	info.client = client;
+	info.active = nm_client_get_active_connections (client);
+
+
+	devices = nm_client_get_devices (client);
+	if (devices)
+		g_ptr_array_foreach ((GPtrArray *) devices, detail_device, &info);
+
+	if (info.active)
+		g_ptr_array_foreach ((GPtrArray *) info.active, detail_vpn, &info);
+
+	g_object_unref (client);
+	g_hash_table_unref (user_connections);
+	g_hash_table_unref (system_connections);
+
+	return 0;
+}