SF.net SVN: geany:[5674] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Fri Apr 1 16:27:39 UTC 2011


Revision: 5674
          http://geany.svn.sourceforge.net/geany/?rev=5674&view=rev
Author:   ntrel
Date:     2011-04-01 16:27:38 +0000 (Fri, 01 Apr 2011)

Log Message:
-----------
Remove old filetype templates support - users can use custom file
templates instead.

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/doc/geany.html
    trunk/doc/geany.txt
    trunk/src/templates.c
    trunk/src/templates.h

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2011-04-01 16:10:51 UTC (rev 5673)
+++ trunk/ChangeLog	2011-04-01 16:27:38 UTC (rev 5674)
@@ -12,6 +12,10 @@
    Tweak some build dialog labels:
    Clear -> Reset.
    Fix capitalization.
+   Use filetype name instead of title.
+ * src/templates.c, src/templates.h, doc/geany.txt, doc/geany.html:
+   Remove old filetype templates support - users can use custom file
+   templates instead.
 
 
 2011-04-01  Colomban Wendling  <colomban(at)geany(dot)org>

Modified: trunk/doc/geany.html
===================================================================
--- trunk/doc/geany.html	2011-04-01 16:10:51 UTC (rev 5673)
+++ trunk/doc/geany.html	2011-04-01 16:27:38 UTC (rev 5674)
@@ -453,65 +453,64 @@
 <li><a class="reference" href="#templates" id="id202" name="id202">Templates</a><ul>
 <li><a class="reference" href="#template-meta-data" id="id203" name="id203">Template meta data</a></li>
 <li><a class="reference" href="#file-templates" id="id204" name="id204">File templates</a><ul>
-<li><a class="reference" href="#custom-file-templates" id="id205" name="id205">Custom file templates</a></li>
-<li><a class="reference" href="#filetype-templates" id="id206" name="id206">Filetype templates</a></li>
+<li><a class="reference" href="#adding-file-templates" id="id205" name="id205">Adding file templates</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#customizing-templates" id="id207" name="id207">Customizing templates</a><ul>
-<li><a class="reference" href="#template-wildcards" id="id208" name="id208">Template wildcards</a><ul>
-<li><a class="reference" href="#special-command-wildcard" id="id209" name="id209">Special {command:} wildcard</a></li>
+<li><a class="reference" href="#customizing-templates" id="id206" name="id206">Customizing templates</a><ul>
+<li><a class="reference" href="#template-wildcards" id="id207" name="id207">Template wildcards</a><ul>
+<li><a class="reference" href="#special-command-wildcard" id="id208" name="id208">Special {command:} wildcard</a></li>
 </ul>
 </li>
 </ul>
 </li>
 </ul>
 </li>
-<li><a class="reference" href="#customizing-the-toolbar" id="id210" name="id210">Customizing the toolbar</a><ul>
-<li><a class="reference" href="#manually-editing-the-toolbar-layout" id="id211" name="id211">Manually editing the toolbar layout</a></li>
-<li><a class="reference" href="#available-toolbar-elements" id="id212" name="id212">Available toolbar elements</a></li>
+<li><a class="reference" href="#customizing-the-toolbar" id="id209" name="id209">Customizing the toolbar</a><ul>
+<li><a class="reference" href="#manually-editing-the-toolbar-layout" id="id210" name="id210">Manually editing the toolbar layout</a></li>
+<li><a class="reference" href="#available-toolbar-elements" id="id211" name="id211">Available toolbar elements</a></li>
 </ul>
 </li>
 </ul>
 </li>
-<li><a class="reference" href="#plugin-documentation" id="id213" name="id213">Plugin documentation</a><ul>
-<li><a class="reference" href="#html-characters" id="id214" name="id214">HTML Characters</a><ul>
-<li><a class="reference" href="#insert-entity-dialog" id="id215" name="id215">Insert entity dialog</a></li>
-<li><a class="reference" href="#replace-special-chars-by-its-entity" id="id216" name="id216">Replace special chars by its entity</a><ul>
-<li><a class="reference" href="#at-typing-time" id="id217" name="id217">At typing time</a></li>
-<li><a class="reference" href="#bulk-replacement" id="id218" name="id218">Bulk replacement</a></li>
+<li><a class="reference" href="#plugin-documentation" id="id212" name="id212">Plugin documentation</a><ul>
+<li><a class="reference" href="#html-characters" id="id213" name="id213">HTML Characters</a><ul>
+<li><a class="reference" href="#insert-entity-dialog" id="id214" name="id214">Insert entity dialog</a></li>
+<li><a class="reference" href="#replace-special-chars-by-its-entity" id="id215" name="id215">Replace special chars by its entity</a><ul>
+<li><a class="reference" href="#at-typing-time" id="id216" name="id216">At typing time</a></li>
+<li><a class="reference" href="#bulk-replacement" id="id217" name="id217">Bulk replacement</a></li>
 </ul>
 </li>
 </ul>
 </li>
-<li><a class="reference" href="#save-actions" id="id219" name="id219">Save Actions</a><ul>
-<li><a class="reference" href="#instant-save" id="id220" name="id220">Instant Save</a></li>
-<li><a class="reference" href="#backup-copy" id="id221" name="id221">Backup Copy</a></li>
+<li><a class="reference" href="#save-actions" id="id218" name="id218">Save Actions</a><ul>
+<li><a class="reference" href="#instant-save" id="id219" name="id219">Instant Save</a></li>
+<li><a class="reference" href="#backup-copy" id="id220" name="id220">Backup Copy</a></li>
 </ul>
 </li>
 </ul>
 </li>
-<li><a class="reference" href="#contributing-to-this-document" id="id222" name="id222">Contributing to this document</a></li>
-<li><a class="reference" href="#scintilla-keyboard-commands" id="id223" name="id223">Scintilla keyboard commands</a><ul>
-<li><a class="reference" href="#keyboard-commands" id="id224" name="id224">Keyboard commands</a></li>
+<li><a class="reference" href="#contributing-to-this-document" id="id221" name="id221">Contributing to this document</a></li>
+<li><a class="reference" href="#scintilla-keyboard-commands" id="id222" name="id222">Scintilla keyboard commands</a><ul>
+<li><a class="reference" href="#keyboard-commands" id="id223" name="id223">Keyboard commands</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#tips-and-tricks" id="id225" name="id225">Tips and tricks</a><ul>
-<li><a class="reference" href="#document-notebook" id="id226" name="id226">Document notebook</a></li>
-<li><a class="reference" href="#editor" id="id227" name="id227">Editor</a></li>
-<li><a class="reference" href="#interface" id="id228" name="id228">Interface</a></li>
-<li><a class="reference" href="#gtk-related" id="id229" name="id229">GTK-related</a></li>
+<li><a class="reference" href="#tips-and-tricks" id="id224" name="id224">Tips and tricks</a><ul>
+<li><a class="reference" href="#document-notebook" id="id225" name="id225">Document notebook</a></li>
+<li><a class="reference" href="#editor" id="id226" name="id226">Editor</a></li>
+<li><a class="reference" href="#interface" id="id227" name="id227">Interface</a></li>
+<li><a class="reference" href="#gtk-related" id="id228" name="id228">GTK-related</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#compile-time-options" id="id230" name="id230">Compile-time options</a><ul>
-<li><a class="reference" href="#src-geany-h" id="id231" name="id231">src/geany.h</a></li>
-<li><a class="reference" href="#project-h" id="id232" name="id232">project.h</a></li>
-<li><a class="reference" href="#editor-h" id="id233" name="id233">editor.h</a></li>
-<li><a class="reference" href="#keyfile-c" id="id234" name="id234">keyfile.c</a></li>
-<li><a class="reference" href="#build-c" id="id235" name="id235">build.c</a></li>
+<li><a class="reference" href="#compile-time-options" id="id229" name="id229">Compile-time options</a><ul>
+<li><a class="reference" href="#src-geany-h" id="id230" name="id230">src/geany.h</a></li>
+<li><a class="reference" href="#project-h" id="id231" name="id231">project.h</a></li>
+<li><a class="reference" href="#editor-h" id="id232" name="id232">editor.h</a></li>
+<li><a class="reference" href="#keyfile-c" id="id233" name="id233">keyfile.c</a></li>
+<li><a class="reference" href="#build-c" id="id234" name="id234">build.c</a></li>
 </ul>
 </li>
-<li><a class="reference" href="#gnu-general-public-license" id="id236" name="id236">GNU General Public License</a></li>
-<li><a class="reference" href="#license-for-scintilla-and-scite" id="id237" name="id237">License for Scintilla and SciTE</a></li>
+<li><a class="reference" href="#gnu-general-public-license" id="id235" name="id235">GNU General Public License</a></li>
+<li><a class="reference" href="#license-for-scintilla-and-scite" id="id236" name="id236">License for Scintilla and SciTE</a></li>
 </ul>
 </div>
 <div class="section">
