[anjuta] class-gen: generate license the same way as project-wizard



commit eb30c96d1f977bbbc5ae7f081d73a9cc9a9b674d
Author: Carl-Anton Ingmarsson <ca ingmarsson gmail com>
Date:   Sun Feb 3 19:10:00 2013 +0100

    class-gen: generate license the same way as project-wizard
    
    this fixes a problem where the prefix character was missing for the
    first line in the generated header
    
    https://bugzilla.gnome.org/show_bug.cgi?id=693213

 plugins/class-gen/templates/cc-header.tpl   |   10 ++++------
 plugins/class-gen/templates/cc-source.tpl   |   10 ++++------
 plugins/class-gen/templates/go-header.tpl   |   10 ++++------
 plugins/class-gen/templates/go-source.tpl   |    8 +++-----
 plugins/class-gen/templates/js-source.tpl   |   10 ++++------
 plugins/class-gen/templates/py-source.tpl   |    7 ++-----
 plugins/class-gen/templates/vala-source.tpl |    8 +++-----
 plugins/class-gen/window.c                  |    8 ++++----
 8 files changed, 28 insertions(+), 43 deletions(-)
---
diff --git a/plugins/class-gen/templates/cc-header.tpl b/plugins/class-gen/templates/cc-header.tpl
index 304cf92..18710d0 100644
--- a/plugins/class-gen/templates/cc-header.tpl
+++ b/plugins/class-gen/templates/cc-header.tpl
@@ -1,16 +1,14 @@
 [+ autogen5 template +]
 [+INCLUDE (string-append "indent.tpl") \+]
