[anjuta] class-gen: Improve GObject tempalate (create priv variable if a private struct is created)
- From: Johannes Schmid <jhs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] class-gen: Improve GObject tempalate (create priv variable if a private struct is created)
- Date: Mon, 13 Feb 2012 20:41:55 +0000 (UTC)
commit 1dfaa7034ccd3f8bd5b1780fbe79a32982784d66
Author: Johannes Schmid <jhs gnome org>
Date: Mon Feb 13 21:34:45 2012 +0100
class-gen: Improve GObject tempalate (create priv variable if a private struct is created)
plugins/class-gen/templates/go-header.tpl | 6 +++++-
plugins/class-gen/templates/go-source.tpl | 6 +++---
2 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/plugins/class-gen/templates/go-header.tpl b/plugins/class-gen/templates/go-header.tpl
index 593b9f8..8e896d1 100644
--- a/plugins/class-gen/templates/go-header.tpl
+++ b/plugins/class-gen/templates/go-header.tpl
@@ -13,7 +13,7 @@
#ifndef _[+ (string-upcase(string->c-name!(get "HeaderFile"))) +]_
#define _[+ (string-upcase(string->c-name!(get "HeaderFile"))) +]_
-#include <glib-object.h>
+#include <gobject.h>
G_BEGIN_DECLS
@@ -26,6 +26,8 @@ G_BEGIN_DECLS
typedef struct _[+ClassName+]Class [+ClassName+]Class;
typedef struct _[+ClassName+] [+ClassName+];
+[+IF (not (=(get "PrivateVariableCount") "0"))+]typedef struct _[+ClassName+]Private [+ClassName+]Private;[+ENDIF+]
+
struct _[+ClassName+]Class
{
@@ -57,6 +59,8 @@ IF (not (=(get "PublicVariableCount") "0"))+]
ENDIF+][+
ENDFOR+][+
ENDIF+]
+
+[+IF (not (=(get "PrivateVariableCount") "0"))+] [+ClassName+]Private *priv;[+ENDIF+]
};
GType [+FuncPrefix+]_get_type (void) G_GNUC_CONST;[+
diff --git a/plugins/class-gen/templates/go-source.tpl b/plugins/class-gen/templates/go-source.tpl
index 39c3f4f..c26e6e4 100644
--- a/plugins/class-gen/templates/go-source.tpl
+++ b/plugins/class-gen/templates/go-source.tpl
@@ -12,8 +12,6 @@
#include "[+HeaderFile+]"[+
IF (not (=(get "PrivateVariableCount") "0"))+]
-
-typedef struct _[+ClassName+]Private [+ClassName+]Private;
struct _[+ClassName+]Private
{[+
FOR Members +][+
@@ -72,8 +70,10 @@ ENDFOR+]
G_DEFINE_TYPE ([+ClassName+], [+FuncPrefix+], [+BaseTypePrefix+]_TYPE_[+BaseTypeSuffix+]);
static void
-[+FuncPrefix+]_init ([+ClassName+] *object)
+[+FuncPrefix+]_init ([+ClassName+] *[+FuncPrefix+])
{
+[+IF (not (=(get "PrivateVariableCount") "0"))+] [+ClassName+]Private *priv = [+TypePrefix+]_[+TypeSuffix+]_GET_PRIVATE([+FuncPrefix+]);[+ENDIF+]
+
/* TODO: Add initialization code here */
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]