[gedit/zbrown/deteplification-src: 50/633] Revert "gedit-commands-file.c: Only save if file has been modified"




commit 4c6363db379278128d3f66d7e3ee540db216fef0
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Thu Nov 28 07:45:55 2019 +0100

    Revert "gedit-commands-file.c: Only save if file has been modified"
    
    This reverts commit deb2af02a9dad8fe2d1cb8689c55a9ac54a8553f.
    
    It's important to be able to save a document in all circumstances.
    
    Opening a text file in gedit and then directly save it is like the
    equivalent of the `touch` Unix command, but with a GUI.
    
    Also, a file can be modified with another program while it is opened in
    gedit. In that case it is useful to be able to save the file again in
    gedit. gedit tries to detect when a file is externally modified, but it
    does it only for local files.
    
    Another reason is if gedit bugs, if the GeditTab/GeditDocument state
    (wrt whether it needs saving or not) is buggy, then the user will be
    happy to be able to save the content without the need to copy/paste the
    text into another app.
    
    And there are probably other reasons why disabling a "save" feature can
    be dangerous. On Unix when we execute a command, the system listens to
    the user and executes the command, regardless of whether it's useful or
    not.

 gedit/gedit-commands-file.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)
---
diff --git a/gedit/gedit-commands-file.c b/gedit/gedit-commands-file.c
index baad476d6..7eee87478 100644
--- a/gedit/gedit-commands-file.c
+++ b/gedit/gedit-commands-file.c
@@ -1077,28 +1077,13 @@ _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)
        {
-               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"));
-
-               }
+               save_tab (tab, window);
        }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]