[gtksourceview/wip/loader-saver] FileLoader: default candidate encodings
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/loader-saver] FileLoader: default candidate encodings
- Date: Wed, 2 Apr 2014 17:59:57 +0000 (UTC)
commit fcc71ff49ccfe976c37d01f4ada704f00cded888
Author: Sébastien Wilmet <swilmet gnome org>
Date: Wed Apr 2 19:45:10 2014 +0200
FileLoader: default candidate encodings
gtksourceview/gtksourcefileloader.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/gtksourceview/gtksourcefileloader.c b/gtksourceview/gtksourcefileloader.c
index 4b5b43d..0fcc28b 100644
--- a/gtksourceview/gtksourcefileloader.c
+++ b/gtksourceview/gtksourcefileloader.c
@@ -223,6 +223,24 @@ gtk_source_file_loader_dispose (GObject *object)
}
static void
+gtk_source_file_loader_constructed (GObject *object)
+{
+ GtkSourceFileLoader *loader = GTK_SOURCE_FILE_LOADER (object);
+
+ if (loader->priv->source_buffer != NULL)
+ {
+ const GtkSourceEncoding *encoding;
+
+ encoding = gtk_source_buffer_get_encoding (loader->priv->source_buffer);
+
+ g_slist_free (loader->priv->candidate_encodings);
+ loader->priv->candidate_encodings = g_slist_prepend (NULL, (gpointer) encoding);
+ }
+
+ G_OBJECT_CLASS (gtk_source_file_loader_parent_class)->dispose (object);
+}
+
+static void
gtk_source_file_loader_class_init (GtkSourceFileLoaderClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -230,6 +248,7 @@ gtk_source_file_loader_class_init (GtkSourceFileLoaderClass *klass)
object_class->dispose = gtk_source_file_loader_dispose;
object_class->get_property = gtk_source_file_loader_get_property;
object_class->set_property = gtk_source_file_loader_set_property;
+ object_class->constructed = gtk_source_file_loader_constructed;
/**
* GtkSourceFileLoader:buffer:
@@ -729,6 +748,9 @@ gtk_source_file_loader_new_from_stream (GtkSourceBuffer *buffer,
* Sets the candidate encodings for the file loading. The encodings are tried in
* the same order as the list.
*
+ * There is by default only one candidate encoding, the #GtkSourceBuffer's
+ * encoding.
+ *
* Since: 3.14
*/
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]