[gtksourceview/wip/get-candidate-encodings] Add gtk_source_file_loader_get_candidate_encodings()



commit aceee63d29c1f6b29309e513dd42006619e3cc0c
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Wed Jul 30 18:25:04 2014 +0200

    Add gtk_source_file_loader_get_candidate_encodings()
    
    It'll be used by gedit to get the default candidate encodings defined by
    GtkSourceView. gedit will then override the list and set it back to the
    file loader with set_canditate_encodings().
    
    And improve a little the documentation of
    gtk_source_encoding_get_default_candidates() (previous commit was done a
    little too quickly, guadec effect).

 docs/reference/gtksourceview-3.0-sections.txt |    2 ++
 gtksourceview/gtksourceencoding.c             |    5 ++++-
 gtksourceview/gtksourcefileloader.c           |   16 ++++++++++++++++
 gtksourceview/gtksourcefileloader.h           |    3 +++
 4 files changed, 25 insertions(+), 1 deletions(-)
---
diff --git a/docs/reference/gtksourceview-3.0-sections.txt b/docs/reference/gtksourceview-3.0-sections.txt
index fe3c0b4..8eac758 100644
--- a/docs/reference/gtksourceview-3.0-sections.txt
+++ b/docs/reference/gtksourceview-3.0-sections.txt
@@ -222,6 +222,7 @@ gtk_source_encoding_to_string
 gtk_source_encoding_get_name
 gtk_source_encoding_get_charset
 gtk_source_encoding_foreach
+gtk_source_encoding_get_default_candidates
 gtk_source_encoding_copy
 gtk_source_encoding_free
 <SUBSECTION Standard>
@@ -267,6 +268,7 @@ GtkSourceFileLoaderError
 gtk_source_file_loader_new
 gtk_source_file_loader_new_from_stream
 gtk_source_file_loader_set_candidate_encodings
+gtk_source_file_loader_get_candidate_encodings
 gtk_source_file_loader_get_buffer
 gtk_source_file_loader_get_file
 gtk_source_file_loader_get_location
diff --git a/gtksourceview/gtksourceencoding.c b/gtksourceview/gtksourceencoding.c
index 870a4b6..d50a0bc 100644
--- a/gtksourceview/gtksourceencoding.c
+++ b/gtksourceview/gtksourceencoding.c
@@ -490,8 +490,11 @@ gtk_source_encoding_get_name (const GtkSourceEncoding* enc)
 /**
  * gtk_source_encoding_get_default_candidates:
  *
+ * Gets a list of candidate encodings that can be used for a
+ * #GtkSourceFileLoader.
+ *
  * Returns: (transfer container) (element-type GtkSource.Encoding): the list of
- * default candidates encodings. Free with g_slist_free().
+ * default candidate encodings. Free with g_slist_free().
  */
 GSList *
 gtk_source_encoding_get_default_candidates (void)
diff --git a/gtksourceview/gtksourcefileloader.c b/gtksourceview/gtksourcefileloader.c
index f297a9e..78c114c 100644
--- a/gtksourceview/gtksourcefileloader.c
+++ b/gtksourceview/gtksourcefileloader.c
@@ -888,6 +888,22 @@ gtk_source_file_loader_set_candidate_encodings (GtkSourceFileLoader *loader,
 }
 
 /**
+ * gtk_source_file_loader_get_candidate_encodings:
+ * @loader: a #GtkSourceFileLoader.
+ *
+ * Returns: (transfer none) (element-type GtkSource.Encoding): the candidate
+ * encodings.
+ * Since: 3.14
+ */
+GSList *
+gtk_source_file_loader_get_candidate_encodings (GtkSourceFileLoader *loader)
+{
+       g_return_val_if_fail (GTK_SOURCE_IS_FILE_LOADER (loader), NULL);
+
+       return loader->priv->candidate_encodings;
+}
+
+/**
  * gtk_source_file_loader_get_buffer:
  * @loader: a #GtkSourceFileLoader.
  *
diff --git a/gtksourceview/gtksourcefileloader.h b/gtksourceview/gtksourcefileloader.h
index 59d67b6..89af8c9 100644
--- a/gtksourceview/gtksourcefileloader.h
+++ b/gtksourceview/gtksourcefileloader.h
@@ -88,6 +88,9 @@ void                   gtk_source_file_loader_set_candidate_encodings
                                                                (GtkSourceFileLoader     *loader,
                                                                 GSList                  
*candidate_encodings);
 
+GSList                 *gtk_source_file_loader_get_candidate_encodings
+                                                               (GtkSourceFileLoader     *loader);
+
 GtkSourceBuffer                *gtk_source_file_loader_get_buffer      (GtkSourceFileLoader     *loader);
 
 GtkSourceFile          *gtk_source_file_loader_get_file        (GtkSourceFileLoader     *loader);


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