? .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/vg.log
? gedit/dialogs/gedit-dialog-goto-line.loT
? gedit/dialogs/search-panel.gladep
? plugins/sample_test
? plugins/savecopy/savecopy.c.paolo
? po/stamp-it
? 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 11 Dec 2005 14:09:00 -0000
@@ -800,7 +800,9 @@ file_save (GeditTab *tab,
{
gedit_debug_message (DEBUG_COMMANDS, "Untitled");
- return file_save_as (tab, window);
+ file_save_as (tab, window);
+
+ return;
}
uri_for_display = gedit_document_get_uri_for_display (doc);
@@ -877,19 +879,26 @@ _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)) ||
+ gedit_document_get_deleted (doc)))
{
tabs_to_save_as = g_slist_prepend (tabs_to_save_as,
t);
}
else
{
- _gedit_tab_save (t);
+ /* Do not save unmodified utitled or deleted documents */
+ if (!gedit_document_is_untitled (doc) &&
+ !gedit_document_get_readonly (doc))
+ file_save (t, window);
}
}
else
@@ -1296,38 +1305,72 @@ 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, suppose the case
+ the original file has been deleted)
+ - [*] GEDIT_TAB_STATE_SAVING: invalid, ClosAll
+ and Quit are unsensitive if the window state is SAVING.
+ - [*] 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 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: close without saving (if the state is LOADING_ERROR then the
+ document is not modified)
+ - GEDIT_TAB_STATE_REVERTING_ERROR: we do not close since the document contains errors
+ - GEDIT_TAB_STATE_SAVING_ERROR: we do not close since the document contains errors
+ - GEDIT_TAB_STATE_GENERIC_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_LOADING_ERROR) &&
+ (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))
+ {
+ 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
+ {
+ 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);
Index: gedit/gedit-tab.c
===================================================================
RCS file: /cvs/gnome/gedit/gedit/Attic/gedit-tab.c,v
retrieving revision 1.1.2.66
diff -u -p -r1.1.2.66 gedit-tab.c
--- gedit/gedit-tab.c 10 Dec 2005 19:20:35 -0000 1.1.2.66
+++ gedit/gedit-tab.c 11 Dec 2005 14:09:00 -0000
@@ -1945,9 +1945,13 @@ _gedit_tab_can_close (GeditTab *tab)
if ((ts == GEDIT_TAB_STATE_LOADING) ||
(ts == GEDIT_TAB_STATE_LOADING_ERROR) ||
(ts == GEDIT_TAB_STATE_REVERTING) ||
- (ts == GEDIT_TAB_STATE_REVERTING_ERROR))
+ (ts == GEDIT_TAB_STATE_REVERTING_ERROR)) /* CHECK: I'm not sure this is the right behavior for REVERTING ERROR */
return TRUE;
+ /* Do not close tab with saving errors */
+ if (ts == GEDIT_TAB_STATE_SAVING_ERROR)
+ return FALSE;
+
doc = gedit_tab_get_document (tab);
/* TODO: we need to save the file also if it has been externally