+ return DBUS_HANDLER_RESULT_HANDLED;
+}
+
+
+static void
+path_unregistered_func (DBusConnection *connection,
+ void *user_data)
+{
+ /* connection was finalized */
+}
+
+static DBusHandlerResult
+path_message_func (DBusConnection *connection,
+ DBusMessage *message,
+ void *user_data)
+{
+ if (dbus_message_is_method_call (message,
+ "org.freedesktop.TestSuite",
+ "Echo"))
+ return handle_echo (connection, message);
+ else if (dbus_message_is_method_call (message,
+ "org.freedesktop.TestSuite",
+ "DelayEcho"))
+ return handle_delay_echo (connection, message);
+ else if (dbus_message_is_method_call (message,
+ "org.freedesktop.TestSuite",
+ "Exit"))
+ {
+ quit ();
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+ else if (dbus_message_is_method_call (message,
+ "org.freedesktop.TestSuite",
+ "EmitFoo"))
+ {
+ /* Emit the Foo signal */
+ DBusMessage *signal;
+ double v_DOUBLE;
+
+ _dbus_verbose ("emitting signal Foo\n");
+
+ signal = dbus_message_new_signal ("/org/freedesktop/TestSuite",
+ "org.freedesktop.TestSuite",
+ "Foo");
+ if (signal == NULL)
+ die ("No memory\n");
+
+ v_DOUBLE = 42.6;
+ if (!dbus_message_append_args (signal,
+ DBUS_TYPE_DOUBLE, &v_DOUBLE,
+ DBUS_TYPE_INVALID))
+ die ("No memory");
+
+ if (!dbus_connection_send (connection, signal, NULL))
+ die ("No memory\n");
+
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+
+ else if (dbus_message_is_method_call (message,
+ "org.freedesktop.TestSuite",
+ "RunHelloFromSelf"))
+ {
+ return handle_run_hello_from_self (connection, message);
+ }
+ else if (dbus_message_is_method_call (message,
+ "org.freedesktop.TestSuite",
+ "HelloFromSelf"))
+ {
+ DBusMessage *reply;
+ printf ("Received the HelloFromSelf message\n");
+
+ reply = dbus_message_new_method_return (message);
+ if (reply == NULL)
+ die ("No memory");
+
+ if (!dbus_connection_send (connection, reply, NULL))
+ die ("No memory");
+
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+ else
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+}
+
+static DBusObjectPathVTable
+echo_vtable = {
+ path_unregistered_func,
+ path_message_func,
+ NULL,
+};
+
+
+static const char* echo_path = "/org/freedesktop/TestSuite" ;
+
+static DBusHandlerResult
+filter_func (DBusConnection *connection,
+ DBusMessage *message,
+ void *user_data)
+{
+ if (dbus_message_is_signal (message,
+ DBUS_INTERFACE_LOCAL,
+ "Disconnected"))
+ {
+ quit ();
+ return DBUS_HANDLER_RESULT_HANDLED;
+ }
+ else
+ {
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }