[virt-tools-list] [PATCH virt-viewer 2/2] app: report disconnection error details

Jonathon Jongsma jjongsma at redhat.com
Thu Jul 3 21:35:49 UTC 2014


ACK

----- Original Message -----
> From: "Marc-André Lureau" <marcandre.lureau at gmail.com>
> To: virt-tools-list at redhat.com
> Sent: Thursday, July 3, 2014 11:50:14 AM
> Subject: [virt-tools-list] [PATCH virt-viewer 2/2] app: report disconnection	error details
> 
> It may be useful to provide more detailed reason for disconnection.
> 
> https://bugzilla.redhat.com/show_bug.cgi?id=1115986
> ---
>  src/virt-viewer-app.c           | 6 ++++--
>  src/virt-viewer-session-spice.c | 8 ++++----
>  src/virt-viewer-session-vnc.c   | 2 +-
>  src/virt-viewer-session.c       | 5 +++--
>  src/virt-viewer-session.h       | 2 +-
>  5 files changed, 13 insertions(+), 10 deletions(-)
> 
> diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
> index 7458acc..2046990 100644
> --- a/src/virt-viewer-app.c
> +++ b/src/virt-viewer-app.c
> @@ -75,6 +75,7 @@ static void virt_viewer_app_connected(VirtViewerSession
> *session,
>  static void virt_viewer_app_initialized(VirtViewerSession *session,
>                                          VirtViewerApp *self);
>  static void virt_viewer_app_disconnected(VirtViewerSession *session,
> +                                         const gchar *msg,
>                                           VirtViewerApp *self);
>  static void virt_viewer_app_auth_refused(VirtViewerSession *session,
>                                           const char *msg,
> @@ -1326,7 +1327,7 @@ virt_viewer_app_initialized(VirtViewerSession *session
> G_GNUC_UNUSED,
>  }
>  
>  static void
> -virt_viewer_app_disconnected(VirtViewerSession *session G_GNUC_UNUSED,
> +virt_viewer_app_disconnected(VirtViewerSession *session G_GNUC_UNUSED, const
> gchar *msg,
>                               VirtViewerApp *self)
>  {
>      VirtViewerAppPrivate *priv = self->priv;
> @@ -1342,6 +1343,7 @@ virt_viewer_app_disconnected(VirtViewerSession *session
> G_GNUC_UNUSED,
>          GtkWidget *dialog = virt_viewer_app_make_dialog(self,
>              _("Unable to connect to the graphic server %s"),
>              priv->pretty_address);
>  
> +        g_object_set(dialog, "secondary-text", msg, NULL);
>          gtk_dialog_run(GTK_DIALOG(dialog));
>          gtk_widget_destroy(dialog);
>      }
> @@ -1354,7 +1356,7 @@ static void virt_viewer_app_cancelled(VirtViewerSession
> *session,
>  {
>      VirtViewerAppPrivate *priv = self->priv;
>      priv->cancelled = TRUE;
> -    virt_viewer_app_disconnected(session, self);
> +    virt_viewer_app_disconnected(session, NULL, self);
>  }
>  
>  
> diff --git a/src/virt-viewer-session-spice.c
> b/src/virt-viewer-session-spice.c
> index 255b3ee..2d4e67d 100644
> --- a/src/virt-viewer-session-spice.c
> +++ b/src/virt-viewer-session-spice.c
> @@ -547,18 +547,18 @@
> virt_viewer_session_spice_main_channel_event(SpiceChannel *channel
> G_GNUC_UNUSED
>                  spice_session_connect(self->priv->session);
>              }
>          } else {
> -            g_signal_emit_by_name(session, "session-disconnected");
> +            g_signal_emit_by_name(session, "session-disconnected",
> error->message);
>          }
>      }
>  #else
>          g_debug("main channel: failed to connect");
> -        g_signal_emit_by_name(session, "session-disconnected");
> +        g_signal_emit_by_name(session, "session-disconnected", NULL);
>  #endif
>          break;
>      case SPICE_CHANNEL_ERROR_IO:
>      case SPICE_CHANNEL_ERROR_LINK:
>      case SPICE_CHANNEL_ERROR_TLS:
> -        g_signal_emit_by_name(session, "session-disconnected");
> +        g_signal_emit_by_name(session, "session-disconnected", NULL);
>          break;
>      default:
>          g_warning("unhandled spice main channel event: %d", event);
> @@ -850,7 +850,7 @@ virt_viewer_session_spice_channel_destroy(G_GNUC_UNUSED
> SpiceSession *s,
>  
>      self->priv->channel_count--;
>      if (self->priv->channel_count == 0)
> -        g_signal_emit_by_name(self, "session-disconnected");
> +        g_signal_emit_by_name(self, "session-disconnected", NULL);
>  }
>  
>  #define UUID_LEN 16
> diff --git a/src/virt-viewer-session-vnc.c b/src/virt-viewer-session-vnc.c
> index 37e66c5..e2f90f2 100644
> --- a/src/virt-viewer-session-vnc.c
> +++ b/src/virt-viewer-session-vnc.c
> @@ -113,7 +113,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);
>      g_debug("Disconnected");
> -    g_signal_emit_by_name(session, "session-disconnected");
> +    g_signal_emit_by_name(session, "session-disconnected", NULL);
>      virt_viewer_display_set_show_hint(VIRT_VIEWER_DISPLAY(display),
>                                        VIRT_VIEWER_DISPLAY_SHOW_HINT_READY,
>                                        FALSE);
>  }
> diff --git a/src/virt-viewer-session.c b/src/virt-viewer-session.c
> index 20d5fb1..9410004 100644
> --- a/src/virt-viewer-session.c
> +++ b/src/virt-viewer-session.c
> @@ -220,9 +220,10 @@ virt_viewer_session_class_init(VirtViewerSessionClass
> *class)
>                   G_SIGNAL_RUN_FIRST,
>                   G_STRUCT_OFFSET(VirtViewerSessionClass,
>                   session_disconnected),
>                   NULL, NULL,
> -                 g_cclosure_marshal_VOID__VOID,
> +                 g_cclosure_marshal_VOID__STRING,
>                   G_TYPE_NONE,
> -                 0);
> +                 1,
> +                 G_TYPE_STRING);
>  
>      g_signal_new("session-channel-open",
>                   G_OBJECT_CLASS_TYPE(object_class),
> diff --git a/src/virt-viewer-session.h b/src/virt-viewer-session.h
> index 388d675..316fdf0 100644
> --- a/src/virt-viewer-session.h
> +++ b/src/virt-viewer-session.h
> @@ -78,7 +78,7 @@ struct _VirtViewerSessionClass {
>      /* signals */
>      void (*session_connected)(VirtViewerSession *session);
>      void (*session_initialized)(VirtViewerSession *session);
> -    void (*session_disconnected)(VirtViewerSession *session);
> +    void (*session_disconnected)(VirtViewerSession *session, const gchar
> *msg);
>      void (*session_auth_refused)(VirtViewerSession *session, const gchar
>      *msg);
>      void (*session_auth_failed)(VirtViewerSession *session, const gchar
>      *msg);
>      void (*session_usb_failed)(VirtViewerSession *session, const gchar
>      *msg);
> --
> 1.9.3
> 
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list
> 




More information about the virt-tools-list mailing list