From 73e0edc9e6fbcf14648e86169bd45a6d2f33dea2 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 6 Sep 2013 13:16:02 +0100 Subject: [PATCH 03/19] tube examples: use g_message(), not g_debug() g_debug() is invisible unless you set G_MESSAGES_DEBUG, which is unhelpful when smoke-testing example code. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54061 --- examples/client/dbus-tubes/accepter.c | 24 ++++++++++++------------ examples/client/dbus-tubes/offerer.c | 14 +++++++------- examples/client/stream-tubes/accepter.c | 22 +++++++++++----------- examples/client/stream-tubes/offerer.c | 24 ++++++++++++------------ 4 files changed, 42 insertions(+), 42 deletions(-) diff --git a/examples/client/dbus-tubes/accepter.c b/examples/client/dbus-tubes/accepter.c index c12f24d..2f2dae5 100644 --- a/examples/client/dbus-tubes/accepter.c +++ b/examples/client/dbus-tubes/accepter.c @@ -13,11 +13,11 @@ dbus_connection_closed_cb ( gpointer user_data) { if (remote_peer_vanished) - g_debug ("remote peer disconnected: %s", error->message); + g_message ("remote peer disconnected: %s", error->message); else if (error != NULL) - g_debug ("remote peer sent broken data: %s", error->message); + g_message ("remote peer sent broken data: %s", error->message); else - g_debug ("supposedly we closed the connection locally?!"); + g_message ("supposedly we closed the connection locally?!"); g_object_unref (connection); } @@ -37,7 +37,7 @@ lucky_number_cb ( guint32 x; g_variant_get (parameters, "(u)", &x); - g_debug ("My lucky number is: %u", x); + g_message ("My lucky number is: %u", x); } else { @@ -63,7 +63,7 @@ add_cb ( gint32 value; g_variant_get (ret, "(i)", &value); - g_debug ("Adding my numbers together gave: %i", value); + g_message ("Adding my numbers together gave: %i", value); g_variant_unref (ret); } else @@ -85,13 +85,13 @@ tube_accepted (GObject *tube, TP_DBUS_TUBE_CHANNEL (tube), res, &error); if (conn == NULL) { - g_debug ("Failed to accept tube: %s", error->message); + g_message ("Failed to accept tube: %s", error->message); g_error_free (error); tp_channel_close_async (TP_CHANNEL (tube), NULL, NULL); return; } - g_debug ("tube accepted"); + g_message ("tube accepted"); g_signal_connect (conn, "closed", G_CALLBACK (dbus_connection_closed_cb), NULL); @@ -126,7 +126,7 @@ tube_invalidated_cb (TpStreamTubeChannel *tube, gchar *message, gpointer user_data) { - g_debug ("Tube has been invalidated: %s", message); + g_message ("Tube has been invalidated: %s", message); g_main_loop_quit (loop); g_object_unref (tube); } @@ -146,7 +146,7 @@ handle_channels (TpSimpleHandler *handler, GError error = { TP_ERROR, TP_ERROR_NOT_AVAILABLE, "No channel to be handled" }; - g_debug ("Handling channels"); + g_message ("Handling channels"); for (l = channels; l != NULL; l = l->next) { @@ -159,7 +159,7 @@ handle_channels (TpSimpleHandler *handler, EXAMPLE_SERVICE_NAME)) continue; - g_debug ("Accepting tube"); + g_message ("Accepting tube"); tube = g_object_ref (channel); @@ -172,7 +172,7 @@ handle_channels (TpSimpleHandler *handler, return; } - g_debug ("Rejecting channels"); + g_message ("Rejecting channels"); tp_handle_channels_context_fail (context, &error); } @@ -209,7 +209,7 @@ main (int argc, tp_base_client_register (handler, &error); g_assert_no_error (error); - g_debug ("Waiting for tube offer"); + g_message ("Waiting for tube offer"); loop = g_main_loop_new (NULL, FALSE); g_main_loop_run (loop); diff --git a/examples/client/dbus-tubes/offerer.c b/examples/client/dbus-tubes/offerer.c index 70d9103..2e4807b 100644 --- a/examples/client/dbus-tubes/offerer.c +++ b/examples/client/dbus-tubes/offerer.c @@ -21,7 +21,7 @@ connection_closed_cb ( } else { - g_debug ("Connection closed."); + g_message ("Connection closed."); } tp_channel_close_async (TP_CHANNEL (user_data), NULL, NULL); @@ -126,13 +126,13 @@ tube_offered (GObject *tube, &error); if (conn == NULL) { - g_debug ("Failed to offer tube: %s", error->message); + g_message ("Failed to offer tube: %s", error->message); g_error_free (error); tp_channel_close_async (TP_CHANNEL (tube), NULL, NULL); return; } - g_debug ("Tube opened"); + g_message ("Tube opened"); register_object (conn, TP_DBUS_TUBE_CHANNEL (tube)); } @@ -143,7 +143,7 @@ tube_invalidated_cb (TpStreamTubeChannel *tube, gchar *message, gpointer user_data) { - g_debug ("Tube has been invalidated: %s", message); + g_message ("Tube has been invalidated: %s", message); g_main_loop_quit (loop); g_object_unref (tube); } @@ -161,13 +161,13 @@ channel_created (GObject *source, TP_ACCOUNT_CHANNEL_REQUEST (source), result, NULL, &error); if (channel == NULL) { - g_debug ("Failed to create channel: %s", error->message); + g_message ("Failed to create channel: %s", error->message); g_error_free (error); g_main_loop_quit (loop); return; } - g_debug ("Channel created: %s", tp_proxy_get_object_path (channel)); + g_message ("Channel created: %s", tp_proxy_get_object_path (channel)); tube = TP_DBUS_TUBE_CHANNEL (channel); @@ -223,7 +223,7 @@ main (int argc, NULL); - g_debug ("Offer channel to %s", argv[2]); + g_message ("Offer channel to %s", argv[2]); req = tp_account_channel_request_new (account, request, TP_USER_ACTION_TIME_CURRENT_TIME); diff --git a/examples/client/stream-tubes/accepter.c b/examples/client/stream-tubes/accepter.c index e33d3bf..574173a 100644 --- a/examples/client/stream-tubes/accepter.c +++ b/examples/client/stream-tubes/accepter.c @@ -9,7 +9,7 @@ tube_conn_closed_cb (TpStreamTubeConnection *conn, const GError *error, gpointer user_data) { - g_debug ("Tube connection has been closed: %s", error->message); + g_message ("Tube connection has been closed: %s", error->message); } static void @@ -33,7 +33,7 @@ _tube_accepted (GObject *tube, if (error != NULL) { - g_debug ("Can't accept the tube: %s", error->message); + g_message ("Can't accept the tube: %s", error->message); tp_handle_channels_context_fail (context, error); g_error_free (error); return; @@ -42,7 +42,7 @@ _tube_accepted (GObject *tube, tp_handle_channels_context_accept (context); g_object_unref (context); - g_debug ("Tube open, have IOStream"); + g_message ("Tube open, have IOStream"); conn = tp_stream_tube_connection_get_socket_connection (tube_conn); @@ -50,14 +50,14 @@ _tube_accepted (GObject *tube, out = g_io_stream_get_output_stream (G_IO_STREAM (conn)); /* this bit is not a good example */ - g_debug ("Sending: Ping"); + g_message ("Sending: Ping"); g_output_stream_write (out, "Ping\n", 5, NULL, &error); g_assert_no_error (error); g_input_stream_read (in, &buf, sizeof (buf), NULL, &error); g_assert_no_error (error); - g_debug ("Received: %s", buf); + g_message ("Received: %s", buf); g_object_unref (tube_conn); } @@ -69,7 +69,7 @@ tube_invalidated_cb (TpStreamTubeChannel *tube, gchar *message, gpointer user_data) { - g_debug ("Tube has been invalidated: %s", message); + g_message ("Tube has been invalidated: %s", message); g_main_loop_quit (loop); } @@ -86,7 +86,7 @@ _handle_channels (TpSimpleHandler *handler, gboolean delay = FALSE; GList *l; - g_debug ("Handling channels"); + g_message ("Handling channels"); for (l = channels; l != NULL; l = l->next) { @@ -95,7 +95,7 @@ _handle_channels (TpSimpleHandler *handler, if (!TP_IS_STREAM_TUBE_CHANNEL (tube)) continue; - g_debug ("Accepting tube"); + g_message ("Accepting tube"); g_signal_connect (tube, "invalidated", G_CALLBACK (tube_invalidated_cb), NULL); @@ -107,7 +107,7 @@ _handle_channels (TpSimpleHandler *handler, if (delay) { - g_debug ("Delaying channel acceptance"); + g_message ("Delaying channel acceptance"); tp_handle_channels_context_delay (context); g_object_ref (context); @@ -116,7 +116,7 @@ _handle_channels (TpSimpleHandler *handler, { GError *error; - g_debug ("Rejecting channels"); + g_message ("Rejecting channels"); error = g_error_new (TP_ERROR, TP_ERROR_NOT_AVAILABLE, "No channels to be handled"); @@ -159,7 +159,7 @@ main (int argc, tp_base_client_register (handler, &error); g_assert_no_error (error); - g_debug ("Waiting for tube offer"); + g_message ("Waiting for tube offer"); loop = g_main_loop_new (NULL, FALSE); g_main_loop_run (loop); diff --git a/examples/client/stream-tubes/offerer.c b/examples/client/stream-tubes/offerer.c index d6361b0..8d62da3 100644 --- a/examples/client/stream-tubes/offerer.c +++ b/examples/client/stream-tubes/offerer.c @@ -14,12 +14,12 @@ channel_closed_cb (GObject *object, if (!tp_channel_close_finish (channel, result, &error)) { - g_debug ("Failed to close tube channel: %s", error->message); + g_message ("Failed to close tube channel: %s", error->message); g_error_free (error); return; } - g_debug ("Tube channel closed"); + g_message ("Tube channel closed"); } static void @@ -27,7 +27,7 @@ tube_conn_closed_cb (TpStreamTubeConnection *conn, const GError *error, gpointer user_data) { - g_debug ("Tube connection has been closed: %s", error->message); + g_message ("Tube connection has been closed: %s", error->message); } static void @@ -47,7 +47,7 @@ _incoming_iostream (TpStreamTubeChannel *tube, contact = tp_stream_tube_connection_get_contact (tube_conn); - g_debug ("Got IOStream from %s", + g_message ("Got IOStream from %s", tp_contact_get_identifier (contact)); conn = tp_stream_tube_connection_get_socket_connection (tube_conn); @@ -58,9 +58,9 @@ _incoming_iostream (TpStreamTubeChannel *tube, /* this bit is not a good example */ g_input_stream_read (in, &buf, sizeof (buf), NULL, &error); g_assert_no_error (error); - g_debug ("Received: %s", buf); + g_message ("Received: %s", buf); - g_debug ("Sending: Pong"); + g_message ("Sending: Pong"); g_output_stream_write (out, "Pong\n", 5, NULL, &error); g_assert_no_error (error); @@ -78,13 +78,13 @@ _tube_offered (GObject *tube, if (!tp_stream_tube_channel_offer_finish (TP_STREAM_TUBE_CHANNEL (tube), res, &error)) { - g_debug ("Failed to offer tube: %s", error->message); + g_message ("Failed to offer tube: %s", error->message); g_error_free (error); return; } - g_debug ("Tube offered"); + g_message ("Tube offered"); } static void @@ -94,7 +94,7 @@ tube_invalidated_cb (TpStreamTubeChannel *tube, gchar *message, gpointer user_data) { - g_debug ("Tube has been invalidated: %s", message); + g_message ("Tube has been invalidated: %s", message); g_main_loop_quit (loop); } @@ -111,13 +111,13 @@ _channel_created (GObject *source, TP_ACCOUNT_CHANNEL_REQUEST (source), result, NULL, &error); if (channel == NULL) { - g_debug ("Failed to create channel: %s", error->message); + g_message ("Failed to create channel: %s", error->message); g_error_free (error); return; } - g_debug ("Channel created: %s", tp_proxy_get_object_path (channel)); + g_message ("Channel created: %s", tp_proxy_get_object_path (channel)); tube = TP_STREAM_TUBE_CHANNEL (channel); @@ -175,7 +175,7 @@ main (int argc, NULL); - g_debug ("Offer channel to %s", argv[2]); + g_message ("Offer channel to %s", argv[2]); req = tp_account_channel_request_new (account, request, TP_USER_ACTION_TIME_CURRENT_TIME); -- 1.8.4.rc3