@@ -5287,33 +5286,18 @@
 wildcard can be placed anywhere, but it's usually put on the first
 line of the file, followed by a blank line.</p>
 <div class="section">
-<h4><a class="toc-backref" href="#id205" id="custom-file-templates" name="custom-file-templates">Custom file templates</a></h4>
-<p>These are read from <tt class="docutils literal"><span class="pre">templates/files</span></tt> under the <a class="reference" href="#configuration-file-paths">Configuration file
-paths</a>.</p>
+<h4><a class="toc-backref" href="#id205" id="adding-file-templates" name="adding-file-templates">Adding file templates</a></h4>
+<p>File templates are read from <tt class="docutils literal"><span class="pre">templates/files</span></tt> under the
+<a class="reference" href="#configuration-file-paths">Configuration file paths</a>.</p>
 <p>The filetype to use is detected from the template file's extension, if
 any. For example, creating a file <tt class="docutils literal"><span class="pre">module.c</span></tt> would add a menu item
 which created a new document with the filetype set to 'C'.</p>
 <p>The template file is read from disk when the corresponding menu item is
 clicked.</p>
 </div>
-<div class="section">
-<h4><a class="toc-backref" href="#id206" id="filetype-templates" name="filetype-templates">Filetype templates</a></h4>
-<div class="note">
-<p class="first admonition-title">Note</p>
-<p class="last">It's recommended to use custom file templates instead.</p>
 </div>
-<p>Filetype template files are read from the <tt class="docutils literal"><span class="pre">~/.config/geany/templates</span></tt>
-directory, and are named "filetype." followed by the filetype
-name, e.g. "filetype.python", "filetype.sh", etc. If you are
-unsure about the filetype name extensions, they are the same as
-the filetype configuration file extensions, commonly installed in
-<tt class="docutils literal"><span class="pre">/usr/share/geany</span></tt>, with the prefix "filetypes.".</p>
-<p>There is also a template file <tt class="docutils literal"><span class="pre">filetype.none</span></tt> which is used when
-the New command is used without a filetype. This is empty by default.</p>
-</div>
-</div>
 <div class="section">
-<h3><a class="toc-backref" href="#id207" id="customizing-templates" name="customizing-templates">Customizing templates</a></h3>
+<h3><a class="toc-backref" href="#id206" id="customizing-templates" name="customizing-templates">Customizing templates</a></h3>
 <p>Each template can be customized to your needs. The templates are
 stored in the <tt class="docutils literal"><span class="pre">~/.config/geany/templates/</span></tt> directory (see the section called
 <a class="reference" href="#command-line-options">Command line options</a> for further information about the configuration
@@ -5321,7 +5305,7 @@
 Geany ;-) ) and edit the template to your needs. There are some
 wildcards which will be automatically replaced by Geany at startup.</p>
 <div class="section">
-<h4><a class="toc-backref" href="#id208" id="template-wildcards" name="template-wildcards">Template wildcards</a></h4>
+<h4><a class="toc-backref" href="#id207" id="template-wildcards" name="template-wildcards">Template wildcards</a></h4>
 <p>All wildcards must be enclosed by "{" and "}", e.g. {date}.</p>
 <p><strong>Wildcards for character escaping</strong></p>
 <table border="1" class="docutils">
@@ -5528,14 +5512,13 @@
 </tr>
 <tr><td>fileheader</td>
 <td>The file header template. This wildcard
-will only be replaced in filetype
-templates.</td>
+will only be replaced in file templates.</td>
 <td>snippets, file templates.</td>
 </tr>
 </tbody>
 </table>
 <div class="section">
-<h5><a class="toc-backref" href="#id209" id="special-command-wildcard" name="special-command-wildcard">Special {command:} wildcard</a></h5>
+<h5><a class="toc-backref" href="#id208" id="special-command-wildcard" name="special-command-wildcard">Special {command:} wildcard</a></h5>
 <p>The {command:} wildcard is a special one because it can execute
 a specified command and put the command's output (stdout) into
 the template.</p>
@@ -5570,14 +5553,14 @@
 </div>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id210" id="customizing-the-toolbar" name="customizing-the-toolbar">Customizing the toolbar</a></h2>
