Revision: 4284
http://geany.svn.sourceforge.net/geany/?rev=4284&view=rev
Author: ntrel
Date: 2009-10-01 16:43:32 +0000 (Thu, 01 Oct 2009)
Log Message:
-----------
Fix minor mem leak.
Modified Paths:
--------------
trunk/src/templates.c
Modified: trunk/src/templates.c
===================================================================
--- trunk/src/templates.c 2009-10-01 16:39:38 UTC (rev 4283)
+++ trunk/src/templates.c 2009-10-01 16:43:32 UTC (rev 4284)
@@ -319,6 +319,7 @@
if (!template)
{
/* try the system path */
+ g_free(path);
path = g_build_path(G_DIR_SEPARATOR_S, app->datadir, GEANY_TEMPLATES_SUBDIR,
"files", fname, NULL);
template = get_template_from_file(path, new_filename, ft);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4282
http://geany.svn.sourceforge.net/geany/?rev=4282&view=rev
Author: ntrel
Date: 2009-10-01 16:26:44 +0000 (Thu, 01 Oct 2009)
Log Message:
-----------
Update file templates section, minor edits.
Modified Paths:
--------------
trunk/doc/geany.html
trunk/doc/geany.txt
Modified: trunk/doc/geany.html
===================================================================
--- trunk/doc/geany.html 2009-10-01 16:10:33 UTC (rev 4281)
+++ trunk/doc/geany.html 2009-10-01 16:26:44 UTC (rev 4282)
@@ -4566,7 +4566,7 @@
<li>Function description</li>
<li>Short GPL notice</li>
<li>Short BSD notice</li>
-<li>Filetype template</li>
+<li>File templates</li>
</ul>
<p>To use these templates, just open the Edit menu or open the popup menu
by right-clicking in the editor widget, and choose "Insert Comments"
@@ -4595,28 +4595,34 @@
<p>File templates are templates used as the basis of a new file. To
use them, choose the <em>New (with Template)</em> menu item from the <em>File</em>
menu.</p>
-<p>By default, templates are created for some filetypes. Custom file
-templates can be added by creating the appropriate template file and
-restarting Geany. You can also edit the default filetype templates.</p>
-<p>The file's contents are just the text to place in the document,
-except for the optional <tt class="docutils literal"><span class="pre">{fileheader}</span></tt> template wildcard. This can
-be placed anywhere, but is usually on the first line of the file,
-followed by a blank line.</p>
+<p>By default, file templates are installed for some filetypes. Custom
+file templates can be added by creating the appropriate template file
+and restarting Geany. You can also edit the default file templates.</p>
+<p>The file's contents are just the text to place in the document, with
+optional template wildcards like <tt class="docutils literal"><span class="pre">{fileheader}</span></tt>. The fileheader
+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="#id192" id="custom-file-templates" name="custom-file-templates">Custom file templates</a></h4>
-<p>These are read from the <tt class="docutils literal"><span class="pre">$prefix/share/geany/templates/files</span></tt>
-directory (see <a class="reference" href="#installation-prefix">Installation prefix</a>) and the
-<tt class="docutils literal"><span class="pre">~/.config/geany/templates/files</span></tt> directory (created the first time
-Geany is started). 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">main.c</span></tt>
-would add a menu item which created a new document with the filetype
-set to 'C'.</p>
+<p>These are read from the following directories:</p>
+<ul class="simple">
+<li><tt class="docutils literal"><span class="pre">$prefix/share/geany/templates/files</span></tt> (see <a class="reference" href="#installation-prefix">Installation prefix</a>)</li>
+<li><tt class="docutils literal"><span class="pre">~/.config/geany/templates/files</span></tt> (created the first time
+Geany is started).</li>
+</ul>
+<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, so you don't need to restart Geany after editing a custom file
template, only after adding a new one.</p>
</div>
<div class="section">
<h4><a class="toc-backref" href="#id193" 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
@@ -5708,7 +5714,7 @@
<div class="footer">
<hr class="footer" />
<a class="reference" href="geany.txt">View document source</a>.
-Generated on: 2009-09-30 14:52 UTC.
+Generated on: 2009-10-01 16:22 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 2009-10-01 16:10:33 UTC (rev 4281)
+++ trunk/doc/geany.txt 2009-10-01 16:26:44 UTC (rev 4282)
@@ -3952,7 +3952,7 @@
* Function description
* Short GPL notice
* Short BSD notice
-* Filetype template
+* File templates
To use these templates, just open the Edit menu or open the popup menu
by right-clicking in the editor widget, and choose "Insert Comments"
@@ -3990,26 +3990,28 @@
use them, choose the *New (with Template)* menu item from the *File*
menu.
-By default, templates are created for some filetypes. Custom file
-templates can be added by creating the appropriate template file and
-restarting Geany. You can also edit the default filetype templates.
+By default, file templates are installed for some filetypes. Custom
+file templates can be added by creating the appropriate template file
+and restarting Geany. You can also edit the default file templates.
-The file's contents are just the text to place in the document,
-except for the optional ``{fileheader}`` template wildcard. This can
-be placed anywhere, but is usually on the first line of the file,
-followed by a blank line.
+The file's contents are just the text to place in the document, with
+optional template wildcards like ``{fileheader}``. The fileheader
+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
`````````````````````
-These are read from the ``$prefix/share/geany/templates/files``
-directory (see `Installation prefix`_) and the
-``~/.config/geany/templates/files`` directory (created the first time
-Geany is started). The filetype to use is detected from the template
-file's extension, if any. For example, creating a file ``main.c``
-would add a menu item which created a new document with the filetype
-set to 'C'.
+These are read from the following directories:
+* ``$prefix/share/geany/templates/files`` (see `Installation prefix`_)
+* ``~/.config/geany/templates/files`` (created the first time
+ Geany is started).
+
+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
+which created a new document with the filetype set to 'C'.
+
The template file is read from disk when the corresponding menu item is
clicked, so you don't need to restart Geany after editing a custom file
template, only after adding a new one.
@@ -4017,6 +4019,9 @@
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
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4281
http://geany.svn.sourceforge.net/geany/?rev=4281&view=rev
Author: ntrel
Date: 2009-10-01 16:10:33 +0000 (Thu, 01 Oct 2009)
Log Message:
-----------
Simplify file menu signal connection a little.
Modified Paths:
--------------
trunk/src/templates.c
Modified: trunk/src/templates.c
===================================================================
--- trunk/src/templates.c 2009-10-01 15:56:51 UTC (rev 4280)
+++ trunk/src/templates.c 2009-10-01 16:10:33 UTC (rev 4281)
@@ -503,9 +503,9 @@
g_object_ref(new_with_template_menu);
{
GtkWidget *item = ui_lookup_widget(main_widgets.window, "file1");
- /* reparent the menu as needed */
- g_signal_connect(item, "activate", G_CALLBACK(on_menu_new_with_template1_show), NULL);
+ /* reparent the template menu as needed */
item = gtk_menu_item_get_submenu(GTK_MENU_ITEM(item));
+ g_signal_connect(item, "show", G_CALLBACK(on_menu_new_with_template1_show), NULL);
g_signal_connect(item, "hide", G_CALLBACK(on_menu_new_with_template1_hide), NULL);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.