From 7f72c2515e722c59a76b52d44b7b66a2d135952e Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Thu, 8 Mar 2012 20:18:42 +0100 Subject: Notify of focus state when a client connects The current code notifies the controller when the remote-viewer application starts, but not when the client is connected. We should do the later instead --- src/remote-viewer.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/remote-viewer.c b/src/remote-viewer.c index bf343cc..f4932c1 100644 --- a/src/remote-viewer.c +++ b/src/remote-viewer.c @@ -641,16 +641,19 @@ spice_ctrl_listen_async_cb(GObject *object, gpointer user_data) { GError *error = NULL; + VirtViewerApp *app = VIRT_VIEWER_APP(user_data); if (SPICE_CTRL_IS_CONTROLLER(object)) spice_ctrl_controller_listen_finish(SPICE_CTRL_CONTROLLER(object), res, &error); - else if (SPICE_CTRL_IS_FOREIGN_MENU(object)) + else if (SPICE_CTRL_IS_FOREIGN_MENU(object)) { spice_ctrl_foreign_menu_listen_finish(SPICE_CTRL_FOREIGN_MENU(object), res, &error); - else + if (!error) + g_object_notify(G_OBJECT(app), "has-focus"); + } else g_warn_if_reached(); if (error != NULL) { - virt_viewer_app_simple_message_dialog(VIRT_VIEWER_APP(user_data), + virt_viewer_app_simple_message_dialog(app, _("Controller connection failed: %s"), error->message); g_clear_error(&error); @@ -701,7 +704,6 @@ remote_viewer_start(VirtViewerApp *app) #if HAVE_SPICE_GTK g_signal_connect(app, "notify", G_CALLBACK(app_notified), self); - g_object_notify(G_OBJECT(app), "has-focus"); if (priv->controller) { if (virt_viewer_app_create_session(app, "spice") < 0) { -- cgit v1.2.3