summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Barciela <[email protected]>2017-10-23 10:16:59 +0200
committerPablo Barciela <[email protected]>2017-10-23 10:19:48 +0200
commit43963f7c99794984e6c33aeb0e40714a54540828 (patch)
tree9ef4a640131ff70481cf0b21d5e5a5d859c18cc9
parent4df44887f4b7547fc9b31d1cb3f61688579fe39b (diff)
downloadpluma-43963f7c99794984e6c33aeb0e40714a54540828.tar.bz2
pluma-43963f7c99794984e6c33aeb0e40714a54540828.tar.xz
add gsettings key: Show save confirmation if the files have changes
Closes https://github.com/mate-desktop/pluma/issues/112
-rw-r--r--data/org.mate.pluma.gschema.xml.in15
-rw-r--r--pluma/pluma-tab.c6
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 @@
<summary>Autosave Interval</summary>
<description>Number of minutes after which pluma will automatically save modified files. This will only take effect if the "Autosave" option is turned on.</description>
</key>
+ <key name="show-save-confirmation" type="b">
+ <default>true</default>
+ <summary>Show save confirmation</summary>
+ <description>Show save confirmation if the files have changes.</description>
+ </key>
<key name="writable-vfs-schemes" type="as">
<default>[ 'dav', 'davs', 'ftp', 'sftp', 'smb', 'ssh' ]</default>
<summary>Writable VFS schemes</summary>
@@ -126,6 +131,11 @@
<summary>Side Pane is Visible</summary>
<description>Whether the side pane at the left of editing windows should be visible.</description>
</key>
+ <key name="show-tabs-with-side-pane" type="b">
+ <default>true</default>
+ <summary>Show tabs with side pane</summary>
+ <description>If false, pluma doesn't show tabs in the notebook with the side pane active.</description>
+ </key>
<key name="bottom-panel-visible" type="b">
<default>false</default>
<summary>Bottom Panel is Visible</summary>
@@ -196,10 +206,5 @@
<summary>Active plugins</summary>
<description>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.</description>
</key>
- <key name="show-tabs-with-side-pane" type="b">
- <default>true</default>
- <summary>Show tabs with side pane</summary>
- <description>If false, pluma doesn't show tabs in the notebook with the side pane active.</description>
- </key>
</schema>
</schemalist>
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 */