[virt-tools-list] [PATCH virt-viewer 2/3] Replace DEBUG_LOG with g_debug
Marc-André Lureau
marcandre.lureau at gmail.com
Tue Jun 10 15:40:02 UTC 2014
---
src/remote-viewer.c | 6 +++---
src/virt-viewer-app.c | 24 ++++++++++-----------
src/virt-viewer-display-vnc.c | 2 +-
src/virt-viewer-display.c | 6 +++---
src/virt-viewer-events.c | 28 ++++++++++++------------
src/virt-viewer-notebook.c | 6 +++---
src/virt-viewer-session-spice.c | 48 ++++++++++++++++++++---------------------
src/virt-viewer-session-vnc.c | 16 +++++++-------
src/virt-viewer-util.h | 1 -
src/virt-viewer-window.c | 12 +++++------
src/virt-viewer.c | 38 ++++++++++++++++----------------
11 files changed, 93 insertions(+), 94 deletions(-)
diff --git a/src/remote-viewer.c b/src/remote-viewer.c
index 7e8bcc8..85a794b 100644
--- a/src/remote-viewer.c
+++ b/src/remote-viewer.c
@@ -408,7 +408,7 @@ spice_ctrl_menu_updated(RemoteViewer *self)
{
GHashTable *windows = virt_viewer_app_get_windows(VIRT_VIEWER_APP(self));
- DEBUG_LOG("Spice controller menu updated");
+ g_debug("Spice controller menu updated");
g_hash_table_foreach(windows, spice_menu_update_each, self);
}
@@ -457,7 +457,7 @@ spice_foreign_menu_updated(RemoteViewer *self)
{
GHashTable *windows = virt_viewer_app_get_windows(VIRT_VIEWER_APP(self));
- DEBUG_LOG("Spice foreign menu updated");
+ g_debug("Spice foreign menu updated");
g_hash_table_foreach(windows, foreign_menu_update_each, self);
}
@@ -1044,7 +1044,7 @@ retry_dialog:
g_return_val_if_fail(guri != NULL, FALSE);
- DEBUG_LOG("Opening display to %s", guri);
+ g_debug("Opening display to %s", guri);
file = g_file_new_for_commandline_arg(guri);
if (g_file_query_exists(file, NULL)) {
diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
index 38c7c57..6cf2747 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -297,7 +297,7 @@ app_window_try_fullscreen(VirtViewerApp *self G_GNUC_UNUSED,
GdkScreen *screen = gdk_screen_get_default();
if (nth >= gdk_screen_get_n_monitors(screen)) {
- DEBUG_LOG("skipping display %d", nth);
+ g_debug("skipping display %d", nth);
return;
}
@@ -313,7 +313,7 @@ void virt_viewer_app_set_uuid_string(VirtViewerApp* self, const gchar* uuid_stri
gint* displays = NULL;
gint nmonitors = gdk_screen_get_n_monitors(gdk_screen_get_default());
- DEBUG_LOG("%s: UUID changed to %s", G_STRFUNC, uuid_string);
+ g_debug("%s: UUID changed to %s", G_STRFUNC, uuid_string);
displays = g_key_file_get_integer_list(self->priv->config,
uuid_string, "monitor-mapping", &ndisplays, &error);
@@ -699,7 +699,7 @@ virt_viewer_app_remove_nth_window(VirtViewerApp *self, gint nth)
win = virt_viewer_app_get_nth_window(self, nth);
g_return_val_if_fail(win != NULL, FALSE);
- DEBUG_LOG("Remove window %d %p", nth, win);
+ g_debug("Remove window %d %p", nth, win);
g_object_ref(win);
removed = g_hash_table_remove(self->priv->windows, &nth);
g_warn_if_fail(removed);
@@ -721,7 +721,7 @@ virt_viewer_app_set_nth_window(VirtViewerApp *self, gint nth, VirtViewerWindow *
g_return_if_fail(virt_viewer_app_get_nth_window(self, nth) == NULL);
key = g_malloc(sizeof(gint));
*key = nth;
- DEBUG_LOG("Insert window %d %p", nth, win);
+ g_debug("Insert window %d %p", nth, win);
g_hash_table_insert(self->priv->windows, key, win);
virt_viewer_app_set_window_subtitle(self, win, nth);
virt_viewer_app_update_menu_displays(self);
@@ -843,7 +843,7 @@ virt_viewer_app_display_added(VirtViewerSession *session G_GNUC_UNUSED,
if (window == NULL) {
if (priv->kiosk) {
/* don't show extra monitors that don't fit on client */
- DEBUG_LOG("kiosk mode: skip extra monitors that don't fit on client");
+ g_debug("kiosk mode: skip extra monitors that don't fit on client");
return;
}
@@ -1001,7 +1001,7 @@ virt_viewer_app_channel_open(VirtViewerSession *session,
if (!virt_viewer_app_open_connection(self, &fd))
return;
- DEBUG_LOG("After open connection callback fd=%d", fd);
+ g_debug("After open connection callback fd=%d", fd);
priv = self->priv;
if (priv->transport && g_ascii_strcasecmp(priv->transport, "ssh") == 0 &&
@@ -1035,7 +1035,7 @@ virt_viewer_app_default_activate(VirtViewerApp *self, GError **error)
if (!virt_viewer_app_open_connection(self, &fd))
return FALSE;
- DEBUG_LOG("After open connection callback fd=%d", fd);
+ g_debug("After open connection callback fd=%d", fd);
#if defined(HAVE_SOCKETPAIR) && defined(HAVE_FORK)
if (priv->transport &&
@@ -1203,7 +1203,7 @@ virt_viewer_app_connect_timer(void *opaque)
VirtViewerApp *self = opaque;
VirtViewerAppPrivate *priv = self->priv;
- DEBUG_LOG("Connect timer fired");
+ g_debug("Connect timer fired");
if (!priv->active &&
virt_viewer_app_initial_connect(self, NULL) < 0)
@@ -1223,7 +1223,7 @@ virt_viewer_app_start_reconnect_poll(VirtViewerApp *self)
g_return_if_fail(VIRT_VIEWER_IS_APP(self));
VirtViewerAppPrivate *priv = self->priv;
- DEBUG_LOG("reconnect_poll: %d", priv->reconnect_poll);
+ g_debug("reconnect_poll: %d", priv->reconnect_poll);
if (priv->reconnect_poll != 0)
return;
@@ -1603,7 +1603,7 @@ virt_viewer_app_init (VirtViewerApp *self)
G_KEY_FILE_KEEP_COMMENTS|G_KEY_FILE_KEEP_TRANSLATIONS, &error);
if (g_error_matches(error, G_FILE_ERROR, G_FILE_ERROR_NOENT))
- DEBUG_LOG("No configuration file %s", self->priv->config_file);
+ g_debug("No configuration file %s", self->priv->config_file);
else if (error)
g_warning("Couldn't load configuration: %s", error->message);
@@ -1983,7 +1983,7 @@ static void fullscreen_cb(gpointer key,
gint nth = virt_viewer_app_get_initial_monitor_for_display(options->app, *(gint*)key);
VirtViewerWindow *vwin = VIRT_VIEWER_WINDOW(value);
- DEBUG_LOG("fullscreen display %d: %d", nth, options->fullscreen);
+ g_debug("fullscreen display %d: %d", nth, options->fullscreen);
if (options->fullscreen)
app_window_try_fullscreen(options->app, vwin, nth);
else
@@ -2152,7 +2152,7 @@ virt_viewer_app_set_connect_info(VirtViewerApp *self,
g_return_if_fail(VIRT_VIEWER_IS_APP(self));
VirtViewerAppPrivate *priv = self->priv;
- DEBUG_LOG("Set connect info: %s,%s,%s,%s,%s,%s,%s,%d",
+ g_debug("Set connect info: %s,%s,%s,%s,%s,%s,%s,%d",
host, ghost, gport, gtlsport ? gtlsport : "-1", transport, unixsock, user, port);
g_free(priv->host);
diff --git a/src/virt-viewer-display-vnc.c b/src/virt-viewer-display-vnc.c
index 3a1cc06..8bf7b80 100644
--- a/src/virt-viewer-display-vnc.c
+++ b/src/virt-viewer-display-vnc.c
@@ -158,7 +158,7 @@ virt_viewer_display_vnc_resize_desktop(VncDisplay *vnc G_GNUC_UNUSED,
int width, int height,
VirtViewerDisplay *display)
{
- DEBUG_LOG("desktop resize %dx%d", width, height);
+ g_debug("desktop resize %dx%d", width, height);
virt_viewer_display_set_desktop_size(display, width, height);
}
diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c
index f298bb0..ac69eca 100644
--- a/src/virt-viewer-display.c
+++ b/src/virt-viewer-display.c
@@ -429,7 +429,7 @@ virt_viewer_display_size_request(GtkWidget *widget,
requisition->height = 50;
}
- DEBUG_LOG("Display size request %dx%d (desktop %dx%d)",
+ g_debug("Display size request %dx%d (desktop %dx%d)",
requisition->width, requisition->height,
priv->desktopWidth, priv->desktopHeight);
}
@@ -512,7 +512,7 @@ virt_viewer_display_size_allocate(GtkWidget *widget,
double actualAspect;
GtkWidget *child = gtk_bin_get_child(bin);
- DEBUG_LOG("Allocated %dx%d", allocation->width, allocation->height);
+ g_debug("Allocated %dx%d", allocation->width, allocation->height);
gtk_widget_set_allocation(widget, allocation);
if (priv->desktopWidth == 0 ||
@@ -543,7 +543,7 @@ virt_viewer_display_size_allocate(GtkWidget *widget,
child_allocation.x = 0.5 * (width - child_allocation.width) + allocation->x + border_width;
child_allocation.y = 0.5 * (height - child_allocation.height) + allocation->y + border_width;
- DEBUG_LOG("Child allocate %dx%d", child_allocation.width, child_allocation.height);
+ g_debug("Child allocate %dx%d", child_allocation.width, child_allocation.height);
gtk_widget_size_allocate(child, &child_allocation);
}
diff --git a/src/virt-viewer-events.c b/src/virt-viewer-events.c
index 6d7fe9e..f7ad3a7 100644
--- a/src/virt-viewer-events.c
+++ b/src/virt-viewer-events.c
@@ -67,7 +67,7 @@ virt_viewer_events_dispatch_handle(GIOChannel *source G_GNUC_UNUSED,
if (condition & G_IO_ERR)
events |= VIR_EVENT_HANDLE_ERROR;
- DEBUG_LOG("Dispatch handler %d %d %p", data->fd, events, data->opaque);
+ g_debug("Dispatch handler %d %d %p", data->fd, events, data->opaque);
(data->cb)(data->watch, data->fd, events, data->opaque);
@@ -100,14 +100,14 @@ int virt_viewer_events_add_handle(int fd,
data->cb = cb;
data->opaque = opaque;
#ifdef G_OS_WIN32
- DEBUG_LOG("Converted fd %d to handle %d", fd, _get_osfhandle(fd));
+ g_debug("Converted fd %d to handle %d", fd, _get_osfhandle(fd));
data->channel = g_io_channel_win32_new_socket(_get_osfhandle(fd));
#else
data->channel = g_io_channel_unix_new(fd);
#endif
data->ff = ff;
- DEBUG_LOG("Add handle %d %d %p", data->fd, events, data->opaque);
+ g_debug("Add handle %d %d %p", data->fd, events, data->opaque);
data->source = g_io_add_watch(data->channel,
cond,
@@ -137,7 +137,7 @@ virt_viewer_events_update_handle(int watch,
struct virt_viewer_events_handle *data = virt_viewer_events_find_handle(watch);
if (!data) {
- DEBUG_LOG("Update for missing handle watch %d", watch);
+ g_debug("Update for missing handle watch %d", watch);
return;
}
@@ -175,7 +175,7 @@ virt_viewer_events_cleanup_handle(gpointer user_data)
{
struct virt_viewer_events_handle *data = user_data;
- DEBUG_LOG("Cleanup of handle %p", data);
+ g_debug("Cleanup of handle %p", data);
g_return_val_if_fail(data != NULL, FALSE);
if (data->ff)
@@ -192,11 +192,11 @@ virt_viewer_events_remove_handle(int watch)
struct virt_viewer_events_handle *data = virt_viewer_events_find_handle(watch);
if (!data) {
- DEBUG_LOG("Remove of missing watch %d", watch);
+ g_debug("Remove of missing watch %d", watch);
return -1;
}
- DEBUG_LOG("Remove handle %d %d", watch, data->fd);
+ g_debug("Remove handle %d %d", watch, data->fd);
if (!data->source)
return -1;
@@ -228,7 +228,7 @@ static gboolean
virt_viewer_events_dispatch_timeout(void *opaque)
{
struct virt_viewer_events_timeout *data = opaque;
- DEBUG_LOG("Dispatch timeout %p %p %d %p", data, data->cb, data->timer, data->opaque);
+ g_debug("Dispatch timeout %p %p %d %p", data, data->cb, data->timer, data->opaque);
(data->cb)(data->timer, data->opaque);
return TRUE;
@@ -258,7 +258,7 @@ virt_viewer_events_add_timeout(int interval,
timeouts[ntimeouts++] = data;
- DEBUG_LOG("Add timeout %p %d %p %p %d", data, interval, cb, opaque, data->timer);
+ g_debug("Add timeout %p %d %p %p %d", data, interval, cb, opaque, data->timer);
return data->timer;
}
@@ -283,11 +283,11 @@ virt_viewer_events_update_timeout(int timer,
struct virt_viewer_events_timeout *data = virt_viewer_events_find_timeout(timer);
if (!data) {
- DEBUG_LOG("Update of missing timer %d", timer);
+ g_debug("Update of missing timer %d", timer);
return;
}
- DEBUG_LOG("Update timeout %p %d %d", data, timer, interval);
+ g_debug("Update timeout %p %d %d", data, timer, interval);
if (interval >= 0) {
if (data->source)
@@ -312,7 +312,7 @@ virt_viewer_events_cleanup_timeout(gpointer user_data)
{
struct virt_viewer_events_timeout *data = user_data;
- DEBUG_LOG("Cleanup of timeout %p", data);
+ g_debug("Cleanup of timeout %p", data);
g_return_val_if_fail(data != NULL, FALSE);
if (data->ff)
@@ -329,11 +329,11 @@ virt_viewer_events_remove_timeout(int timer)
struct virt_viewer_events_timeout *data = virt_viewer_events_find_timeout(timer);
if (!data) {
- DEBUG_LOG("Remove of missing timer %d", timer);
+ g_debug("Remove of missing timer %d", timer);
return -1;
}
- DEBUG_LOG("Remove timeout %p %d", data, timer);
+ g_debug("Remove timeout %p %d", data, timer);
if (!data->source)
return -1;
diff --git a/src/virt-viewer-notebook.c b/src/virt-viewer-notebook.c
index cc7136b..07497e3 100644
--- a/src/virt-viewer-notebook.c
+++ b/src/virt-viewer-notebook.c
@@ -98,7 +98,7 @@ virt_viewer_notebook_show_status_va(VirtViewerNotebook *self, const gchar *fmt,
VirtViewerNotebookPrivate *priv;
gchar *text;
- DEBUG_LOG("notebook show status %p", self);
+ g_debug("notebook show status %p", self);
g_return_if_fail(VIRT_VIEWER_IS_NOTEBOOK(self));
text = g_strdup_vprintf(fmt, args);
@@ -126,12 +126,12 @@ virt_viewer_notebook_show_display(VirtViewerNotebook *self)
{
GtkWidget *display;
- DEBUG_LOG("notebook show display %p", self);
+ g_debug("notebook show display %p", self);
g_return_if_fail(VIRT_VIEWER_IS_NOTEBOOK(self));
display = gtk_notebook_get_nth_page(GTK_NOTEBOOK(self), 1);
if (display == NULL)
- DEBUG_LOG("FIXME: showing display although it's not ready yet");
+ g_debug("FIXME: showing display although it's not ready yet");
else
gtk_widget_grab_focus(display);
diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c
index 2712514..1820784 100644
--- a/src/virt-viewer-session-spice.c
+++ b/src/virt-viewer-session-spice.c
@@ -415,7 +415,7 @@ fill_session(VirtViewerFile *file, SpiceSession *session)
}
if (virt_viewer_file_is_set(file, "disable-channels")) {
- DEBUG_LOG("FIXME: disable-channels is not supported atm");
+ g_debug("FIXME: disable-channels is not supported atm");
}
}
@@ -485,21 +485,21 @@ virt_viewer_session_spice_main_channel_event(SpiceChannel *channel G_GNUC_UNUSED
switch (event) {
case SPICE_CHANNEL_OPENED:
- DEBUG_LOG("main channel: opened");
+ g_debug("main channel: opened");
g_signal_emit_by_name(session, "session-connected");
break;
case SPICE_CHANNEL_CLOSED:
- DEBUG_LOG("main channel: closed");
+ g_debug("main channel: closed");
/* Ensure the other channels get closed too */
virt_viewer_session_clear_displays(session);
if (self->priv->session)
spice_session_disconnect(self->priv->session);
break;
case SPICE_CHANNEL_SWITCHING:
- DEBUG_LOG("main channel: switching host");
+ g_debug("main channel: switching host");
break;
case SPICE_CHANNEL_ERROR_AUTH:
- DEBUG_LOG("main channel: auth failure (wrong password?)");
+ g_debug("main channel: auth failure (wrong password?)");
if (self->priv->pass_try > 0)
g_signal_emit_by_name(session, "session-auth-failed",
@@ -529,7 +529,7 @@ virt_viewer_session_spice_main_channel_event(SpiceChannel *channel G_GNUC_UNUSED
{
const GError *error = spice_channel_get_error(channel);
- DEBUG_LOG("main channel: failed to connect %s", error ? error->message : "");
+ g_debug("main channel: failed to connect %s", error ? error->message : "");
if (g_error_matches(error, G_IO_ERROR, G_IO_ERROR_PROXY_NEED_AUTH) ||
g_error_matches(error, G_IO_ERROR, G_IO_ERROR_PROXY_AUTH_FAILED)) {
@@ -551,7 +551,7 @@ virt_viewer_session_spice_main_channel_event(SpiceChannel *channel G_GNUC_UNUSED
}
}
#else
- DEBUG_LOG("main channel: failed to connect");
+ g_debug("main channel: failed to connect");
g_signal_emit_by_name(session, "session-disconnected");
#endif
break;
@@ -626,7 +626,7 @@ destroy_display(gpointer data)
VirtViewerDisplay *display = VIRT_VIEWER_DISPLAY(data);
VirtViewerSession *session = virt_viewer_display_get_session(display);
- DEBUG_LOG("Destroying spice display %p", display);
+ g_debug("Destroying spice display %p", display);
virt_viewer_session_remove_display(session, display);
g_object_unref(display);
}
@@ -662,7 +662,7 @@ virt_viewer_session_spice_display_monitors(SpiceChannel *channel,
display = g_ptr_array_index(displays, i);
if (display == NULL) {
display = virt_viewer_display_spice_new(self, channel, i);
- DEBUG_LOG("creating spice display (#:%d)", i);
+ g_debug("creating spice display (#:%d)", i);
g_ptr_array_index(displays, i) = g_object_ref(display);
}
@@ -702,7 +702,7 @@ virt_viewer_session_spice_channel_new(SpiceSession *s,
g_object_get(channel, "channel-id", &id, NULL);
- DEBUG_LOG("New spice channel %p %s %d", channel, g_type_name(G_OBJECT_TYPE(channel)), id);
+ g_debug("New spice channel %p %s %d", channel, g_type_name(G_OBJECT_TYPE(channel)), id);
if (SPICE_IS_MAIN_CHANNEL(channel)) {
if (self->priv->main_channel != NULL)
@@ -730,17 +730,17 @@ virt_viewer_session_spice_channel_new(SpiceSession *s,
}
if (SPICE_IS_INPUTS_CHANNEL(channel)) {
- DEBUG_LOG("new inputs channel");
+ g_debug("new inputs channel");
}
if (SPICE_IS_PLAYBACK_CHANNEL(channel)) {
- DEBUG_LOG("new audio channel");
+ g_debug("new audio channel");
if (self->priv->audio == NULL)
self->priv->audio = spice_audio_get(s, NULL);
}
if (SPICE_IS_USBREDIR_CHANNEL(channel)) {
- DEBUG_LOG("new usbredir channel");
+ g_debug("new usbredir channel");
self->priv->usbredir_channel_count++;
if (spice_usb_device_manager_get(self->priv->session, NULL))
virt_viewer_session_set_has_usbredir(session, TRUE);
@@ -771,7 +771,7 @@ virt_viewer_session_spice_fullscreen_auto_conf(VirtViewerSessionSpice *self)
/* only do auto-conf once at startup. Avoid repeating auto-conf later due to
* agent disconnection/re-connection, etc */
if (self->priv->did_auto_conf) {
- DEBUG_LOG("Already did auto-conf, skipping");
+ g_debug("Already did auto-conf, skipping");
return FALSE;
}
@@ -779,16 +779,16 @@ virt_viewer_session_spice_fullscreen_auto_conf(VirtViewerSessionSpice *self)
g_return_val_if_fail(VIRT_VIEWER_IS_APP(app), TRUE);
if (!virt_viewer_app_get_fullscreen(app)) {
- DEBUG_LOG("app is not in full screen");
+ g_debug("app is not in full screen");
return FALSE;
}
if (cmain == NULL) {
- DEBUG_LOG("no main channel yet");
+ g_debug("no main channel yet");
return FALSE;
}
g_object_get(cmain, "agent-connected", &agent_connected, NULL);
if (!agent_connected) {
- DEBUG_LOG("Agent not connected, skipping autoconf");
+ g_debug("Agent not connected, skipping autoconf");
g_signal_connect(cmain, "notify::agent-connected", G_CALLBACK(property_notify_do_auto_conf), self);
return FALSE;
}
@@ -796,12 +796,12 @@ virt_viewer_session_spice_fullscreen_auto_conf(VirtViewerSessionSpice *self)
spice_main_set_display_enabled(cmain, -1, FALSE);
ndisplays = virt_viewer_app_get_n_initial_displays(app);
- DEBUG_LOG("Performing full screen auto-conf, %" G_GSIZE_FORMAT " host monitors", ndisplays);
+ g_debug("Performing full screen auto-conf, %" G_GSIZE_FORMAT " host monitors", ndisplays);
for (i = 0; i < ndisplays; i++) {
gint j = virt_viewer_app_get_initial_monitor_for_display(app, i);
gdk_screen_get_monitor_geometry(screen, j, &dest);
- DEBUG_LOG("Set SPICE display %d to (%d,%d)-(%dx%d)",
+ g_debug("Set SPICE display %d to (%d,%d)-(%dx%d)",
i, dest.x, dest.y, dest.width, dest.height);
spice_main_set_display(cmain, i, dest.x, dest.y, dest.width, dest.height);
spice_main_set_display_enabled(cmain, i, TRUE);
@@ -823,26 +823,26 @@ virt_viewer_session_spice_channel_destroy(G_GNUC_UNUSED SpiceSession *s,
g_return_if_fail(self != NULL);
g_object_get(channel, "channel-id", &id, NULL);
- DEBUG_LOG("Destroy SPICE channel %s %d", g_type_name(G_OBJECT_TYPE(channel)), id);
+ g_debug("Destroy SPICE channel %s %d", g_type_name(G_OBJECT_TYPE(channel)), id);
if (SPICE_IS_MAIN_CHANNEL(channel)) {
- DEBUG_LOG("zap main channel");
+ g_debug("zap main channel");
if (channel == SPICE_CHANNEL(self->priv->main_channel))
self->priv->main_channel = NULL;
}
if (SPICE_IS_DISPLAY_CHANNEL(channel)) {
- DEBUG_LOG("zap display channel (#%d)", id);
+ g_debug("zap display channel (#%d)", id);
g_object_set_data(G_OBJECT(channel), "virt-viewer-displays", NULL);
}
if (SPICE_IS_PLAYBACK_CHANNEL(channel) && self->priv->audio) {
- DEBUG_LOG("zap audio channel");
+ g_debug("zap audio channel");
self->priv->audio = NULL;
}
if (SPICE_IS_USBREDIR_CHANNEL(channel)) {
- DEBUG_LOG("zap usbredir channel");
+ g_debug("zap usbredir channel");
self->priv->usbredir_channel_count--;
if (self->priv->usbredir_channel_count == 0)
virt_viewer_session_set_has_usbredir(session, FALSE);
diff --git a/src/virt-viewer-session-vnc.c b/src/virt-viewer-session-vnc.c
index 746e1c0..37e66c5 100644
--- a/src/virt-viewer-session-vnc.c
+++ b/src/virt-viewer-session-vnc.c
@@ -112,7 +112,7 @@ virt_viewer_session_vnc_disconnected(VncDisplay *vnc G_GNUC_UNUSED,
virt_viewer_session_clear_displays(VIRT_VIEWER_SESSION(session));
display = virt_viewer_display_vnc_new(session->priv->vnc);
- DEBUG_LOG("Disconnected");
+ g_debug("Disconnected");
g_signal_emit_by_name(session, "session-disconnected");
virt_viewer_display_set_show_hint(VIRT_VIEWER_DISPLAY(display),
VIRT_VIEWER_DISPLAY_SHOW_HINT_READY, FALSE);
@@ -261,7 +261,7 @@ virt_viewer_session_vnc_auth_credential(GtkWidget *src G_GNUC_UNUSED,
gboolean wantPassword = FALSE, wantUsername = FALSE;
int i;
- DEBUG_LOG("Got VNC credential request for %d credential(s)", credList->n_values);
+ g_debug("Got VNC credential request for %d credential(s)", credList->n_values);
for (i = 0 ; i < credList->n_values ; i++) {
GValue *cred = g_value_array_get_nth(credList, i);
@@ -275,7 +275,7 @@ virt_viewer_session_vnc_auth_credential(GtkWidget *src G_GNUC_UNUSED,
case VNC_DISPLAY_CREDENTIAL_CLIENTNAME:
break;
default:
- DEBUG_LOG("Unsupported credential type %d", g_value_get_enum(cred));
+ g_debug("Unsupported credential type %d", g_value_get_enum(cred));
vnc_display_close(self->priv->vnc);
goto cleanup;
}
@@ -313,7 +313,7 @@ virt_viewer_session_vnc_auth_credential(GtkWidget *src G_GNUC_UNUSED,
vnc_display_set_credential(self->priv->vnc,
g_value_get_enum(cred),
username)) {
- DEBUG_LOG("Failed to set credential type %d", g_value_get_enum(cred));
+ g_debug("Failed to set credential type %d", g_value_get_enum(cred));
vnc_display_close(self->priv->vnc);
}
break;
@@ -322,7 +322,7 @@ virt_viewer_session_vnc_auth_credential(GtkWidget *src G_GNUC_UNUSED,
vnc_display_set_credential(self->priv->vnc,
g_value_get_enum(cred),
password)) {
- DEBUG_LOG("Failed to set credential type %d", g_value_get_enum(cred));
+ g_debug("Failed to set credential type %d", g_value_get_enum(cred));
vnc_display_close(self->priv->vnc);
}
break;
@@ -330,12 +330,12 @@ virt_viewer_session_vnc_auth_credential(GtkWidget *src G_GNUC_UNUSED,
if (vnc_display_set_credential(self->priv->vnc,
g_value_get_enum(cred),
"libvirt")) {
- DEBUG_LOG("Failed to set credential type %d", g_value_get_enum(cred));
+ g_debug("Failed to set credential type %d", g_value_get_enum(cred));
vnc_display_close(self->priv->vnc);
}
break;
default:
- DEBUG_LOG("Unsupported credential type %d", g_value_get_enum(cred));
+ g_debug("Unsupported credential type %d", g_value_get_enum(cred));
vnc_display_close(self->priv->vnc);
}
}
@@ -353,7 +353,7 @@ virt_viewer_session_vnc_close(VirtViewerSession* session)
g_return_if_fail(self != NULL);
- DEBUG_LOG("close vnc=%p", self->priv->vnc);
+ g_debug("close vnc=%p", self->priv->vnc);
if (self->priv->vnc != NULL) {
virt_viewer_session_clear_displays(session);
vnc_display_close(self->priv->vnc);
diff --git a/src/virt-viewer-util.h b/src/virt-viewer-util.h
index 8157df5..4f40116 100644
--- a/src/virt-viewer-util.h
+++ b/src/virt-viewer-util.h
@@ -32,7 +32,6 @@ enum {
VIRT_VIEWER_ERROR_FAILED,
};
-#define DEBUG_LOG(s, ...) do { if (doDebug) g_debug(s, ## __VA_ARGS__); } while (0)
#define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array))
#define VIRT_VIEWER_ERROR virt_viewer_error_quark ()
diff --git a/src/virt-viewer-window.c b/src/virt-viewer-window.c
index 6f6f9a4..a7ac120 100644
--- a/src/virt-viewer-window.c
+++ b/src/virt-viewer-window.c
@@ -169,7 +169,7 @@ virt_viewer_window_dispose (GObject *object)
priv->display = NULL;
}
- DEBUG_LOG("Disposing window %p\n", object);
+ g_debug("Disposing window %p\n", object);
if (priv->window) {
gtk_widget_destroy(priv->window);
@@ -412,9 +412,9 @@ virt_viewer_window_resize(VirtViewerWindow *self, gboolean keep_win_size)
if (priv->fullscreen)
return;
- DEBUG_LOG("Preparing main window resize");
+ g_debug("Preparing main window resize");
if (!priv->display) {
- DEBUG_LOG("Skipping inactive resize");
+ g_debug("Skipping inactive resize");
return;
}
@@ -449,7 +449,7 @@ virt_viewer_window_resize(VirtViewerWindow *self, gboolean keep_win_size)
height = desktopHeight;
}
- DEBUG_LOG("Decided todo %dx%d (desktop is %dx%d, fullscreen is %dx%d",
+ g_debug("Decided todo %dx%d (desktop is %dx%d, fullscreen is %dx%d",
width, height, desktopWidth, desktopHeight,
fullscreen.width, fullscreen.height);
@@ -804,7 +804,7 @@ virt_viewer_window_delete(GtkWidget *src G_GNUC_UNUSED,
void *dummy G_GNUC_UNUSED,
VirtViewerWindow *self)
{
- DEBUG_LOG("Window closed");
+ g_debug("Window closed");
virt_viewer_app_maybe_quit(self->priv->app, self);
return TRUE;
}
@@ -1147,7 +1147,7 @@ virt_viewer_window_update_title(VirtViewerWindow *self)
gtk_accel_map_lookup_entry("<virt-viewer>/view/release-cursor", &key);
if (key.accel_key || key.accel_mods) {
- DEBUG_LOG("release-cursor accel key: key=%u, mods=%x, flags=%u", key.accel_key, key.accel_mods, key.accel_flags);
+ g_debug("release-cursor accel key: key=%u, mods=%x, flags=%u", key.accel_key, key.accel_mods, key.accel_flags);
label = gtk_accelerator_get_label(key.accel_key, key.accel_mods);
} else {
label = g_strdup(_("Ctrl+Alt"));
diff --git a/src/virt-viewer.c b/src/virt-viewer.c
index 6ff3f86..4593a11 100644
--- a/src/virt-viewer.c
+++ b/src/virt-viewer.c
@@ -126,7 +126,7 @@ virt_viewer_deactivated(VirtViewerApp *app, gboolean connect_error)
if (priv->reconnect) {
if (!priv->withEvents) {
- DEBUG_LOG("No domain events, falling back to polling");
+ g_debug("No domain events, falling back to polling");
virt_viewer_app_start_reconnect_poll(app);
}
@@ -345,9 +345,9 @@ virt_viewer_extract_connect_info(VirtViewer *self,
}
if (ghost && gport)
- DEBUG_LOG("Guest graphics address is %s:%s", ghost, gport);
+ g_debug("Guest graphics address is %s:%s", ghost, gport);
else if (unixsock)
- DEBUG_LOG("Guest graphics address is %s", unixsock);
+ g_debug("Guest graphics address is %s", unixsock);
uri = virConnectGetURI(priv->conn);
if (virt_viewer_util_extract_host(uri, NULL, &host, &transport, &user, &port) < 0) {
@@ -371,7 +371,7 @@ virt_viewer_extract_connect_info(VirtViewer *self,
} else {
replacement_host = g_strdup(host);
}
- DEBUG_LOG("Guest graphics listen '%s' is NULL or a wildcard, replacing with '%s'",
+ g_debug("Guest graphics listen '%s' is NULL or a wildcard, replacing with '%s'",
ghost ? ghost : "", replacement_host);
g_free(ghost);
ghost = replacement_host;
@@ -439,7 +439,7 @@ virt_viewer_open_connection(VirtViewerApp *self G_GNUC_UNUSED, int *fd)
if (virDomainOpenGraphics(priv->dom, 0, pair[0],
VIR_DOMAIN_OPEN_GRAPHICS_SKIPAUTH) < 0) {
virErrorPtr err = virGetLastError();
- DEBUG_LOG("Error %s", err && err->message ? err->message : "Unknown");
+ g_debug("Error %s", err && err->message ? err->message : "Unknown");
close(pair[0]);
close(pair[1]);
return TRUE;
@@ -461,7 +461,7 @@ virt_viewer_domain_event(virConnectPtr conn G_GNUC_UNUSED,
VirtViewerApp *app = VIRT_VIEWER_APP(self);
GError *error = NULL;
- DEBUG_LOG("Got domain event %d %d", event, detail);
+ g_debug("Got domain event %d %d", event, detail);
if (!virt_viewer_matches_domain(self, dom))
return 0;
@@ -495,7 +495,7 @@ virt_viewer_conn_event(virConnectPtr conn G_GNUC_UNUSED,
VirtViewerApp *app = VIRT_VIEWER_APP(self);
VirtViewerPrivate *priv = self->priv;
- DEBUG_LOG("Got connection event %d", reason);
+ g_debug("Got connection event %d", reason);
virConnectClose(priv->conn);
priv->conn = NULL;
@@ -533,7 +533,7 @@ virt_viewer_initial_connect(VirtViewerApp *app, GError **error)
VirtViewerPrivate *priv = self->priv;
char uuid_string[VIR_UUID_STRING_BUFLEN];
- DEBUG_LOG("initial connect");
+ g_debug("initial connect");
if (!priv->conn &&
virt_viewer_connect(app) < 0) {
@@ -552,20 +552,20 @@ virt_viewer_initial_connect(VirtViewerApp *app, GError **error)
} else {
virt_viewer_app_simple_message_dialog(app, _("Cannot find guest domain %s"),
priv->domkey);
- DEBUG_LOG("Cannot find guest %s", priv->domkey);
+ g_debug("Cannot find guest %s", priv->domkey);
goto cleanup;
}
}
if (virDomainGetUUIDString(dom, uuid_string) < 0) {
- DEBUG_LOG("Couldn't get uuid from libvirt");
+ g_debug("Couldn't get uuid from libvirt");
} else {
virt_viewer_app_set_uuid_string(app, uuid_string);
}
virt_viewer_app_show_status(app, _("Checking guest domain status"));
if (virDomainGetInfo(dom, &info) < 0) {
- DEBUG_LOG("Cannot get guest state");
+ g_debug("Cannot get guest state");
goto cleanup;
}
@@ -581,7 +581,7 @@ virt_viewer_initial_connect(VirtViewerApp *app, GError **error)
virt_viewer_app_trace(app, "Guest %s has not activated its display yet, waiting for it to start",
priv->domkey);
} else {
- DEBUG_LOG("Failed to activate viewer");
+ g_debug("Failed to activate viewer");
goto cleanup;
}
}
@@ -614,7 +614,7 @@ virt_viewer_auth_libvirt_credentials(virConnectCredentialPtr cred,
int i;
int ret = -1;
- DEBUG_LOG("Got libvirt credential request for %d credential(s)", ncred);
+ g_debug("Got libvirt credential request for %d credential(s)", ncred);
for (i = 0 ; i < ncred ; i++) {
switch (cred[i].type) {
@@ -626,7 +626,7 @@ virt_viewer_auth_libvirt_credentials(virConnectCredentialPtr cred,
password = &cred[i].result;
break;
default:
- DEBUG_LOG("Unsupported libvirt credential %d", cred[i].type);
+ g_debug("Unsupported libvirt credential %d", cred[i].type);
return -1;
}
}
@@ -653,13 +653,13 @@ virt_viewer_auth_libvirt_credentials(virConnectCredentialPtr cred,
cred[i].resultlen = strlen(cred[i].result);
else
cred[i].resultlen = 0;
- DEBUG_LOG("Got '%s' %d %d", cred[i].result, cred[i].resultlen, cred[i].type);
+ g_debug("Got '%s' %d %d", cred[i].result, cred[i].resultlen, cred[i].type);
break;
}
}
cleanup:
- DEBUG_LOG("Return %d", ret);
+ g_debug("Return %d", ret);
return ret;
}
@@ -682,7 +682,7 @@ virt_viewer_connect(VirtViewerApp *app)
if (!virt_viewer_app_get_attach(app))
oflags |= VIR_CONNECT_RO;
- DEBUG_LOG("connecting ...");
+ g_debug("connecting ...");
virt_viewer_app_trace(app, "Opening connection to libvirt with URI %s",
priv->uri ? priv->uri : "<null>");
@@ -713,7 +713,7 @@ virt_viewer_connect(VirtViewerApp *app)
if (!priv->withEvents &&
!virt_viewer_app_is_active(app)) {
- DEBUG_LOG("No domain events, falling back to polling");
+ g_debug("No domain events, falling back to polling");
virt_viewer_app_start_reconnect_poll(app);
}
@@ -721,7 +721,7 @@ virt_viewer_connect(VirtViewerApp *app)
virt_viewer_conn_event,
self,
NULL) < 0) {
- DEBUG_LOG("Unable to register close callback on libvirt connection");
+ g_debug("Unable to register close callback on libvirt connection");
}
return 0;
--
1.9.3
More information about the virt-tools-list
mailing list