+[+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
 /* [+INVOKE EMACS-MODELINE MODE="C" \+] */
 [+INVOKE START-INDENT\+]
 /*
  * [+ProjectName+][+IF (=(get "Headings") "1")+]
  * Copyright (C) [+(shell "date +%Y")+] [+AuthorName+] <[+AuthorEmail+]>[+ENDIF+]
- * 
-[+CASE (get "License") +]
-[+ == "BSD"  +][+(bsd  (get "ProjectName") (get "AuthorName") " * ")+]
-[+ == "LGPL" +][+(lgpl (get "ProjectName") (get "AuthorName") " * ")+]
-[+ == "GPL"  +][+(gpl  (get "ProjectName")                    " * ")+]
-[+ESAC+] */
+ *
+[+INVOKE LICENSE-DESCRIPTION PFX=" * " PROGRAM=(get "ProjectName") OWNER=(get "AuthorName") \+]
+ */
 
 #ifndef _[+ (string-upcase(string->c-name!(get "HeaderFile"))) +]_
 #define _[+ (string-upcase(string->c-name!(get "HeaderFile"))) +]_
diff --git a/plugins/class-gen/templates/cc-source.tpl b/plugins/class-gen/templates/cc-source.tpl
index c62c678..fcb7367 100644
--- a/plugins/class-gen/templates/cc-source.tpl
+++ b/plugins/class-gen/templates/cc-source.tpl
@@ -1,16 +1,14 @@
 [+ autogen5 template +]
 [+INCLUDE (string-append "indent.tpl") \+]
+[+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
 /* [+INVOKE EMACS-MODELINE MODE="C" \+] */
 [+INVOKE START-INDENT\+]
 /*
  * [+ProjectName+][+IF (=(get "Headings") "1")+]
  * Copyright (C) [+(shell "date +%Y")+] [+AuthorName+] <[+AuthorEmail+]>[+ENDIF+]
- * 
-[+CASE (get "License") +]
-[+ == "BSD"  +][+(bsd  (get "ProjectName") (get "AuthorName") " * ")+]
-[+ == "LGPL" +][+(lgpl (get "ProjectName") (get "AuthorName") " * ")+]
-[+ == "GPL"  +][+(gpl  (get "ProjectName")                    " * ")+]
-[+ESAC+] */
+ *
+[+INVOKE LICENSE-DESCRIPTION PFX=" * " PROGRAM=(get "ProjectName") OWNER=(get "AuthorName") \+]
+ */
 
 #include "[+HeaderFile+]"
 
diff --git a/plugins/class-gen/templates/go-header.tpl b/plugins/class-gen/templates/go-header.tpl
index 164f28d..aabfb87 100644
--- a/plugins/class-gen/templates/go-header.tpl
+++ b/plugins/class-gen/templates/go-header.tpl
@@ -1,16 +1,14 @@
 [+ autogen5 template +]
 [+INCLUDE (string-append "indent.tpl") \+]
+[+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
 /* [+INVOKE EMACS-MODELINE MODE="C" \+] */
 [+INVOKE START-INDENT\+]
 /*
  * [+ProjectName+][+IF (=(get "Headings") "1")+]
  * Copyright (C) [+(shell "date +%Y")+] [+AuthorName+] <[+AuthorEmail+]>[+ENDIF+]
- * 
-[+CASE (get "License") +]
-[+ == "BSD"  +][+(bsd  (get "ProjectName") (get "AuthorName") " * ")+]
-[+ == "LGPL" +][+(lgpl (get "ProjectName") (get "AuthorName") " * ")+]
-[+ == "GPL"  +][+(gpl  (get "ProjectName")                    " * ")+]
-[+ESAC+] */
+ *
+[+INVOKE LICENSE-DESCRIPTION PFX=" * " PROGRAM=(get "ProjectName") OWNER=(get "AuthorName") \+]
+ */
 
 #ifndef _[+ (string-upcase(string->c-name!(get "HeaderFile"))) +]_
 #define _[+ (string-upcase(string->c-name!(get "HeaderFile"))) +]_
diff --git a/plugins/class-gen/templates/go-source.tpl b/plugins/class-gen/templates/go-source.tpl
index 2a19899..ab24c3f 100644
--- a/plugins/class-gen/templates/go-source.tpl
+++ b/plugins/class-gen/templates/go-source.tpl
@@ -1,16 +1,14 @@
 [+ autogen5 template +]
 [+INCLUDE (string-append "indent.tpl") \+]
+[+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
 /* [+INVOKE EMACS-MODELINE MODE="C" \+] */
 [+INVOKE START-INDENT\+]
 /*
  * [+ProjectName+][+IF (=(get "Headings") "1")+]
  * Copyright (C) [+(shell "date +%Y")+] [+AuthorName+] <[+AuthorEmail+]>[+ENDIF+]
  * 
-[+CASE (get "License") +]
-[+ == "BSD"  +][+(bsd  (get "ProjectName") (get "AuthorName") " * ")+]
-[+ == "LGPL" +][+(lgpl (get "ProjectName") (get "AuthorName") " * ")+]
-[+ == "GPL"  +][+(gpl  (get "ProjectName")                    " * ")+]
-[+ESAC+] */
+[+INVOKE LICENSE-DESCRIPTION PFX=" * " PROGRAM=(get "ProjectName") OWNER=(get "AuthorName") \+]
+ */
 
 #include "[+HeaderFile+]"[+
 IF (not (=(get "PrivateVariableCount") "0"))+]
diff --git a/plugins/class-gen/templates/js-source.tpl b/plugins/class-gen/templates/js-source.tpl
index 055e10b..b83d1d8 100644
--- a/plugins/class-gen/templates/js-source.tpl
+++ b/plugins/class-gen/templates/js-source.tpl
@@ -18,17 +18,15 @@
 ##  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 +]
 [+INCLUDE (string-append "indent.tpl") \+]
+[+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
 [+INVOKE START-INDENT\+]
 /* [+INVOKE EMACS-MODELINE MODE="javascript" \+] */
- *
+/*
  * [+ProjectName+][+IF (=(get "Headings") "1")+]
  * Copyright (C) [+(shell "date +%Y")+] [+AuthorName+] <[+AuthorEmail+]>[+ENDIF+]
  *
-[+CASE (get "License") +]
-[+ == "BSD"  +][+(bsd  (get "ProjectName") (get "AuthorName") " * ")+]
-[+ == "LGPL" +][+(lgpl (get "ProjectName") (get "AuthorName") " * ")+]
-[+ == "GPL"  +][+(gpl  (get "ProjectName")                    " * ")+]
-[+ESAC+] */
+[+INVOKE LICENSE-DESCRIPTION PFX=" * " PROGRAM=(get "ProjectName") OWNER=(get "AuthorName") \+]
+ */
 [+
 FOR Imports +][+
 	IF (not (=(get "Name") "")) +]
diff --git a/plugins/class-gen/templates/py-source.tpl b/plugins/class-gen/templates/py-source.tpl
index 2c780a4..df0bd94 100644
--- a/plugins/class-gen/templates/py-source.tpl
+++ b/plugins/class-gen/templates/py-source.tpl
@@ -18,17 +18,14 @@
 ##  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 +]
 [+INCLUDE (string-append "indent.tpl") \+]
+[+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
 [+INVOKE START-INDENT\+]
 # [+INVOKE EMACS-MODELINE MODE="Python" \+]
 #
 # [+ProjectName+][+IF (=(get "Headings") "1")+]
 # Copyright (C) [+(shell "date +%Y")+] [+AuthorName+] <[+AuthorEmail+]>[+ENDIF+]
 #
-[+CASE (get "License") +]
-[+ == "BSD"  +][+(bsd  (get "ProjectName") (get "AuthorName") "# ")+]
-[+ == "LGPL" +][+(lgpl (get "ProjectName") (get "AuthorName") "# ")+]
-[+ == "GPL"  +][+(gpl  (get "ProjectName")                    "# ")+]
-[+ESAC+]
+[+INVOKE LICENSE-DESCRIPTION PFX="# " PROGRAM=(get "ProjectName") OWNER=(get "AuthorName") \+]
 
 class [+ClassName+]([+IF (not (=(get "BaseClass") ""))+][+BaseClass+][+ENDIF+]):[+
 FOR Constvars +][+
diff --git a/plugins/class-gen/templates/vala-source.tpl b/plugins/class-gen/templates/vala-source.tpl
index 03becbc..e52c9ed 100644
--- a/plugins/class-gen/templates/vala-source.tpl
+++ b/plugins/class-gen/templates/vala-source.tpl
@@ -18,17 +18,15 @@
 ##  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 +]
 [+INCLUDE (string-append "indent.tpl") \+]
+[+INCLUDE (string-append "licenses/" (get "License") ".tpl") \+]
 [+INVOKE START-INDENT\+]
 /* [+INVOKE EMACS-MODELINE MODE="vala" \+] */
 /* [+ProjectName+][+IF (=(get "Headings") "1")+]
  *
  * Copyright (C) [+(shell "date +%Y")+] [+AuthorName+] <[+AuthorEmail+]>[+ENDIF+]
  *
-[+CASE (get "License") +]
-[+ == "BSD"  +][+(bsd  (get "ProjectName") (get "AuthorName") " * ")+]
-[+ == "LGPL" +][+(lgpl (get "ProjectName") (get "AuthorName") " * ")+]
-[+ == "GPL"  +][+(gpl  (get "ProjectName")                    " * ")+]
-[+ESAC+] */
+[+INVOKE LICENSE-DESCRIPTION PFX=" * " PROGRAM=(get "ProjectName") OWNER=(get "AuthorName") \+]
+ */
 
 [+ClassScope+] class [+ClassName+] : [+BaseClass+] {[+
 FOR Properties+][+
diff --git a/plugins/class-gen/window.c b/plugins/class-gen/window.c
index eafcf0e..752398b 100644
--- a/plugins/class-gen/window.c
+++ b/plugins/class-gen/window.c
@@ -1290,10 +1290,10 @@ GHashTable *
 cg_window_create_value_heap (CgWindow *window)
 {
 	static const gchar *LICENSES[] = {
-		"GPL",
-		"LGPL",
-		"BSD",
-		"NONE"
+		"gpl",
+		"lgpl",
+		"bsd",
+		"none"
 	};
 
 	CgWindowPrivate *priv;


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