Add NULL guard for reloading "untitled" documents
[geany-mirror.git] / src / templates.h
blob76305bf76fd1d6c4fb7f953641fc5eccc80baad6
1 /*
2 * templates.h - this file is part of Geany, a fast and lightweight IDE
4 * Copyright 2005-2012 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
5 * Copyright 2006-2012 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 /**
23 * @file templates.h
24 * Templates (prefs).
25 **/
28 #ifndef GEANY_TEMPLATES_H
29 #define GEANY_TEMPLATES_H 1
31 G_BEGIN_DECLS
33 #define GEANY_TEMPLATES_INDENT 3
35 enum
37 GEANY_TEMPLATE_GPL = 0,
38 GEANY_TEMPLATE_BSD,
39 GEANY_TEMPLATE_FILEHEADER,
40 GEANY_TEMPLATE_CHANGELOG,
41 GEANY_TEMPLATE_FUNCTION,
42 GEANY_MAX_TEMPLATES
46 /** Template preferences. */
47 typedef struct GeanyTemplatePrefs
49 gchar *developer; /**< Name */
50 gchar *company; /**< Company */
51 gchar *mail; /**< Email */
52 gchar *initials; /**< Initials */
53 gchar *version; /**< Initial version */
54 gchar *year_format;
55 gchar *date_format;
56 gchar *datetime_format;
58 GeanyTemplatePrefs;
60 extern GeanyTemplatePrefs template_prefs;
63 struct filetype;
65 void templates_init(void);
67 gchar *templates_get_template_fileheader(gint filetype_idx, const gchar *fname);
69 gchar *templates_get_template_changelog(GeanyDocument *doc);
71 gchar *templates_get_template_function(GeanyDocument *doc, const gchar *func_name);
73 gchar *templates_get_template_licence(GeanyDocument *doc, gint licence_type);
75 void templates_replace_common(GString *tmpl, const gchar *fname,
76 GeanyFiletype *ft, const gchar *func_name);
78 void templates_replace_valist(GString *text,
79 const gchar *first_wildcard, ...) G_GNUC_NULL_TERMINATED;
81 void templates_free_templates(void);
83 G_END_DECLS
85 #endif