[gnome-builder] buffer-manager: clear unsaved state when removing files
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] buffer-manager: clear unsaved state when removing files
- Date: Fri, 24 Apr 2015 22:02:35 +0000 (UTC)
commit 4f89e9f6f9ff91d6fc22b8d8a87ef047742307fd
Author: Christian Hergert <christian hergert me>
Date: Fri Apr 24 14:53:53 2015 -0700
buffer-manager: clear unsaved state when removing files
I think what we want to do long term, when closing with unsaved files
is to determine which of these use cases we want.
1) save the changes to a draft, but leave the real file untouched.
2) just save the file to the original file.
libide/ide-buffer-manager.c | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/libide/ide-buffer-manager.c b/libide/ide-buffer-manager.c
index 7bbb10d..a2fc2e5 100644
--- a/libide/ide-buffer-manager.c
+++ b/libide/ide-buffer-manager.c
@@ -351,11 +351,26 @@ ide_buffer_manager_remove_buffer (IdeBufferManager *self,
if (g_ptr_array_remove_fast (self->buffers, buffer))
{
+ IdeUnsavedFiles *unsaved_files;
+ IdeContext *context;
+ IdeFile *file;
+ GFile *gfile;
+
+ file = ide_buffer_get_file (buffer);
+ gfile = ide_file_get_file (file);
+
+ context = ide_object_get_context (IDE_OBJECT (self));
+ unsaved_files = ide_context_get_unsaved_files (context);
+ ide_unsaved_files_remove (unsaved_files, gfile);
+
gtk_source_completion_words_unregister (self->word_completion, GTK_TEXT_BUFFER (buffer));
+
unregister_auto_save (self, buffer);
+
g_signal_handlers_disconnect_by_func (buffer,
G_CALLBACK (ide_buffer_manager_buffer_changed),
self);
+
g_object_unref (buffer);
}
}
@@ -802,7 +817,7 @@ ide_buffer_manager_save_file__save_cb (GObject *object,
context = ide_object_get_context (IDE_OBJECT (self));
unsaved_files = ide_context_get_unsaved_files (context);
gfile = ide_file_get_file (state->file);
- ide_unsaved_files_update (unsaved_files, gfile, NULL);
+ ide_unsaved_files_remove (unsaved_files, gfile);
/* Notify signal handlers that the file is saved */
g_signal_emit (self, gSignals [BUFFER_SAVED], 0, state->buffer);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]