[gedit] Fix save as behaviour when saving error infobar is showing



commit 121a12e38c4d3c2e1979c28c9e0a87c8fa64eacb
Author: Eric <8319652+edaigle users noreply github com>
Date:   Mon Jul 5 19:46:03 2021 -0400

    Fix save as behaviour when saving error infobar is showing
    
    As described in #377, attempting to "Save as" with the "unable to save" infobar displayed
    (typically caused by trying to save to a directory without the proper permissions) currently
    fails silently - the file is not saved, but no error message is given.
    
    This commit causes the Save As function to dismiss the unable to save infobar
    (as well as the SAVING_ERROR state), allowing it to behave as expected.
    
    Closes #377

 gedit/gedit-tab.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/gedit/gedit-tab.c b/gedit/gedit-tab.c
index 45e80c828..85c0451d8 100644
--- a/gedit/gedit-tab.c
+++ b/gedit/gedit-tab.c
@@ -2687,6 +2687,7 @@ _gedit_tab_save_as_async (GeditTab                 *tab,
        g_return_if_fail (GEDIT_IS_TAB (tab));
        g_return_if_fail (tab->state == GEDIT_TAB_STATE_NORMAL ||
                          tab->state == GEDIT_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION ||
+                         tab->state == GEDIT_TAB_STATE_SAVING_ERROR ||
                          tab->state == GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW);
        g_return_if_fail (G_IS_FILE (location));
        g_return_if_fail (encoding != NULL);
@@ -2717,6 +2718,11 @@ _gedit_tab_save_as_async (GeditTab                 *tab,
                set_info_bar (tab, NULL, GTK_RESPONSE_NONE);
                save_flags |= GTK_SOURCE_FILE_SAVER_FLAGS_IGNORE_MODIFICATION_TIME;
        }
+       else if (tab->state == GEDIT_TAB_STATE_SAVING_ERROR)
+       {
+               set_info_bar (tab, NULL, GTK_RESPONSE_NONE);
+               gedit_tab_set_state (tab, GEDIT_TAB_STATE_NORMAL);
+       }
 
        file = gedit_document_get_file (doc);
 


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