[gtksourceview/wip/loader-saver: 19/19] FileLoader: update GtkSourceFile location directly
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/loader-saver: 19/19] FileLoader: update GtkSourceFile location directly
- Date: Fri, 27 Jun 2014 21:57:06 +0000 (UTC)
commit 3beeba8a005e70a0faeed27ee98d0ecdce5f9fcd
Author: Sébastien Wilmet <swilmet gnome org>
Date: Mon Jun 23 13:43:53 2014 +0200
FileLoader: update GtkSourceFile location directly
gtksourceview/gtksourcefileloader.c | 29 ++++++++++++++++++++---------
1 files changed, 20 insertions(+), 9 deletions(-)
---
diff --git a/gtksourceview/gtksourcefileloader.c b/gtksourceview/gtksourcefileloader.c
index 7f9dc06..b3e073f 100644
--- a/gtksourceview/gtksourcefileloader.c
+++ b/gtksourceview/gtksourcefileloader.c
@@ -885,6 +885,23 @@ gtk_source_file_loader_load_async (GtkSourceFileLoader *loader,
g_print ("Start loading\n");
});
+ /* Update GtkSourceFile location directly. The other GtkSourceFile
+ * properties are updated when the operation is finished. But since the
+ * file is loaded, the previous contents is lost, so the previous
+ * location is anyway not needed. And for display purposes, the new
+ * location is directly needed (for example to display the filename in a
+ * tab or an info bar with the progress information).
+ */
+ if (loader->priv->input_stream_property != NULL)
+ {
+ gtk_source_file_set_location (loader->priv->file, NULL);
+ }
+ else
+ {
+ gtk_source_file_set_location (loader->priv->file,
+ loader->priv->location);
+ }
+
implicit_trailing_newline = gtk_source_buffer_get_implicit_trailing_newline (buffer);
/* The BufferOutputStream has a strong reference to the buffer.
@@ -957,15 +974,9 @@ gtk_source_file_loader_load_finish (GtkSourceFileLoader *loader,
if (update_buffer_properties && loader->priv->file != NULL)
{
- if (loader->priv->input_stream_property != NULL)
- {
- gtk_source_file_set_location (loader->priv->file, NULL);
- }
- else
- {
- gtk_source_file_set_location (loader->priv->file,
- loader->priv->location);
- }
+ /* The location is already updated at the beginning of the
+ * operation.
+ */
_gtk_source_file_set_encoding (loader->priv->file,
loader->priv->auto_detected_encoding);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]