From 43963f7c99794984e6c33aeb0e40714a54540828 Mon Sep 17 00:00:00 2001 From: Pablo Barciela Date: Mon, 23 Oct 2017 10:16:59 +0200 Subject: add gsettings key: Show save confirmation if the files have changes Closes https://github.com/mate-desktop/pluma/issues/112 --- data/org.mate.pluma.gschema.xml.in | 15 ++++++++++----- pluma/pluma-tab.c | 6 +++++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/data/org.mate.pluma.gschema.xml.in b/data/org.mate.pluma.gschema.xml.in index 75fe7d11..536211d5 100644 --- a/data/org.mate.pluma.gschema.xml.in +++ b/data/org.mate.pluma.gschema.xml.in @@ -31,6 +31,11 @@ Autosave Interval Number of minutes after which pluma will automatically save modified files. This will only take effect if the "Autosave" option is turned on. + + true + Show save confirmation + Show save confirmation if the files have changes. + [ 'dav', 'davs', 'ftp', 'sftp', 'smb', 'ssh' ] Writable VFS schemes @@ -126,6 +131,11 @@ Side Pane is Visible Whether the side pane at the left of editing windows should be visible. + + true + Show tabs with side pane + If false, pluma doesn't show tabs in the notebook with the side pane active. + false Bottom Panel is Visible @@ -196,10 +206,5 @@ Active plugins List of active plugins. It contains the "Location" of the active plugins. See the .pluma-plugin file for obtaining the "Location" of a given plugin. - - true - Show tabs with side pane - If false, pluma doesn't show tabs in the notebook with the side pane active. - diff --git a/pluma/pluma-tab.c b/pluma/pluma-tab.c index 84371e86..05c82a8e 100644 --- a/pluma/pluma-tab.c +++ b/pluma/pluma-tab.c @@ -2619,6 +2619,7 @@ _pluma_tab_can_close (PlumaTab *tab) { PlumaDocument *doc; PlumaTabState ts; + GSettings *settings; g_return_val_if_fail (PLUMA_IS_TAB (tab), FALSE); @@ -2626,12 +2627,15 @@ _pluma_tab_can_close (PlumaTab *tab) doc = pluma_tab_get_document (tab); + settings = g_settings_new ("org.mate.pluma"); + /* 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 */ - (!gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (doc)))) + (!gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (doc))) || + (!g_settings_get_boolean (settings, "show-save-confirmation"))) return TRUE; /* Do not close tab with saving errors */ -- cgit v1.2.1