+<h2><a class="toc-backref" href="#id209" id="customizing-the-toolbar" name="customizing-the-toolbar">Customizing the toolbar</a></h2>
 <p>You can add, remove and reorder the elements in the toolbar by using
 the toolbar editor, or by manually editing the configuration file
 <tt class="docutils literal"><span class="pre">ui_toolbar.xml</span></tt>.</p>
 <p>The toolbar editor can be opened from the preferences editor on the Toolbar tab or
 by right-clicking on the toolbar itself and choosing it from the menu.</p>
 <div class="section">
-<h3><a class="toc-backref" href="#id211" id="manually-editing-the-toolbar-layout" name="manually-editing-the-toolbar-layout">Manually editing the toolbar layout</a></h3>
+<h3><a class="toc-backref" href="#id210" id="manually-editing-the-toolbar-layout" name="manually-editing-the-toolbar-layout">Manually editing the toolbar layout</a></h3>
 <p>To override the system-wide configuration file, copy it to your user
 configuration directory (see <a class="reference" href="#configuration-file-paths">Configuration file paths</a>).</p>
 <p>For example:</p>
@@ -5599,7 +5582,7 @@
 </div>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id212" id="available-toolbar-elements" name="available-toolbar-elements">Available toolbar elements</a></h3>
+<h3><a class="toc-backref" href="#id211" id="available-toolbar-elements" name="available-toolbar-elements">Available toolbar elements</a></h3>
 <table border="1" class="docutils">
 <colgroup>
 <col width="19%" />
@@ -5713,13 +5696,13 @@
 </div>
 </div>
 <div class="section">
-<h1><a class="toc-backref" href="#id213" id="plugin-documentation" name="plugin-documentation">Plugin documentation</a></h1>
+<h1><a class="toc-backref" href="#id212" id="plugin-documentation" name="plugin-documentation">Plugin documentation</a></h1>
 <div class="section">
-<h2><a class="toc-backref" href="#id214" id="html-characters" name="html-characters">HTML Characters</a></h2>
+<h2><a class="toc-backref" href="#id213" id="html-characters" name="html-characters">HTML Characters</a></h2>
 <p>The HTML Characters plugin helps when working with special
 characters in XML/HTML, e.g. German Umlauts ü and ä.</p>
 <div class="section">
-<h3><a class="toc-backref" href="#id215" id="insert-entity-dialog" name="insert-entity-dialog">Insert entity dialog</a></h3>
+<h3><a class="toc-backref" href="#id214" id="insert-entity-dialog" name="insert-entity-dialog">Insert entity dialog</a></h3>
 <p>When the plugin is enabled, you can insert special character
 entities using <em>Tools->Insert Special HTML Characters</em>.</p>
 <p>This opens up a dialog where you can find a huge amount of special
@@ -5731,7 +5714,7 @@
 might also like to double click the chosen entity instead.</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id216" id="replace-special-chars-by-its-entity" name="replace-special-chars-by-its-entity">Replace special chars by its entity</a></h3>
+<h3><a class="toc-backref" href="#id215" id="replace-special-chars-by-its-entity" name="replace-special-chars-by-its-entity">Replace special chars by its entity</a></h3>
 <p>To help make a XML/HTML document valid the plugin supports
 replacement of special chars known by the plugin. Both bulk
 replacement and immediate replacement during typing are supported.</p>
@@ -5747,7 +5730,7 @@
 </dd>
 </dl>
 <div class="section">
