From 1e387f4dc542ab61a9e3f70d3d730c6b01cabd16 Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Fri, 21 Mar 2008 16:59:30 +0000 Subject: [PATCH] Replace untitled file header filename after Save As and add to recent files on Windows too. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2381 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 3 +++ src/dialogs.c | 4 ---- src/document.c | 9 ++++++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0e1020be..e6fcadc5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,9 @@ * src/win32.c, src/dialogs.c, src/document.c, src/document.h: Only use filetype detection after Save As, not on every save when the filetype is None (fixes #1891778). + * src/dialogs.c, src/document.c: + Replace untitled file header filename after Save As and add to recent + files on Windows too. 2008-03-20 Enrico Tröger diff --git a/src/dialogs.c b/src/dialogs.c index 2480e76a..6a0f77d7 100644 --- a/src/dialogs.c +++ b/src/dialogs.c @@ -410,14 +410,10 @@ static void handle_save_as(const gchar *utf8_filename, gboolean open_new_tab, doc_list[idx].file_name = g_strdup(utf8_filename); } - utils_replace_filename(idx); document_save_file_as(idx); if (! open_new_tab) build_menu_update(idx); - - /* finally add current file to recent files menu */ - ui_add_recent_file(doc_list[idx].file_name); } diff --git a/src/document.c b/src/document.c index 16076669..476cdc5c 100644 --- a/src/document.c +++ b/src/document.c @@ -1262,6 +1262,8 @@ static void get_line_column_from_pos(gint idx, guint byte_pos, gint *line, gint */ gboolean document_save_file_as(gint idx) { + gboolean ret; + if (! DOC_IDX_VALID(idx)) return FALSE; /* detect filetype */ @@ -1277,7 +1279,12 @@ gboolean document_save_file_as(gint idx) app->ignore_callback = FALSE; } } - return document_save_file(idx, TRUE); + utils_replace_filename(idx); + + ret = document_save_file(idx, TRUE); + if (ret) + ui_add_recent_file(doc_list[idx].file_name); + return ret; }