summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@gmail.com>2012-03-08 20:18:42 +0100
committerMarc-André Lureau <marcandre.lureau@gmail.com>2012-03-09 19:01:35 +0100
commit7f72c2515e722c59a76b52d44b7b66a2d135952e (patch)
tree9a7349dc2f758f714cc6d570c345589335e2ceb7
parent2017b3e0ae9cf73536d9065b5fce50ff813a88c9 (diff)
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
-rw-r--r--src/remote-viewer.c10
1 files 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) {