From 3e189a8b9cc80d93f065dc1992b90efefa652ef4 Mon Sep 17 00:00:00 2001 From: David Lawrence Ramsey Date: Sun, 3 Oct 2004 19:18:48 +0000 Subject: [PATCH] in open_(prev|next)_file(), translate the "New Buffer" string when displaying "Switched to" messages on the statusbar; also do a few more int -> bool conversions git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1959 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 3 +++ src/files.c | 20 ++++++++++---------- src/nano.c | 2 +- src/proto.h | 8 ++++---- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index fc1bcdc2..e0d93de1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -76,6 +76,9 @@ CVS code - - Simplify by reusing variables whereever possible, and add a parameter execute to indicate whether or not to be in "Execute Command" mode. (DLR) +- open_prevfile(), open_nextfile() + - Translate the "New Buffer" string when displaying "Switched + to" messages on the statusbar. (DLR) - global.c: shortcut_init() - Remove redundant NANO_SMALL #ifdef. (DLR) diff --git a/src/files.c b/src/files.c index 3f09ebd6..ca0c3a85 100644 --- a/src/files.c +++ b/src/files.c @@ -696,7 +696,7 @@ void free_openfilestruct(openfilestruct *src) * FALSE, a new entry is created; otherwise, the current entry is * updated. */ -void add_open_file(int update) +void add_open_file(bool update) { openfilestruct *tmp; @@ -849,7 +849,7 @@ void load_open_file(void) * Otherwise, we are about to close that entry, so don't bother doing * so. */ -void open_prevfile(int closing_file) +void open_prevfile(bool closing_file) { if (open_files == NULL) return; @@ -891,7 +891,7 @@ void open_prevfile(int closing_file) load_open_file(); statusbar(_("Switched to %s"), - ((open_files->filename[0] == '\0') ? "New Buffer" : + ((open_files->filename[0] == '\0') ? _("New Buffer") : open_files->filename)); #ifdef DEBUG @@ -909,7 +909,7 @@ void open_prevfile_void(void) * FALSE, update the current entry before switching from it. Otherwise, * we are about to close that entry, so don't bother doing so. */ -void open_nextfile(int closing_file) +void open_nextfile(bool closing_file) { if (open_files == NULL) return; @@ -951,7 +951,7 @@ void open_nextfile(int closing_file) load_open_file(); statusbar(_("Switched to %s"), - ((open_files->filename[0] == '\0') ? "New Buffer" : + ((open_files->filename[0] == '\0') ? _("New Buffer") : open_files->filename)); #ifdef DEBUG @@ -967,14 +967,14 @@ void open_nextfile_void(void) /* * Delete an entry from the open_files filestruct. After deletion of an * entry, the next or previous entry is opened, whichever is found first. - * Return 0 on success or 1 on error. + * Return TRUE on success or FALSE on error. */ -int close_open_file(void) +bool close_open_file(void) { openfilestruct *tmp; if (open_files == NULL) - return 1; + return FALSE; /* make sure open_files->fileage and fileage, and open_files->filebot and filebot, are in sync; they might not be if lines have been cut @@ -988,14 +988,14 @@ int close_open_file(void) else if (open_files->prev != NULL) open_prevfile(TRUE); else - return 1; + return FALSE; unlink_opennode(tmp); delete_opennode(tmp); shortcut_init(FALSE); display_main_list(); - return 0; + return TRUE; } #endif /* ENABLE_MULTIBUFFER */ diff --git a/src/nano.c b/src/nano.c index abdd8f30..7c74982e 100644 --- a/src/nano.c +++ b/src/nano.c @@ -2688,7 +2688,7 @@ void do_exit(void) if (i == 0 || (i == 1 && do_writeout(TRUE) > 0)) { #ifdef ENABLE_MULTIBUFFER /* Exit only if there are no more open buffers. */ - if (close_open_file() != 0) + if (!close_open_file()) #endif finish(); } else if (i != 1) diff --git a/src/proto.h b/src/proto.h index 30383035..3f9061cf 100644 --- a/src/proto.h +++ b/src/proto.h @@ -190,13 +190,13 @@ void splice_opennode(openfilestruct *begin, openfilestruct *newnode, void unlink_opennode(const openfilestruct *fileptr); void delete_opennode(openfilestruct *fileptr); void free_openfilestruct(openfilestruct *src); -void add_open_file(int update); +void add_open_file(bool update); void load_open_file(void); -void open_prevfile(int closing_file); +void open_prevfile(bool closing_file); void open_prevfile_void(void); -void open_nextfile(int closing_file); +void open_nextfile(bool closing_file); void open_nextfile_void(void); -int close_open_file(void); +bool close_open_file(void); #endif #if !defined(DISABLE_SPELLER) || !defined(DISABLE_OPERATINGDIR) char *get_full_path(const char *origpath); -- 2.39.5