[gtksourceview/wip/loader-saver: 36/42] File loading: get state on successful load



commit 41d65c3d8bb6936e54c788c81f34d9ec36818f63
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Fri Mar 7 19:17:59 2014 +0100

    File loading: get state on successful load

 gtksourceview/gtksourcefile.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/gtksourceview/gtksourcefile.c b/gtksourceview/gtksourcefile.c
index 72cdf78..c42e565 100644
--- a/gtksourceview/gtksourcefile.c
+++ b/gtksourceview/gtksourcefile.c
@@ -562,6 +562,9 @@ gtk_source_file_load_finish (GtkSourceFile  *file,
                             GError        **error)
 {
        gboolean ok;
+       const GtkSourceEncoding *encoding;
+       GtkSourceNewlineType newline_type;
+       GtkSourceCompressionType compression_type;
 
        g_return_val_if_fail (GTK_SOURCE_IS_FILE (file), FALSE);
        g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
@@ -575,6 +578,19 @@ gtk_source_file_load_finish (GtkSourceFile  *file,
 
        ok = gtk_source_file_loader_load_finish (file->priv->loader, result, error);
 
+       encoding = gtk_source_file_loader_get_encoding (file->priv->loader);
+
+       if (encoding != NULL)
+       {
+               gtk_source_file_set_encoding (file, encoding);
+       }
+
+       newline_type = gtk_source_file_loader_get_newline_type (file->priv->loader);
+       gtk_source_file_set_newline_type (file, newline_type);
+
+       compression_type = gtk_source_file_loader_get_compression_type (file->priv->loader);
+       gtk_source_file_set_compression_type (file, compression_type);
+
        g_clear_object (&file->priv->loader);
 
        return ok;


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