Add document_need_save_as().

Show the Save As also for documents created from filetype templates instead of saving them directly with the untitled filename.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@4494 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2009-12-20 15:36:52 +00:00
parent a0c35e487b
commit d91e7b762b
5 changed files with 23 additions and 3 deletions

View File

@ -5,6 +5,14 @@
closed within the next lines to avoid auto adding double \end{}.
2009-12-19 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* src/callbacks.c, src/dialogs.c, src/document.c, src/document.h:
Add document_need_save_as().
Show the Save As also for documents created from filetype templates
instead of saving them directly with the untitled filename.
2009-12-09 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* geany.glade, src/interface.c:

View File

@ -182,7 +182,7 @@ on_save1_activate (GtkMenuItem *menuitem,
if (doc != NULL && cur_page >= 0)
{
if (doc->file_name == NULL)
if (document_need_save_as(doc))
dialogs_show_save_as();
else
document_save_file(doc, FALSE);
@ -211,7 +211,7 @@ on_save_all1_activate (GtkMenuItem *menuitem,
doc = document_get_from_page(i);
if (! doc->changed)
continue;
if (doc->file_name == NULL)
if (document_need_save_as(doc))
{
/* display unnamed document */
gtk_notebook_set_current_page(GTK_NOTEBOOK(main_widgets.notebook),

View File

@ -700,7 +700,7 @@ gboolean dialogs_show_unsaved_file(GeanyDocument *doc)
{
case GTK_RESPONSE_YES:
{
if (doc->file_name == NULL)
if (document_need_save_as(doc))
{
ret = dialogs_show_save_as();
}

View File

@ -1555,6 +1555,16 @@ void document_rename_file(GeanyDocument *doc, const gchar *new_filename)
}
/* Return TRUE if the document hasn't been saved before, i.e. either the filename or
* the real_path is not set. */
gboolean document_need_save_as(GeanyDocument *doc)
{
g_return_val_if_fail(doc != NULL, FALSE);
return (doc->file_name == NULL || doc->real_path == NULL);
}
/**
* Saves the document, detecting the filetype.
*

View File

@ -250,4 +250,6 @@ const GdkColor *document_get_status_color(GeanyDocument *doc);
gchar *document_get_basename_for_display(GeanyDocument *doc, gint length);
gboolean document_need_save_as(GeanyDocument *doc);
#endif