anjuta r4358 - in trunk: . plugins/file-wizard plugins/macro



Author: sgranjoux
Date: Tue Oct 21 21:02:17 2008
New Revision: 4358
URL: http://svn.gnome.org/viewvc/anjuta?rev=4358&view=rev

Log:
	* plugins/macro/macros.xml,
	plugins/file-wizard/file.c:
	Fix #552996 - New file dialog misses BSD licence


Modified:
   trunk/ChangeLog
   trunk/plugins/file-wizard/file.c
   trunk/plugins/macro/macros.xml

Modified: trunk/plugins/file-wizard/file.c
==============================================================================
--- trunk/plugins/file-wizard/file.c	(original)
+++ trunk/plugins/file-wizard/file.c	Tue Oct 21 21:02:17 2008
@@ -89,30 +89,23 @@
 };
 
 
-typedef enum _Lsc
-{
-	GPL,
-	LGPL
-} Lsc;
-
 typedef struct _NewlicenseType
 {
 	gchar *name;
-	Lsc type;
+	const gchar* type;
 } NewlicenseType;
 
 NewlicenseType new_license_type[] = {
-	{N_("General Public License (GPL)"), GPL},
-	{N_("Lesser General Public License (LGPL)"), LGPL}
+	{N_("General Public License (GPL)"), "GPL"},
+	{N_("Lesser General Public License (LGPL)"), "LGPL"},
+	{N_("BSD Public License"), "BSD"}
 };
 
 static NewFileGUI *nfg = NULL;
 
 
 static gboolean create_new_file_dialog(IAnjutaDocumentManager *docman);
-static void insert_notice_gpl (IAnjutaMacro* macro, gint comment_type);
-static void insert_notice_lgpl (IAnjutaMacro* macro, gint comment_type);
-static void insert_notice(IAnjutaMacro* macro, gint license_type, gint comment_type);
+static void insert_notice(IAnjutaMacro* macro, const gchar* license_type, gint comment_type);
 static void insert_header(IAnjutaMacro* macro, gint source_type);
 
 void
@@ -229,7 +222,7 @@
 	GtkWidget *optionmenu;
 	const gchar *name;
 	gint sel;
-	gint license_type;
+	const gchar* license_type;
 	gint comment_type;
 	gint source_type;
 	IAnjutaDocumentManager *docman;
@@ -372,61 +365,32 @@
 	widget = glade_xml_get_widget(nfg->xml, NEW_FILE_MENU_LICENSE);
 	gtk_widget_set_sensitive(widget, gtk_toggle_button_get_active(button));
 }
- 
-static void
-insert_notice_gpl (IAnjutaMacro* macro, gint comment_type)
-{
-	switch (comment_type)
-	{
-		case CMT_C:
-			ianjuta_macro_insert(macro, "/* GPL */", NULL);
-			break;
-		case CMT_CPP:
-			ianjuta_macro_insert(macro, "// GPL", NULL);;
-			break;
-		case CMT_P:
-			ianjuta_macro_insert(macro, "# GPL", NULL);;
-			break;
-		default:
-			ianjuta_macro_insert(macro, "/* GPL */", NULL);;
-			break;
-	}
-}
 
 static void
-insert_notice_lgpl (IAnjutaMacro* macro, gint comment_type)
+insert_notice(IAnjutaMacro* macro, const gchar* license_type, gint comment_type)
 {
+	const gchar *template;
+	gchar *name;
+
 	switch (comment_type)
 	{
 		case CMT_C:
-			ianjuta_macro_insert(macro, "/* LGPL */", NULL);
+			template = "/* %s */";
 			break;
 		case CMT_CPP:
-			ianjuta_macro_insert(macro, "// LGPL", NULL);;
+			template = "// %s";
 			break;
 		case CMT_P:
-			ianjuta_macro_insert(macro, "# LGPL", NULL);;
+			template = "# %s";
 			break;
 		default:
-			ianjuta_macro_insert(macro, "/* LGPL */", NULL);;
+			template = "/* %s */";
 			break;
 	}
-}
-static void
-insert_notice(IAnjutaMacro* macro, gint license_type, gint comment_type)
-{
-	switch (license_type)
-	{
-		case GPL:
-			insert_notice_gpl(macro, comment_type);
-			break;
-		case LGPL :
-			insert_notice_lgpl(macro, comment_type);
-			break;
-		default:
-			;
-			break;
-	}	
+
+	name = g_strdup_printf(template, license_type);
+	ianjuta_macro_insert(macro, name, NULL);
+	g_free (name);
 }
 
 static void

Modified: trunk/plugins/macro/macros.xml
==============================================================================
--- trunk/plugins/macro/macros.xml	(original)
+++ trunk/plugins/macro/macros.xml	Tue Oct 21 21:02:17 2008
@@ -62,6 +62,83 @@
 	;
 }]]></macro>
 
+<macro _name="/* BSD */" _category="Licenses" _shortcut=""><![CDATA[/*
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of @USER_NAME@ nor the name of any other
+ *    contributor may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY @USER_NAME@ AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL @USER_NAME@ OR ANY OTHER
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+| ]]></macro>
+<macro _name="// BSD" _category="Licenses" _shortcut=""><![CDATA[// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+// 1. Redistributions of source code must retain the above copyright
+//    notice, this list of conditions and the following disclaimer.
+// 2. Redistributions in binary form must reproduce the above copyright
+//    notice, this list of conditions and the following disclaimer in the
+//    documentation and/or other materials provided with the distribution.
+// 3. Neither the name of @USER_NAME@ nor the name of any other
+//    contributor may be used to endorse or promote products derived
+//    from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY @USER_NAME@ AND CONTRIBUTORS ``AS IS'' AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL @USER_NAME@ OR ANY OTHER
+// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+| ]]></macro>
+<macro _name="# BSD" _category="Licenses" _shortcut=""><![CDATA[# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. Neither the name of @USER_NAME@ nor the name of any other
+#    contributor may be used to endorse or promote products derived
+#    from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY @USER_NAME@ AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL @USER_NAME@ OR ANY OTHER
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+| ]]></macro>
 <macro _name="/* GPL */" _category="Licenses" _shortcut=""><![CDATA[/*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by



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