InstantSave: when opening new files from template, use the template's filetype, otherwise fall back to configured default filetype.
git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3072 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
parent
ca464c2c8b
commit
5b772ef629
@ -3,6 +3,9 @@
|
|||||||
* src/highlighting.c:
|
* src/highlighting.c:
|
||||||
Fix regression: clear all styles for filetype None to not break
|
Fix regression: clear all styles for filetype None to not break
|
||||||
the 'invert_all' option.
|
the 'invert_all' option.
|
||||||
|
* src/saveactions.c:
|
||||||
|
InstantSave: when opening new files from template, use the template's
|
||||||
|
filetype, otherwise fall back to configured default filetype.
|
||||||
|
|
||||||
|
|
||||||
2008-10-12 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
|
2008-10-12 Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
|
||||||
|
@ -254,12 +254,17 @@ static void instantsave_document_new_cb(GObject *obj, GeanyDocument *doc, gpoint
|
|||||||
{
|
{
|
||||||
gchar *new_filename;
|
gchar *new_filename;
|
||||||
gint fd;
|
gint fd;
|
||||||
GeanyFiletype *ft = p_filetypes->lookup_by_name(instantsave_default_ft);
|
GeanyFiletype *ft = doc->file_type;
|
||||||
|
|
||||||
fd = g_file_open_tmp("gis_XXXXXX", &new_filename, NULL);
|
fd = g_file_open_tmp("gis_XXXXXX", &new_filename, NULL);
|
||||||
if (fd != -1)
|
if (fd != -1)
|
||||||
close(fd); /* close the returned file descriptor as we only need the filename */
|
close(fd); /* close the returned file descriptor as we only need the filename */
|
||||||
|
|
||||||
|
if (ft == NULL)
|
||||||
|
/* ft is NULL when a new file without template was opened, so use the
|
||||||
|
* configured default file type */
|
||||||
|
ft = p_filetypes->lookup_by_name(instantsave_default_ft);
|
||||||
|
|
||||||
if (ft != NULL)
|
if (ft != NULL)
|
||||||
/* add the filetype's default extension to the new filename */
|
/* add the filetype's default extension to the new filename */
|
||||||
setptr(new_filename, g_strconcat(new_filename, ".", ft->extension, NULL));
|
setptr(new_filename, g_strconcat(new_filename, ".", ft->extension, NULL));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user