[gtk-vnc] Generate enum types for VncConnection enums



commit 8a00b9e25dd174c0e40ab20df1abe51cf5e594ef
Author: Daniel P. Berrange <berrange redhat com>
Date:   Wed Nov 18 18:38:00 2009 +0000

    Generate enum types for VncConnection enums

 src/Makefile.am     |   56 ++++++++++++++++++++++++++++++++++++++------------
 src/vnc.override    |    2 +-
 src/vncconnection.c |    1 +
 src/vncconnection.h |    6 ++--
 src/vncdisplay.c    |    6 ++--
 5 files changed, 50 insertions(+), 21 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 890c826..3cb8777 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -30,10 +30,11 @@ libgtk_vnc_1_0_la_SOURCES = blt.h blt1.h \
 	vncbaseframebuffer.h vncbaseframebuffer.c \
 	vncimageframebuffer.h vncimageframebuffer.c \
 	vncconnection.h vncconnection.c \
+        vncconnectionenums.h vncconnectionenums.c \
 	vncdisplay.h vncdisplay.c \
+        vncdisplayenums.h vncdisplayenums.c \
         vncmarshal.h vncmarshal.c \
 	x_keymap.h x_keymap.c vnc_keycodes.h \
-        enums.h enums.c \
 	utils.h
 
 if WITH_UCONTEXT
@@ -44,12 +45,35 @@ libgtk_vnc_1_0_la_SOURCES += coroutine_gthread.c
 EXTRA_DIST += continuation.h continuation.c coroutine_ucontext.c
 endif
 
-enum_headers = \
-	$(top_srcdir)/src/vncdisplay.h
+vncdisplayenums.c: vncdisplay.h
+	glib-mkenums    --fhead "#include <glib-object.h>\n" \
+			--fhead "#include \"vncdisplayenums.h\"\n\n" \
+			--fprod "\n/* enumerations from \"@filename \" */" \
+			--fprod "\n#include \"@filename \"\n" \
+			--vhead "static const G Type@Value _ enum_name@_values[] = {" \
+			--vprod "  { @VALUENAME@, \"@VALUENAME \", \"@valuenick \" }," \
+			--vtail "  { 0, NULL, NULL }\n};\n\n" \
+			--vtail "GType\n enum_name@_get_type (void)\n{\n" \
+			--vtail "  static GType type = 0;\n\n" \
+			--vtail "  if (!type)\n" \
+			--vtail "    type = g_ type@_register_static (\"@EnumName \", _ enum_name@_values);\n\n" \
+			--vtail "  return type;\n}\n\n" \
+		$< > $@
 
-enums.c: @REBUILD@ $(enum_headers)
+vncdisplayenums.h: vncdisplay.h
+	glib-mkenums    --fhead "#ifndef VNC_DISPLAY_ENUMS_H\n" \
+			--fhead "#define VNC_DISPLAY_ENUMS_H\n\n" \
+			--fhead "G_BEGIN_DECLS\n\n" \
+			--ftail "G_END_DECLS\n\n" \
+			--ftail "#endif /* VNC_DISPLAY_ENUMS_H */\n" \
+			--fprod "\n/* --- @filename@ --- */" \
+			--eprod "#define VNC_TYPE_ ENUMSHORT@ @enum_name _get_type()\n" \
+			--eprod "GType @enum_name _get_type (void);\n" \
+		$< >  $@
+
+vncconnectionenums.c: vncconnection.h
 	glib-mkenums    --fhead "#include <glib-object.h>\n" \
-			--fhead "#include \"enums.h\"\n\n" \
+			--fhead "#include \"vncconnectionenums.h\"\n\n" \
 			--fprod "\n/* enumerations from \"@filename \" */" \
 			--fprod "\n#include \"@filename \"\n" \
 			--vhead "static const G Type@Value _ enum_name@_values[] = {" \
@@ -60,18 +84,18 @@ enums.c: @REBUILD@ $(enum_headers)
 			--vtail "  if (!type)\n" \
 			--vtail "    type = g_ type@_register_static (\"@EnumName \", _ enum_name@_values);\n\n" \
 			--vtail "  return type;\n}\n\n" \
-		$(enum_headers) > $@
+		$< > $@
 
-enums.h: @REBUILD@ $(enum_headers)
-	glib-mkenums    --fhead "#ifndef __GTK_VNC_ENUMS_H__\n" \
-			--fhead "#define __GTK_VNC_ENUMS_H__ 1\n\n" \
+vncconnectionenums.h: vncconnection.h
+	glib-mkenums    --fhead "#ifndef VNC_CONNECTION_ENUMS_H\n" \
+			--fhead "#define VNC_CONNECTION_ENUMS_H\n\n" \
 			--fhead "G_BEGIN_DECLS\n\n" \
 			--ftail "G_END_DECLS\n\n" \
-			--ftail "#endif /* __GTK_VNC_ENUMS_H__ */\n" \
+			--ftail "#endif /* VNC_CONNECTION_ENUMS_H */\n" \
 			--fprod "\n/* --- @filename@ --- */" \
 			--eprod "#define VNC_TYPE_ ENUMSHORT@ @enum_name _get_type()\n" \
 			--eprod "GType @enum_name _get_type (void);\n" \
