? .cdtproject ? .project ? INSTALL_DIR ? bubble.patch ? gedit.D ? interactive_search_v1.diff ? session-save.patch ? sexy-search.patch ? gedit/Makefile.am.search ? gedit/Unsaved Document 1 ? gedit/eggnotificationbubble.c ? gedit/eggnotificationbubble.h ? gedit/gedit-document.c.search ? gedit/gedit-document.h.search ? gedit/gedit-document.old.c ? gedit/gedit-global-message-area.c ? gedit/gedit-global-message-area.h ? gedit/gedit-panel.c.diff ? gedit/gedit-print-job-preview.c.paolo ? gedit/gedit-session.c.pbor ? gedit/gedit-vfs-utils.c ? gedit/gedit-vfs-utils.h ? gedit/gedit-view.c.search ? gedit/gtktextregion.c ? gedit/gtktextregion.h ? gedit/output.pdf ? gedit/pippo.txt ? gedit/prova2.txt ? gedit/search-panel.gladep ? gedit/search.patch ? gedit/sessionTODO ? gedit/dialogs/gedit-dialog-goto-line.loT ? gedit/dialogs/search-panel.gladep ? plugins/sample_test ? plugins/savecopy/savecopy.c.paolo ? tools/plugin_template/Makefile.in Index: gedit/gedit-commands-file.c =================================================================== RCS file: /cvs/gnome/gedit/gedit/Attic/gedit-commands-file.c,v retrieving revision 1.1.2.16 diff -u -p -r1.1.2.16 gedit-commands-file.c --- gedit/gedit-commands-file.c 8 Dec 2005 22:27:57 -0000 1.1.2.16 +++ gedit/gedit-commands-file.c 10 Dec 2005 19:10:10 -0000 @@ -800,7 +800,7 @@ file_save (GeditTab *tab, { gedit_debug_message (DEBUG_COMMANDS, "Untitled"); - return file_save_as (tab, window); + file_save_as (tab, window); } uri_for_display = gedit_document_get_uri_for_display (doc); @@ -877,19 +877,23 @@ _gedit_cmd_file_save_documents_list (Ged g_return_if_fail (state != GEDIT_TAB_STATE_PRINT_PREVIEWING); g_return_if_fail (state != GEDIT_TAB_STATE_CLOSING); - /* FIXME: manage readonly files - Paolo (Oct. 12, 2005) */ if ((state == GEDIT_TAB_STATE_NORMAL) || (state == GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW) || (state == GEDIT_TAB_STATE_GENERIC_NOT_EDITABLE)) { - if (gedit_document_is_untitled (doc)) + /* FIXME: manage the case of local readonly files owned by the + user is running gedit - Paolo (Dec. 8, 2005) */ + if (gedit_document_is_untitled (doc) || + (gedit_document_get_readonly (doc) && + gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (doc)))) { tabs_to_save_as = g_slist_prepend (tabs_to_save_as, t); } else { - _gedit_tab_save (t); + if (!gedit_document_get_readonly (doc)) + _gedit_tab_save (t); } } else @@ -1296,40 +1300,77 @@ save_and_close_all_documents (const GLis state = gedit_tab_get_state (t); doc = gedit_tab_get_document (t); + /* If the state is: ([*] invalid states) + - GEDIT_TAB_STATE_NORMAL: close (and if needed save) + - GEDIT_TAB_STATE_LOADING: close, we are sure the file is unmodified + - GEDIT_TAB_STATE_REVERTING: since the user wants + to return back to the version of the file she previously saved, we can close + without saving (CHECK: are we sure this is the right behavior) + - [*] GEDIT_TAB_STATE_SAVING: invalid, we are already saving (no need to save again) + - [*] GEDIT_TAB_STATE_PRINTING, GEDIT_TAB_STATE_PRINT_PREVIEWING: there is not a + real reason for not closing in this case, we do not save to avoid to run + two operations using the message area at the same time (may be we can remove + this limitation in the future). Note that SaveAll, ClosAll + and Quit are unsensitive if the window state is PRINTING. + - GEDIT_TAB_STATE_SHOWING_PRINT_PREVIEW: close (and if needed save) + - [*] GEDIT_TAB_STATE_LOADING_ERROR: invalid (if the state is LOADING_ERROR then the + document is not modified, so it is not possible the document is in the docs list) + - GEDIT_TAB_STATE_REVERTING_ERROR: we do not close since the document contains + (CHECK: is this state possible here?) + - GEDIT_TAB_STATE_SAVING_ERROR: we do not close since the document contains + - GEDIT_TAB_STATE_GEERIC_ERROR: we do not close since the document contains + errors (CHECK: we should problably remove this state) + - GEDIT_TAB_STATE_CLOSING: this state is invalid in this case + */ + g_return_if_fail (state != GEDIT_TAB_STATE_PRINTING); g_return_if_fail (state != GEDIT_TAB_STATE_PRINT_PREVIEWING); g_return_if_fail (state != GEDIT_TAB_STATE_CLOSING); g_return_if_fail (state != GEDIT_TAB_STATE_LOADING_ERROR); g_return_if_fail (state != GEDIT_TAB_STATE_SAVING); - if (g_list_index ((GList *)docs, doc) >= 0) + if ((state != GEDIT_TAB_STATE_SAVING_ERROR) && + (state != GEDIT_TAB_STATE_GENERIC_ERROR) && + (state != GEDIT_TAB_STATE_REVERTING_ERROR)) { - /* The document must be saved before closing */ - g_return_if_fail (gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (doc)) || - gedit_document_get_deleted (doc)); - - if (gedit_document_is_untitled (doc)) - { - g_object_set_data (G_OBJECT (t), - GEDIT_IS_CLOSING_TAB, - GBOOLEAN_TO_POINTER (TRUE)); - - tabs_to_save_as = g_slist_prepend (tabs_to_save_as, - t); + if ((g_list_index ((GList *)docs, doc) >= 0) && + (state != GEDIT_TAB_STATE_LOADING) && + (state != GEDIT_TAB_STATE_REVERTING)) /* CHECK: is this the right behavior with REVERTING ?*/ + { + /* The document must be saved before closing */ + /* + g_return_if_fail (gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (doc)) || + gedit_document_get_deleted (doc)); + */ + + /* FIXME: manage the case of local readonly files owned by the + user is running gedit - Paolo (Dec. 8, 2005) */ + if (gedit_document_is_untitled (doc) || + (gedit_document_get_readonly (doc) && + gtk_text_buffer_get_modified (GTK_TEXT_BUFFER (doc)))) + { + g_object_set_data (G_OBJECT (t), + GEDIT_IS_CLOSING_TAB, + GBOOLEAN_TO_POINTER (TRUE)); + + tabs_to_save_as = g_slist_prepend (tabs_to_save_as, + t); + } + else + { + g_return_if_fail (!gedit_document_get_readonly (doc)); + + tabs_to_save_and_close = g_slist_prepend (tabs_to_save_and_close, + t); + } } else { - tabs_to_save_and_close = g_slist_prepend (tabs_to_save_and_close, - t); + /* The document must be closed without saving */ + tabs_to_close = g_list_prepend (tabs_to_close, + t); } } - else - { - /* The document must be closed without saving */ - tabs_to_close = g_list_prepend (tabs_to_close, - t); - } - l = g_list_next (l); }