From 0b48af90e44f00bdaee636c287b80cf8773b906a Mon Sep 17 00:00:00 2001 From: Pablo Barciela Date: Tue, 26 Sep 2017 01:24:17 +0200 Subject: don't request to save documents with no changes Fixes https://github.com/mate-desktop/pluma/issues/230 --- pluma/pluma-tab.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pluma/pluma-tab.c b/pluma/pluma-tab.c index 22dad56a..84371e86 100644 --- a/pluma/pluma-tab.c +++ b/pluma/pluma-tab.c @@ -2624,19 +2624,20 @@ _pluma_tab_can_close (PlumaTab *tab) ts = pluma_tab_get_state (tab); + doc = pluma_tab_get_document (tab); + /* if we are loading or reverting, the tab can be closed */ - if ((ts == PLUMA_TAB_STATE_LOADING) || - (ts == PLUMA_TAB_STATE_LOADING_ERROR) || - (ts == PLUMA_TAB_STATE_REVERTING) || - (ts == PLUMA_TAB_STATE_REVERTING_ERROR)) /* CHECK: I'm not sure this is the right behavior for REVERTING ERROR */ + if ((ts == PLUMA_TAB_STATE_LOADING) || + (ts == PLUMA_TAB_STATE_LOADING_ERROR) || + (ts == PLUMA_TAB_STATE_REVERTING) || + (ts == PLUMA_TAB_STATE_REVERTING_ERROR) || /* CHECK: I'm not sure this is the right behavior for REVERTING ERROR */ + (!gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (doc)))) return TRUE; /* Do not close tab with saving errors */ if (ts == PLUMA_TAB_STATE_SAVING_ERROR) return FALSE; - doc = pluma_tab_get_document (tab); - /* TODO: we need to save the file also if it has been externally modified - Paolo (Oct 10, 2005) */ -- cgit v1.2.1