[virt-tools-list] [PATCH virt-viewer 4/9] spice: implement smartcard-{insert, remove} virtual methods

Marc-André Lureau marcandre.lureau at gmail.com
Wed Feb 15 00:29:55 UTC 2012


---
 src/virt-viewer-display-spice.c |   11 +++++++++++
 src/virt-viewer-session-spice.c |   20 +++++++++++++++++---
 2 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/src/virt-viewer-display-spice.c b/src/virt-viewer-display-spice.c
index e4f41f9..a5aa075 100644
--- a/src/virt-viewer-display-spice.c
+++ b/src/virt-viewer-display-spice.c
@@ -45,6 +45,7 @@ static void virt_viewer_display_spice_send_keys(VirtViewerDisplay *display,
                                                 const guint *keyvals,
                                                 int nkeyvals);
 static GdkPixbuf *virt_viewer_display_spice_get_pixbuf(VirtViewerDisplay *display);
+static void virt_viewer_display_spice_release_cursor(VirtViewerDisplay *display);
 
 static void
 virt_viewer_display_spice_finalize(GObject *obj)
@@ -67,6 +68,7 @@ virt_viewer_display_spice_class_init(VirtViewerDisplaySpiceClass *klass)
 
     dclass->send_keys = virt_viewer_display_spice_send_keys;
     dclass->get_pixbuf = virt_viewer_display_spice_get_pixbuf;
+    dclass->release_cursor = virt_viewer_display_spice_release_cursor;
 
     g_type_class_add_private(klass, sizeof(VirtViewerDisplaySpicePrivate));
 }
@@ -228,6 +230,15 @@ virt_viewer_display_spice_new(VirtViewerSessionSpice *session,
     return GTK_WIDGET(self);
 }
 
+static void
+virt_viewer_display_spice_release_cursor(VirtViewerDisplay *display)
+{
+    VirtViewerDisplaySpice *self = VIRT_VIEWER_DISPLAY_SPICE(display);
+
+    spice_display_mouse_ungrab(self->priv->display);
+}
+
+
 /*
  * Local variables:
  *  c-indent-level: 4
diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c
index cc43bed..71fffa3 100644
--- a/src/virt-viewer-session-spice.c
+++ b/src/virt-viewer-session-spice.c
@@ -66,7 +66,8 @@ static void virt_viewer_session_spice_channel_new(SpiceSession *s,
 static void virt_viewer_session_spice_channel_destroy(SpiceSession *s,
                                                       SpiceChannel *channel,
                                                       VirtViewerSession *session);
-
+static void virt_viewer_session_spice_smartcard_insert(VirtViewerSession *session);
+static void virt_viewer_session_spice_smartcard_remove(VirtViewerSession *session);
 
 static void
 virt_viewer_session_spice_get_property(GObject *object, guint property_id,
@@ -131,6 +132,8 @@ virt_viewer_session_spice_class_init(VirtViewerSessionSpiceClass *klass)
     dclass->channel_open_fd = virt_viewer_session_spice_channel_open_fd;
     dclass->has_usb = virt_viewer_session_spice_has_usb;
     dclass->usb_device_selection = virt_viewer_session_spice_usb_device_selection;
+    dclass->smartcard_insert = virt_viewer_session_spice_smartcard_insert;
+    dclass->smartcard_remove = virt_viewer_session_spice_smartcard_remove;
 
     g_type_class_add_private(klass, sizeof(VirtViewerSessionSpicePrivate));
 
@@ -343,8 +346,7 @@ virt_viewer_session_spice_usb_device_selection(VirtViewerSession *session,
     GtkWidget *dialog, *area, *usb_device_widget;
 
     /* Create the widgets */
-    dialog = gtk_dialog_new_with_buttons(
-                                         _("Select USB devices for redirection"), parent,
+    dialog = gtk_dialog_new_with_buttons(_("Select USB devices for redirection"), parent,
                                          GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
                                          GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
                                          NULL);
@@ -470,6 +472,18 @@ virt_viewer_session_spice_get_main_channel(VirtViewerSessionSpice *self)
     return self->priv->main_channel;
 }
 
+static void
+virt_viewer_session_spice_smartcard_insert(VirtViewerSession *session G_GNUC_UNUSED)
+{
+    spice_smartcard_manager_insert_card(spice_smartcard_manager_get());
+}
+
+static void
+virt_viewer_session_spice_smartcard_remove(VirtViewerSession *session G_GNUC_UNUSED)
+{
+    spice_smartcard_manager_remove_card(spice_smartcard_manager_get());
+}
+
 /*
  * Local variables:
  *  c-indent-level: 4
-- 
1.7.7.6




More information about the virt-tools-list mailing list