-<h4><a class="toc-backref" href="#id217" id="at-typing-time" name="at-typing-time">At typing time</a></h4>
+<h4><a class="toc-backref" href="#id216" id="at-typing-time" name="at-typing-time">At typing time</a></h4>
 <p>You can activate/deactivate this feature using the <em>Tools->HTML
 Replacement->Auto-replace Special Characters</em> menu item. If it's
 activated, all special characters (beside the given exceptions from
@@ -5756,7 +5739,7 @@
 of this feature.</p>
 </div>
 <div class="section">
-<h4><a class="toc-backref" href="#id218" id="bulk-replacement" name="bulk-replacement">Bulk replacement</a></h4>
+<h4><a class="toc-backref" href="#id217" id="bulk-replacement" name="bulk-replacement">Bulk replacement</a></h4>
 <p>After inserting a huge amount of text, e.g. by using copy & paste, the
 plugin allows bulk replacement of all known characters (beside the
 mentioned exceptions). You can find the function under the same
@@ -5766,9 +5749,9 @@
 </div>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id219" id="save-actions" name="save-actions">Save Actions</a></h2>
+<h2><a class="toc-backref" href="#id218" id="save-actions" name="save-actions">Save Actions</a></h2>
 <div class="section">
-<h3><a class="toc-backref" href="#id220" id="instant-save" name="instant-save">Instant Save</a></h3>
+<h3><a class="toc-backref" href="#id219" id="instant-save" name="instant-save">Instant Save</a></h3>
 <p>This plugin sets on every new file (<em>File->New</em> or <em>File->New (with template)</em>)
 a randomly chosen filename and set its filetype appropriate to the used template
 or when no template was used, to a configurable default filetype.
@@ -5778,7 +5761,7 @@
 similar.</p>
 </div>
 <div class="section">
-<h3><a class="toc-backref" href="#id221" id="backup-copy" name="backup-copy">Backup Copy</a></h3>
+<h3><a class="toc-backref" href="#id220" id="backup-copy" name="backup-copy">Backup Copy</a></h3>
 <p>This plugin creates a backup copy of the current file in Geany when it is
 saved. You can specify the directory where the backup copy is saved and
 you can configure the automatically added extension in the configure dialog
@@ -5789,7 +5772,7 @@
 </div>
 </div>
 <div class="section">
-<h1><a class="toc-backref" href="#id222" id="contributing-to-this-document" name="contributing-to-this-document">Contributing to this document</a></h1>
+<h1><a class="toc-backref" href="#id221" id="contributing-to-this-document" name="contributing-to-this-document">Contributing to this document</a></h1>
 <p>This document (<tt class="docutils literal"><span class="pre">geany.txt</span></tt>) is written in <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a>
 (or "reST"). The source file for it is located in Geany's <tt class="docutils literal"><span class="pre">doc</span></tt>
 subdirectory.  If you intend on making changes, you should grab the
@@ -5809,7 +5792,7 @@
 and Fedora systems.</p>
 </div>
 <div class="section">
-<h1><a class="toc-backref" href="#id223" id="scintilla-keyboard-commands" name="scintilla-keyboard-commands">Scintilla keyboard commands</a></h1>
+<h1><a class="toc-backref" href="#id222" id="scintilla-keyboard-commands" name="scintilla-keyboard-commands">Scintilla keyboard commands</a></h1>
 <p>Copyright © 1998, 2006 Neil Hodgson <neilh(at)scintilla(dot)org></p>
 <p>This appendix is distributed under the terms of the License for
 Scintilla and SciTE. A copy of this license can be found in the file
@@ -5818,7 +5801,7 @@
 Scintilla and SciTE</a>.</p>
 <p>20 June 2006</p>
 <div class="section">
-<h2><a class="toc-backref" href="#id224" id="keyboard-commands" name="keyboard-commands">Keyboard commands</a></h2>
+<h2><a class="toc-backref" href="#id223" id="keyboard-commands" name="keyboard-commands">Keyboard commands</a></h2>
 <p>Keyboard commands for Scintilla mostly follow common Windows and GTK+
 conventions. All move keys (arrows, page up/down, home and end)
 allows to extend or reduce the stream selection when holding the
@@ -5900,9 +5883,9 @@
 </div>
 </div>
 <div class="section">
-<h1><a class="toc-backref" href="#id225" id="tips-and-tricks" name="tips-and-tricks">Tips and tricks</a></h1>
+<h1><a class="toc-backref" href="#id224" id="tips-and-tricks" name="tips-and-tricks">Tips and tricks</a></h1>
 <div class="section">
-<h2><a class="toc-backref" href="#id226" id="document-notebook" name="document-notebook">Document notebook</a></h2>
+<h2><a class="toc-backref" href="#id225" id="document-notebook" name="document-notebook">Document notebook</a></h2>
 <ul class="simple">
 <li>Double-click on empty space in the notebook tab bar to open a
 new document.</li>
@@ -5915,7 +5898,7 @@
 </ul>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id227" id="editor" name="editor">Editor</a></h2>
+<h2><a class="toc-backref" href="#id226" id="editor" name="editor">Editor</a></h2>
 <ul class="simple">
 <li>Alt-scroll wheel moves up/down a page.</li>
 <li>Ctrl-scroll wheel zooms in/out.</li>
@@ -5925,13 +5908,13 @@
 </ul>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id228" id="interface" name="interface">Interface</a></h2>
+<h2><a class="toc-backref" href="#id227" id="interface" name="interface">Interface</a></h2>
 <ul class="simple">
 <li>Double-click on a symbol-list group to expand or compact it.</li>
 </ul>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id229" id="gtk-related" name="gtk-related">GTK-related</a></h2>
+<h2><a class="toc-backref" href="#id228" id="gtk-related" name="gtk-related">GTK-related</a></h2>
 <ul class="simple">
 <li>Scrolling the mouse wheel over a notebook tab bar will switch
 notebook pages.</li>
@@ -5946,7 +5929,7 @@
 </div>
 </div>
 <div class="section">
-<h1><a class="toc-backref" href="#id230" id="compile-time-options" name="compile-time-options">Compile-time options</a></h1>
+<h1><a class="toc-backref" href="#id229" id="compile-time-options" name="compile-time-options">Compile-time options</a></h1>
 <p>There are some options which can only be changed at compile time,
 and some options which are used as the default for configurable
 options. To change these options, edit the appropriate source file
@@ -5958,7 +5941,7 @@
 <p class="last">Most users should not need to change these options.</p>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id231" id="src-geany-h" name="src-geany-h">src/geany.h</a></h2>
+<h2><a class="toc-backref" href="#id230" id="src-geany-h" name="src-geany-h">src/geany.h</a></h2>
 <table border="1" class="docutils">
 <colgroup>
 <col width="33%" />
@@ -6015,7 +5998,7 @@
 </table>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id232" id="project-h" name="project-h">project.h</a></h2>
+<h2><a class="toc-backref" href="#id231" id="project-h" name="project-h">project.h</a></h2>
 <table border="1" class="docutils">
 <colgroup>
 <col width="33%" />
@@ -6040,7 +6023,7 @@
 </table>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id233" id="editor-h" name="editor-h">editor.h</a></h2>
+<h2><a class="toc-backref" href="#id232" id="editor-h" name="editor-h">editor.h</a></h2>
 <table border="1" class="docutils">
 <colgroup>
 <col width="33%" />
@@ -6066,7 +6049,7 @@
 </table>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id234" id="keyfile-c" name="keyfile-c">keyfile.c</a></h2>
+<h2><a class="toc-backref" href="#id233" id="keyfile-c" name="keyfile-c">keyfile.c</a></h2>
 <p>These are default settings that can be overridden in the <a class="reference" href="#preferences">Preferences</a> dialog.</p>
 <table border="1" class="docutils">
 <colgroup>
@@ -6147,7 +6130,7 @@
 </table>
 </div>
 <div class="section">
-<h2><a class="toc-backref" href="#id235" id="build-c" name="build-c">build.c</a></h2>
+<h2><a class="toc-backref" href="#id234" id="build-c" name="build-c">build.c</a></h2>
 <table border="1" class="docutils">
 <colgroup>
 <col width="33%" />
@@ -6192,7 +6175,7 @@
 </div>
 </div>
 <div class="section">
-<h1><a class="toc-backref" href="#id236" id="gnu-general-public-license" name="gnu-general-public-license">GNU General Public License</a></h1>
+<h1><a class="toc-backref" href="#id235" id="gnu-general-public-license" name="gnu-general-public-license">GNU General Public License</a></h1>
 <pre class="literal-block">
             GNU GENERAL PUBLIC LICENSE
                Version 2, June 1991
@@ -6537,7 +6520,7 @@
 </pre>
 </div>
 <div class="section">
-<h1><a class="toc-backref" href="#id237" id="license-for-scintilla-and-scite" name="license-for-scintilla-and-scite">License for Scintilla and SciTE</a></h1>
+<h1><a class="toc-backref" href="#id236" id="license-for-scintilla-and-scite" name="license-for-scintilla-and-scite">License for Scintilla and SciTE</a></h1>
 <p>Copyright 1998-2003 by Neil Hodgson <neilh(at)scintilla(dot)org></p>
 <p>All Rights Reserved</p>
 <p>Permission to use, copy, modify, and distribute this software and
@@ -6557,7 +6540,7 @@
 <div class="footer">
 <hr class="footer" />
 <a class="reference" href="geany.txt">View document source</a>.
-Generated on: 2011-04-01 12:36 UTC.
+Generated on: 2011-04-01 16:25 UTC.
 Generated by <a class="reference" href="http://docutils.sourceforge.net/">Docutils</a> from <a class="reference" href="http://docutils.sourceforge.net/rst.html">reStructuredText</a> source.
 
 </div>

Modified: trunk/doc/geany.txt
===================================================================
--- trunk/doc/geany.txt	2011-04-01 16:10:51 UTC (rev 5673)
+++ trunk/doc/geany.txt	2011-04-01 16:27:38 UTC (rev 5674)
@@ -4525,11 +4525,11 @@
 wildcard can be placed anywhere, but it's usually put on the first
 line of the file, followed by a blank line.
 
-Custom file templates
+Adding file templates
 `````````````````````
 
-These are read from ``templates/files`` under the `Configuration file
-paths`_.
+File templates are read from ``templates/files`` under the
+`Configuration file paths`_.
 
 The filetype to use is detected from the template file's extension, if
 any. For example, creating a file ``module.c`` would add a menu item
@@ -4538,23 +4538,7 @@
 The template file is read from disk when the corresponding menu item is
 clicked.
 
-Filetype templates
-``````````````````
 
-.. note::
-    It's recommended to use custom file templates instead.
-
-Filetype template files are read from the ``~/.config/geany/templates``
-directory, and are named "filetype." followed by the filetype
-name, e.g. "filetype.python", "filetype.sh", etc. If you are
-unsure about the filetype name extensions, they are the same as
-the filetype configuration file extensions, commonly installed in
-``/usr/share/geany``, with the prefix "filetypes.".
-
-There is also a template file ``filetype.none`` which is used when
-the New command is used without a filetype. This is empty by default.
-
-
 Customizing templates
 ^^^^^^^^^^^^^^^^^^^^^
 
@@ -4677,8 +4661,7 @@
 bsd            This wildcard inserts a BSD licence notice.   file header.
 
 fileheader     The file header template. This wildcard       snippets, file templates.
-               will only be replaced in filetype
-               templates.
+               will only be replaced in file templates.
 ============== ============================================= =======================================
 
 

Modified: trunk/src/templates.c
===================================================================
--- trunk/src/templates.c	2011-04-01 16:10:51 UTC (rev 5673)
+++ trunk/src/templates.c	2011-04-01 16:27:38 UTC (rev 5674)
@@ -22,7 +22,7 @@
  */
 
 /*
- * Templates to insert into the current document, or filetype templates to create a new
+ * Templates to insert into the current document, or file templates to create a new
  * document from.
  */
 
@@ -51,11 +51,7 @@
 /* TODO: implement custom insertion templates instead? */
 static gchar *templates[GEANY_MAX_TEMPLATES];
 
-/* We should probably remove filetype templates support soon - users can use custom
- * file templates instead. */
-static gchar *ft_templates[GEANY_MAX_BUILT_IN_FILETYPES] = {NULL};
 
-
 static void replace_static_values(GString *text);
 static gchar *get_template_fileheader(GeanyFiletype *ft);
 
@@ -113,7 +109,7 @@
 }
 
 
-/* FIXME the callers should use GStrings instead of char arrays */
+/* TODO the callers should use GStrings instead of char arrays */
 static gchar *replace_all(gchar *text, const gchar *year, const gchar *date, const gchar *datetime)
 {
 	GString *str;
@@ -166,71 +162,6 @@
 }
 
 
-static void init_ft_templates(const gchar *year, const gchar *date, const gchar *datetime)
-{
-	filetype_id ft_id;
-
-	for (ft_id = 0; ft_id < GEANY_MAX_BUILT_IN_FILETYPES; ft_id++)
-	{
-		gchar *ext = (ft_id != GEANY_FILETYPES_NONE) ?
-			filetypes_get_conf_extension(ft_id) : g_strdup("none");
-		gchar *shortname = g_strconcat("filetype.", ext, NULL);
-		gchar *fname = TEMPLATES_GET_FILENAME(shortname);
-
-		ft_templates[ft_id] = read_file(fname);
-		ft_templates[ft_id] = replace_all(ft_templates[ft_id], year, date, datetime);
-
-		g_free(fname);
-		g_free(shortname);
-		g_free(ext);
-	}
-}
-
-
-static void
-on_new_with_filetype_template(GtkMenuItem *menuitem, gpointer user_data)
-{
-	GeanyFiletype *ft = user_data;
-	gchar *template = templates_get_template_new_file(ft);
-
-	document_new_file(NULL, ft, template);
-	g_free(template);
-}
-
-
-/* TODO: remove filetype template support after 0.19 */
-static gboolean create_new_filetype_items(void)
-{
-	GSList *node;
-	gboolean ret = FALSE;
-	GtkWidget *menu = NULL;
-
-	foreach_slist(node, filetypes_by_title)
-	{
-		GeanyFiletype *ft = node->data;
-		GtkWidget *item;
-
-		if (ft->id >= GEANY_MAX_BUILT_IN_FILETYPES || ft_templates[ft->id] == NULL)
-			continue;
-
-		if (!menu)
-		{
-			item = gtk_menu_item_new_with_label(_("Old"));
-			menu = gtk_menu_new();
-			gtk_menu_item_set_submenu(GTK_MENU_ITEM(item), menu);
-			gtk_widget_show_all(item);
-			gtk_container_add(GTK_CONTAINER(new_with_template_menu), item);
-		}
-		item = gtk_menu_item_new_with_label(ft->title);
-		gtk_widget_show(item);
-		gtk_container_add(GTK_CONTAINER(menu), item);
-		g_signal_connect(item, "activate", G_CALLBACK(on_new_with_filetype_template), ft);
-		ret = TRUE;
-	}
-	return ret;
-}
-
-
 void templates_replace_common(GString *template, const gchar *fname,
 							  GeanyFiletype *ft, const gchar *func_name)
 {
@@ -371,19 +302,9 @@
 
 static void create_file_template_menu(void)
 {
-	GtkWidget *sep = NULL;
-
 	new_with_template_menu = gtk_menu_new();
+	add_custom_template_items();
 
-	if (add_custom_template_items())
-	{
-		sep = gtk_separator_menu_item_new();
-		gtk_container_add(GTK_CONTAINER(new_with_template_menu), sep);
-	}
-	if (create_new_filetype_items() && sep)
-	{
-		gtk_widget_show(sep);
-	}
 	/* unless the file menu is showing, menu should be in the toolbar widget */
 	geany_menu_button_action_set_menu(GEANY_MENU_BUTTON_ACTION(
 		toolbar_get_action_by_name("New")), new_with_template_menu);
@@ -433,7 +354,6 @@
 	static gboolean init_done = FALSE;
 
 	init_general_templates(year, date, datetime);
-	init_ft_templates(year, date, datetime);
 
 	g_free(date);
 	g_free(datetime);
@@ -607,33 +527,6 @@
 }
 
 
-/* old filetype templates - use file templates instead */
-gchar *templates_get_template_new_file(GeanyFiletype *ft)
-{
-	GString *ft_template;
-	gchar *file_header = NULL;
-
-	g_return_val_if_fail(ft != NULL, NULL);
-	g_return_val_if_fail(ft->id < GEANY_MAX_BUILT_IN_FILETYPES, NULL);
-
-	ft_template = g_string_new(ft_templates[ft->id]);
-	if (FILETYPE_ID(ft) == GEANY_FILETYPES_NONE)
-	{
-		replace_static_values(ft_template);
-	}
-	else
-	{	/* file template only used for new files */
-		file_header = get_template_fileheader(ft);
-		templates_replace_valist(ft_template, "{fileheader}", file_header, NULL);
-	}
-	templates_replace_common(ft_template, NULL, ft, NULL);
-	convert_eol_characters(ft_template, NULL);
-
-	g_free(file_header);
-	return g_string_free(ft_template, FALSE);
-}
-
-
 gchar *templates_get_template_function(GeanyDocument *doc, const gchar *func_name)
 {
 	GString *text;
@@ -680,10 +573,6 @@
 	{
 		g_free(templates[i]);
 	}
-	for (i = 0; i < GEANY_MAX_BUILT_IN_FILETYPES; i++)
-	{
-		g_free(ft_templates[i]);
-	}
 	/* destroy "New with template" sub menu items (in case we want to reload the templates) */
 	children = gtk_container_get_children(GTK_CONTAINER(new_with_template_menu));
 	foreach_list(item, children)

Modified: trunk/src/templates.h
===================================================================
--- trunk/src/templates.h	2011-04-01 16:10:51 UTC (rev 5673)
+++ trunk/src/templates.h	2011-04-01 16:27:38 UTC (rev 5674)
@@ -66,8 +66,6 @@
 
 gchar *templates_get_template_fileheader(gint filetype_idx, const gchar *fname);
 
-gchar *templates_get_template_new_file(GeanyFiletype *ft);
-
 gchar *templates_get_template_changelog(GeanyDocument *doc);
 
 gchar *templates_get_template_function(GeanyDocument *doc, const gchar *func_name);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list