[gtk-vnc] Add vnc_grab_sequence_get_nth



commit 023e98d55f8b6950189a4760d4062a6a6df226a3
Author: Daniel P. Berrange <berrange redhat com>
Date:   Fri Feb 22 11:58:16 2013 +0000

    Add vnc_grab_sequence_get_nth
    
    To allow introspected bindings to get access to keysyms, add
    a vnc_grab_sequence_get_nth method

 src/libgtk-vnc_sym.version |    2 ++
 src/vncgrabsequence.c      |   19 +++++++++++++++++++
 src/vncgrabsequence.h      |    2 ++
 3 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/src/libgtk-vnc_sym.version b/src/libgtk-vnc_sym.version
index d785eba..c6b91af 100644
--- a/src/libgtk-vnc_sym.version
+++ b/src/libgtk-vnc_sym.version
@@ -86,6 +86,8 @@
     vnc_grab_sequence_as_string;
     vnc_grab_sequence_get_type;
 
+    vnc_grab_sequence_get_nth;
+
   local:
       *;
 };
diff --git a/src/vncgrabsequence.c b/src/vncgrabsequence.c
index b85ebca..5cb4b84 100644
--- a/src/vncgrabsequence.c
+++ b/src/vncgrabsequence.c
@@ -22,6 +22,7 @@
 
 #include <string.h>
 #include <gdk/gdk.h>
+#include <gdk/gdkkeysyms.h>
 
 #include "vncgrabsequence.h"
 
@@ -138,6 +139,24 @@ gchar *vnc_grab_sequence_as_string(VncGrabSequence *sequence)
 
 }
 
+/**
+ * vnc_grab_sequence_get_nth:
+ * @sequence: (transfer none): the grab sequence
+ * @nth: the index of the key symbol to obtain
+ *
+ * Obtain the nth key symbol in the sequence
+ *
+ * Returns: the nth key symbol
+ */
+guint vnc_grab_sequence_get_nth(VncGrabSequence *sequence,
+                                guint n)
+{
+    if (n > sequence->nkeysyms)
+        return GDK_KEY_VoidSymbol;
+
+    return sequence->keysyms[n];
+}
+
 
 /*
  * Local variables:
diff --git a/src/vncgrabsequence.h b/src/vncgrabsequence.h
index 0bfc8cc..6e5bdf9 100644
--- a/src/vncgrabsequence.h
+++ b/src/vncgrabsequence.h
@@ -46,6 +46,8 @@ VncGrabSequence *vnc_grab_sequence_copy(VncGrabSequence *sequence);
 void vnc_grab_sequence_free(VncGrabSequence *sequence);
 gchar *vnc_grab_sequence_as_string(VncGrabSequence *sequence);
 
+guint vnc_grab_sequence_get_nth(VncGrabSequence *sequence,
+                                guint n);
 
 G_END_DECLS
 


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