[virt-tools-list] [PATCH 1/2 v2] virt-viewer: Register a new signal 'session-cancelled'

Guannan Ren gren at redhat.com
Sat Jan 28 15:01:16 UTC 2012


On 01/18/2012 07:43 PM, Guannan Ren wrote:
> 	*src/virt-viewer-session.c register a the new signal.
> 	*src/virt-viewer-session-spice.c sending out 'session-cancelled'
> 		when the cancel buttion is clicked.
> 	*src/virt-viewer-session.h default callback.
> ---
>   src/virt-viewer-session-spice.c |    3 +--
>   src/virt-viewer-session.c       |    9 +++++++++
>   src/virt-viewer-session.h       |    1 +
>   3 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c
> index d0d6e29..4167c0d 100644
> --- a/src/virt-viewer-session-spice.c
> +++ b/src/virt-viewer-session-spice.c
> @@ -194,8 +194,7 @@ virt_viewer_session_spice_main_channel_event(SpiceChannel *channel G_GNUC_UNUSED
>   							       NULL,
>   							       NULL,&password);
>   		if (ret<  0) {
> -			g_signal_emit_by_name(session, "session-auth-refused",
> -					      _("Unable to collect credentials"));
> +			g_signal_emit_by_name(session, "session-cancelled");
>   		} else {
>   			g_object_set(self->priv->session, "password", password, NULL);
>   			spice_session_connect(self->priv->session);
> diff --git a/src/virt-viewer-session.c b/src/virt-viewer-session.c
> index d151238..e234042 100644
> --- a/src/virt-viewer-session.c
> +++ b/src/virt-viewer-session.c
> @@ -164,6 +164,15 @@ virt_viewer_session_class_init(VirtViewerSessionClass *class)
>   		     G_TYPE_NONE,
>   		     0);
>
> +	g_signal_new("session-cancelled",
> +                     G_OBJECT_CLASS_TYPE(object_class),
> +                     G_SIGNAL_RUN_FIRST,
> +                     G_STRUCT_OFFSET(VirtViewerSessionClass, session_cancelled),
> +                     NULL, NULL,
> +                     g_cclosure_marshal_VOID__VOID,
> +                     G_TYPE_NONE,
> +                     0);
> +
>   	g_type_class_add_private(object_class, sizeof(VirtViewerSessionPrivate));
>   }
>
> diff --git a/src/virt-viewer-session.h b/src/virt-viewer-session.h
> index 48c8de3..f2f345a 100644
> --- a/src/virt-viewer-session.h
> +++ b/src/virt-viewer-session.h
> @@ -86,6 +86,7 @@ struct _VirtViewerSessionClass {
>
>   	void (*session_cut_text)(VirtViewerSession *session, const char *str);
>   	void (*session_bell)(VirtViewerSession *session);
> +	void (*session_cancelled)(VirtViewerSession *session);
>   };
>
>   GType virt_viewer_session_get_type(void);

   Hi Marc-Andre

        Could you please find some time help with reviewing these 
patches of 2nd version.
        Thanks in advance.

   Guannan Ren




More information about the virt-tools-list mailing list