[gedit] gedit-commands-file.c: Only save if file has been modified
- From: Jordi Mas <jmas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] gedit-commands-file.c: Only save if file has been modified
- Date: Tue, 30 Apr 2019 16:23:46 +0000 (UTC)
commit deb2af02a9dad8fe2d1cb8689c55a9ac54a8553f
Author: Matthias Schneider <cx879 posteo de>
Date: Tue Apr 30 16:23:32 2019 +0000
gedit-commands-file.c: Only save if file has been modified
gedit/gedit-commands-file.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
---
diff --git a/gedit/gedit-commands-file.c b/gedit/gedit-commands-file.c
index c86df32fa..65e32d705 100644
--- a/gedit/gedit-commands-file.c
+++ b/gedit/gedit-commands-file.c
@@ -1079,13 +1079,28 @@ _gedit_cmd_file_save (GSimpleAction *action,
{
GeditWindow *window = GEDIT_WINDOW (user_data);
GeditTab *tab;
+ GeditDocument *doc;
gedit_debug (DEBUG_COMMANDS);
tab = gedit_window_get_active_tab (window);
if (tab != NULL)
{
- save_tab (tab, window);
+ doc = gedit_tab_get_document (tab);
+ g_return_if_fail (doc != NULL);
+
+ if (_gedit_document_needs_saving (doc) ||
+ gedit_document_is_untitled (doc))
+ {
+ save_tab (tab, window);
+ }
+ else
+ {
+ gedit_statusbar_flash_message (GEDIT_STATUSBAR (window->priv->statusbar),
+ window->priv->generic_message_cid,
+ _("No changes need to be saved"));
+
+ }
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]