[virt-tools-list] [PATCH virt-viewer 3/9] Add smartcard-{insert, remove} and release-cursor virtual methods

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


---
 src/virt-viewer-display.c |   12 ++++++++++++
 src/virt-viewer-display.h |    7 +++++--
 src/virt-viewer-session.c |   30 ++++++++++++++++++++++++++++++
 src/virt-viewer-session.h |    7 +++++--
 4 files changed, 52 insertions(+), 4 deletions(-)

diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c
index 5b2cdc1..ec4fe52 100644
--- a/src/virt-viewer-display.c
+++ b/src/virt-viewer-display.c
@@ -567,6 +567,18 @@ gboolean virt_viewer_display_get_auto_resize(VirtViewerDisplay *self)
     return self->priv->auto_resize;
 }
 
+void virt_viewer_display_release_cursor(VirtViewerDisplay *self)
+{
+    VirtViewerDisplayClass *klass;
+
+    g_return_if_fail(VIRT_VIEWER_IS_DISPLAY(self));
+
+    klass = VIRT_VIEWER_DISPLAY_GET_CLASS(self);
+    g_return_if_fail(klass->release_cursor != NULL);
+
+    klass->release_cursor(self);
+}
+
 /*
  * Local variables:
  *  c-indent-level: 4
diff --git a/src/virt-viewer-display.h b/src/virt-viewer-display.h
index 17a3390..07db5fd 100644
--- a/src/virt-viewer-display.h
+++ b/src/virt-viewer-display.h
@@ -70,9 +70,10 @@ struct _VirtViewerDisplayClass {
     GtkBinClass parent_class;
 
     /* virtual methods */
-    void (*send_keys)(VirtViewerDisplay* display,
+    void (*send_keys)(VirtViewerDisplay *display,
                       const guint *keyvals, int nkeyvals);
-    GdkPixbuf *(*get_pixbuf)(VirtViewerDisplay* display);
+    GdkPixbuf *(*get_pixbuf)(VirtViewerDisplay *display);
+    void (*release_cursor)(VirtViewerDisplay *display);
 
     /* signals */
     void (*display_pointer_grab)(VirtViewerDisplay *display);
@@ -109,6 +110,8 @@ void virt_viewer_display_set_show_hint(VirtViewerDisplay *display, gint hint);
 VirtViewerSession* virt_viewer_display_get_session(VirtViewerDisplay *display);
 void virt_viewer_display_set_auto_resize(VirtViewerDisplay *display, gboolean auto_resize);
 gboolean virt_viewer_display_get_auto_resize(VirtViewerDisplay *display);
+void virt_viewer_display_release_cursor(VirtViewerDisplay *display);
+
 G_END_DECLS
 
 #endif /* _VIRT_VIEWER_DISPLAY_H */
diff --git a/src/virt-viewer-session.c b/src/virt-viewer-session.c
index 7551567..c0d6e65 100644
--- a/src/virt-viewer-session.c
+++ b/src/virt-viewer-session.c
@@ -378,6 +378,36 @@ void virt_viewer_session_usb_device_selection(VirtViewerSession   *self,
     klass->usb_device_selection(self, parent);
 }
 
+void virt_viewer_session_smartcard_insert(VirtViewerSession *self)
+{
+    VirtViewerSessionClass *klass;
+
+    g_return_if_fail(VIRT_VIEWER_IS_SESSION(self));
+
+    klass = VIRT_VIEWER_SESSION_GET_CLASS(self);
+    if (klass->smartcard_insert == NULL) {
+        g_debug("No session smartcard support");
+        return;
+    }
+
+    klass->smartcard_insert(self);
+}
+
+void virt_viewer_session_smartcard_remove(VirtViewerSession *self)
+{
+    VirtViewerSessionClass *klass;
+
+    g_return_if_fail(VIRT_VIEWER_IS_SESSION(self));
+
+    klass = VIRT_VIEWER_SESSION_GET_CLASS(self);
+    if (klass->smartcard_remove == NULL) {
+        g_debug("No session smartcard support");
+        return;
+    }
+
+    klass->smartcard_remove(self);
+}
+
 /*
  * Local variables:
  *  c-indent-level: 4
diff --git a/src/virt-viewer-session.h b/src/virt-viewer-session.h
index 59a7c61..c20f23d 100644
--- a/src/virt-viewer-session.h
+++ b/src/virt-viewer-session.h
@@ -70,6 +70,8 @@ struct _VirtViewerSessionClass {
     gboolean (* channel_open_fd) (VirtViewerSession* session, VirtViewerSessionChannel *channel, int fd);
     gboolean (* has_usb) (VirtViewerSession* session);
     void (* usb_device_selection) (VirtViewerSession* session, GtkWindow *parent);
+    void (* smartcard_insert) (VirtViewerSession* session);
+    void (* smartcard_remove) (VirtViewerSession* session);
 
     /* signals */
     void (*session_connected)(VirtViewerSession *session);
@@ -113,8 +115,9 @@ void virt_viewer_session_set_auto_usbredir(VirtViewerSession* session, gboolean
 gboolean virt_viewer_session_get_auto_usbredir(VirtViewerSession* session);
 
 gboolean virt_viewer_session_has_usb(VirtViewerSession *self);
-void virt_viewer_session_usb_device_selection(VirtViewerSession   *self,
-                                              GtkWindow           *parent);
+void virt_viewer_session_usb_device_selection(VirtViewerSession *self, GtkWindow *parent);
+void virt_viewer_session_smartcard_insert(VirtViewerSession *self);
+void virt_viewer_session_smartcard_remove(VirtViewerSession *self);
 
 G_END_DECLS
 
-- 
1.7.7.6




More information about the virt-tools-list mailing list