changeset 4796:62265a3a1870

added audtool_disconnect().
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Sat, 11 Oct 2008 02:32:37 +0900
parents 885c21b8684e
children 9b9bcf252a10
files src/audtool/main.c
diffstat 1 files changed, 14 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/audtool/main.c	Sat Oct 04 23:48:49 2008 +0100
+++ b/src/audtool/main.c	Sat Oct 11 02:32:37 2008 +0900
@@ -139,7 +139,7 @@
 	{"list-handlers", get_handlers_list, "shows handlers list", 0},
 	{"help", get_handlers_list, "shows handlers list", 0},
 
-    
+
 	{NULL, NULL, NULL, 0}
 };
 
@@ -147,7 +147,8 @@
 DBusGProxy *dbus_proxy = NULL;
 static DBusGConnection *connection = NULL;
 
-static void audtool_connect(void)
+static void
+audtool_connect(void)
 {
 	GError *error = NULL;
 
@@ -164,7 +165,15 @@
                                            AUDACIOUS_DBUS_INTERFACE);
 }
 
-gint main(gint argc, gchar **argv)
+static void
+audtool_disconnect(void)
+{
+	g_object_unref(dbus_proxy);
+	dbus_proxy = NULL;
+}
+
+gint
+main(gint argc, gchar **argv)
 {
 	gint i, j = 0, k = 0;
 
@@ -203,5 +212,7 @@
 	if (k == 0)
 		mowgli_error_context_display_with_error(e, ":\n  * ", g_strdup_printf("Unknown command '%s' encountered, use \'audtool help\' for a command list.", argv[1]));
 
+	audtool_disconnect();
+
 	return 0;
 }