Revision: 2774 http://geany.svn.sourceforge.net/geany/?rev=2774&view=rev Author: eht16 Date: 2008-07-13 03:56:21 -0700 (Sun, 13 Jul 2008)
Log Message: ----------- Use templates_replace_all() also for snippet completion.
Modified Paths: -------------- trunk/ChangeLog trunk/src/editor.c trunk/src/templates.c trunk/src/templates.h
Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2008-07-13 10:52:38 UTC (rev 2773) +++ trunk/ChangeLog 2008-07-13 10:56:21 UTC (rev 2774) @@ -2,6 +2,8 @@
* data/snippets.conf, doc/geany.html, doc/geany.txt, src/editor.c: Add support to use template wildcards in snippets. + * src/editor.c, src/templates.c, src/templates.h: + Use templates_replace_all() also for snippet completion.
2008-07-12 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
Modified: trunk/src/editor.c =================================================================== --- trunk/src/editor.c 2008-07-13 10:52:38 UTC (rev 2773) +++ trunk/src/editor.c 2008-07-13 10:56:21 UTC (rev 2774) @@ -1526,16 +1526,8 @@ gchar *datetime = utils_get_date_time("%d.%m.%Y %H:%M:%S %Z", NULL); gchar *basename = g_path_get_basename(DOC_FILENAME(doc));
- text = utils_str_replace(text, "{year}", year); - text = utils_str_replace(text, "{date}", date); + text = templates_replace_all(text, year, date); text = utils_str_replace(text, "{datetime}", datetime); - text = utils_str_replace(text, "{version}", template_prefs.version); - text = utils_str_replace(text, "{initial}", template_prefs.initials); - text = utils_str_replace(text, "{developer}", template_prefs.developer); - text = utils_str_replace(text, "{mail}", template_prefs.mail); - text = utils_str_replace(text, "{company}", template_prefs.company); - text = utils_str_replace(text, "{untitled}", GEANY_STRING_UNTITLED); - text = utils_str_replace(text, "{geanyversion}", "Geany " VERSION); text = utils_str_replace(text, "{filename}", basename);
g_free(year);
Modified: trunk/src/templates.c =================================================================== --- trunk/src/templates.c 2008-07-13 10:52:38 UTC (rev 2773) +++ trunk/src/templates.c 2008-07-13 10:56:21 UTC (rev 2774) @@ -247,10 +247,7 @@ g_file_get_contents(fname, contents_ptr, NULL, NULL);
-/* prototype, because this function should never be used outside of templates.c */ -static gchar *templates_replace_all(gchar *source, const gchar *year, const gchar *date);
- static void init_general_templates(const gchar *year, const gchar *date) { gchar *template_filename_fileheader = TEMPLATES_GET_FILENAME("fileheader"); @@ -777,7 +774,7 @@ }
-static gchar *templates_replace_all(gchar *text, const gchar *year, const gchar *date) +gchar *templates_replace_all(gchar *text, const gchar *year, const gchar *date) { text = utils_str_replace(text, "{year}", year); text = utils_str_replace(text, "{date}", date);
Modified: trunk/src/templates.h =================================================================== --- trunk/src/templates.h 2008-07-13 10:52:38 UTC (rev 2773) +++ trunk/src/templates.h 2008-07-13 10:56:21 UTC (rev 2774) @@ -64,6 +64,8 @@
gchar *templates_get_template_licence(gint filetype_idx, gint licence_type);
+gchar *templates_replace_all(gchar *source, const gchar *year, const gchar *date); + void templates_free_templates(void);
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.