-		$(enum_headers) >  $@
+		$< >  $@
 
 vncmarshal.c: vncmarshal.txt
 	echo "#include \"vncmarshal.h\"" > $@ && \
@@ -80,9 +104,13 @@ vncmarshal.c: vncmarshal.txt
 vncmarshal.h: vncmarshal.txt
 	glib-genmarshal --header $< > $@ || (rm -f $@ && exit 1)
 
-vncdisplay.c:: vncmarshal.h enums.h
+vncdisplay.c:: vncmarshal.h vncdisplayenums.h
+
+vncconnection.c:: vncmarshal.h vncconnectionenums.h
 
-CLEANFILES = vncmarshal.c vncmarshal.h enums.h enums.c
+CLEANFILES = vncmarshal.c vncmarshal.h \
+	vncdisplayenums.h vncdisplayenums.c \
+	vncconnectionenums.h vncconnectionenums.c
 
 if WITH_PYTHON
 pyexec_LTLIBRARIES = gtkvnc.la
@@ -96,7 +124,7 @@ gtkvnc_la_SOURCES = vncmodule.c vncmodule.defs.c
 CODEGENDIR = $(shell pkg-config --variable=codegendir pygtk-2.0)
 DEFSDIR = $(shell pkg-config --variable=defsdir pygtk-2.0)
 
-vnc.defs: vncdisplay.h enums.h
+vnc.defs: vncdisplay.h vncdisplayenums.h
 	$(PYTHON) $(CODEGENDIR)/h2def.py $< > $@
 
 vncmodule.defs.c: vnc.override vnc.defs
diff --git a/src/vnc.override b/src/vnc.override
index 35ca029..dfc346e 100644
--- a/src/vnc.override
+++ b/src/vnc.override
@@ -3,7 +3,7 @@ headers
 #include <Python.h>
 #include "pygobject.h"
 #include "vncdisplay.h"
-#include "enums.h"
+#include "vncdisplayenums.h"
 %%
 modulename gtkvnc
 %%
diff --git a/src/vncconnection.c b/src/vncconnection.c
index 65bd576..65505c5 100644
--- a/src/vncconnection.c
+++ b/src/vncconnection.c
@@ -21,6 +21,7 @@
 #include <config.h>
 
 #include "vncconnection.h"
+#include "vncconnectionenums.h"
 
 #include <sys/socket.h>
 #include <netinet/in.h>
diff --git a/src/vncconnection.h b/src/vncconnection.h
index 9c3de73..9f7b281 100644
--- a/src/vncconnection.h
+++ b/src/vncconnection.h
@@ -81,7 +81,7 @@ typedef enum {
 
 	GVNC_ENCODING_POINTER_CHANGE = -257,
 	GVNC_ENCODING_EXT_KEY_EVENT = -258,
-} vnc_connection_encoding;
+} VncConnectionEncoding;
 
 typedef enum {
 	GVNC_AUTH_INVALID = 0,
@@ -95,7 +95,7 @@ typedef enum {
 	GVNC_AUTH_VENCRYPT = 19, /* Used by VeNCrypt and QEMU */
  	GVNC_AUTH_SASL = 20, /* SASL type used by VINO and QEMU */
 	GVNC_AUTH_MSLOGON = 0xfffffffa, /* Used by UltraVNC */
-} vnc_connection_auth;
+} VncConnectionAuth;
 
 typedef enum {
 	GVNC_AUTH_VENCRYPT_PLAIN = 256,
@@ -107,7 +107,7 @@ typedef enum {
 	GVNC_AUTH_VENCRYPT_X509PLAIN = 262,
 	GVNC_AUTH_VENCRYPT_X509SASL = 263,
 	GVNC_AUTH_VENCRYPT_TLSSASL = 264,
-} vnc_connection_auth_vencrypt;
+} VncConnectionAuthVencrypt;
 
 
 VncConnection *vnc_connection_new(const struct vnc_connection_ops *ops, gpointer ops_data);
diff --git a/src/vncdisplay.c b/src/vncdisplay.c
index 33c310f..d411f97 100644
--- a/src/vncdisplay.c
+++ b/src/vncdisplay.c
@@ -29,7 +29,7 @@
 #include "vncmarshal.h"
 #include "config.h"
 #include "x_keymap.h"
-#include "enums.h"
+#include "vncdisplayenums.h"
 
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
@@ -1152,7 +1152,7 @@ static gboolean on_auth_type(void *opaque, unsigned int ntype, unsigned int *typ
 		return TRUE;
 
 	for (l = priv->preferable_auths; l; l=l->next) {
-		vnc_connection_auth pref = GPOINTER_TO_UINT (l->data);
+		int pref = GPOINTER_TO_UINT (l->data);
 
 		for (i=0; i<ntype; i++) {
 			if (pref == types[i]) {
@@ -1178,7 +1178,7 @@ static gboolean on_auth_subtype(void *opaque, unsigned int ntype, unsigned int *
 		return TRUE;
 
 	for (l = priv->preferable_auths; l; l=l->next) {
-		vnc_connection_auth pref = GPOINTER_TO_UINT (l->data);
+		int pref = GPOINTER_TO_UINT (l->data);
 
 		for (i=0; i<ntype; i++) {
 			if (pref == types[i]) {



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