[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [virt-tools-list] [PATCH 3/3]virt-viewer: Disconnect virt-viewer when receiving signal 'session-cancelled'.



ack.

Please send an update patch series.

thanks

On Sun, Jan 15, 2012 at 7:29 AM, Guannan Ren <gren redhat com> wrote:
> Close virt-viewer without any message dialog when the cancel button
> is clicked.
> ---
>  src/virt-viewer-app.c |   17 ++++++++++++++++-
>  1 files changed, 16 insertions(+), 1 deletions(-)
>
> diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c
> index 3b468b3..ed7050f 100644
> --- a/src/virt-viewer-app.c
> +++ b/src/virt-viewer-app.c
> @@ -88,6 +88,9 @@ static void virt_viewer_app_server_cut_text(VirtViewerSession *session,
>  static void virt_viewer_app_bell(VirtViewerSession *session,
>                                 VirtViewerApp *self);
>
> +static void virt_viewer_app_cancelled(VirtViewerSession *session,
> +                                VirtViewerApp *self);
> +
>  static void virt_viewer_app_channel_open(VirtViewerSession *session,
>                                         VirtViewerSessionChannel *channel,
>                                         VirtViewerApp *self);
> @@ -112,6 +115,7 @@ struct _VirtViewerAppPrivate {
>        VirtViewerSession *session;
>        gboolean active;
>        gboolean connected;
> +       gboolean cancelled;
>        guint reconnect_poll; /* source id */
>        char *unixsock;
>        char *ghost;
> @@ -619,6 +623,8 @@ virt_viewer_app_create_session(VirtViewerApp *self, const gchar *type)
>                         G_CALLBACK(virt_viewer_app_server_cut_text), self);
>        g_signal_connect(priv->session, "session-bell",
>                         G_CALLBACK(virt_viewer_app_bell), self);
> +       g_signal_connect(priv->session, "session-cancelled",
> +                        G_CALLBACK(virt_viewer_app_cancelled), self);
>
>        return 0;
>  }
> @@ -714,6 +720,7 @@ virt_viewer_app_activate(VirtViewerApp *self)
>        virt_viewer_app_show_status(self, _("Connecting to graphic server"));
>
>        priv->connected = FALSE;
> +       priv->cancelled = FALSE;
>        priv->active = TRUE;
>        priv->grabbed = FALSE;
>        virt_viewer_app_update_title(self);
> @@ -909,7 +916,7 @@ virt_viewer_app_disconnected(VirtViewerSession *session G_GNUC_UNUSED,
>  {
>        VirtViewerAppPrivate *priv = self->priv;
>
> -       if (!priv->connected) {
> +       if (!priv->connected && !priv->cancelled) {
>                virt_viewer_app_simple_message_dialog(self,
>                                                      _("Unable to connect to the graphic server %s"),
>                                                      priv->pretty_address);
> @@ -917,6 +924,14 @@ virt_viewer_app_disconnected(VirtViewerSession *session G_GNUC_UNUSED,
>        virt_viewer_app_deactivate(self);
>  }
>
> +static void virt_viewer_app_cancelled(VirtViewerSession *session,
> +                                 VirtViewerApp *self)
> +{
> +       VirtViewerAppPrivate *priv = self->priv;
> +       priv->cancelled = TRUE;
> +       virt_viewer_app_disconnected(session, self);
> +}
> +
>
>  static void virt_viewer_app_auth_refused(VirtViewerSession *session G_GNUC_UNUSED,
>                                         const char *msg,
> --
> 1.7.7.5
>
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list redhat com
> https://www.redhat.com/mailman/listinfo/virt-tools-list



-- 
Marc-André Lureau


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]