[gtksourceview/wip/get-candidate-encodings] Make gtk_source_encoding_get_default_candidates() public



commit dcd49dfe8f6e9d0ad3090bc9f14f24c87bbc6b49
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Mar 15 15:11:56 2015 +0100

    Make gtk_source_encoding_get_default_candidates() public
    
    It's useful in gedit, to have these candidate encodings for the file
    loader:
    1. the GtkSourceFile's encoding.
    2. the encoding stored in the file's metadata.
    3. the default candidates returned by
       gtk_source_encoding_get_default_candidates(), OR a list of encodings
       stored in GSettings, if the user has modified the list.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=730622

 docs/reference/gtksourceview-3.0-sections.txt |    1 +
 gtksourceview/gtksourceencoding-private.h     |    4 ----
 gtksourceview/gtksourceencoding.c             |   10 +++++-----
 gtksourceview/gtksourceencoding.h             |    5 ++++-
 gtksourceview/gtksourcefileloader.c           |   12 ++++++------
 5 files changed, 16 insertions(+), 16 deletions(-)
---
diff --git a/docs/reference/gtksourceview-3.0-sections.txt b/docs/reference/gtksourceview-3.0-sections.txt
index 7b86ced..cd9d6a0 100644
--- a/docs/reference/gtksourceview-3.0-sections.txt
+++ b/docs/reference/gtksourceview-3.0-sections.txt
@@ -225,6 +225,7 @@ gtk_source_encoding_to_string
 gtk_source_encoding_get_name
 gtk_source_encoding_get_charset
 gtk_source_encoding_get_all
+gtk_source_encoding_get_default_candidates
 gtk_source_encoding_copy
 gtk_source_encoding_free
 <SUBSECTION Standard>
diff --git a/gtksourceview/gtksourceencoding-private.h b/gtksourceview/gtksourceencoding-private.h
index f26476c..daae66e 100644
--- a/gtksourceview/gtksourceencoding-private.h
+++ b/gtksourceview/gtksourceencoding-private.h
@@ -46,10 +46,6 @@ G_GNUC_INTERNAL
 GSList *               _gtk_source_encoding_remove_duplicates          (GSList                      
*encodings,
                                                                         GtkSourceEncodingDuplicates  
removal_type);
 
-G_GNUC_INTERNAL
-GSList *               _gtk_source_encoding_get_default_candidates     (void);
-
-
 G_END_DECLS
 
 #endif  /* __GTK_SOURCE_ENCODING_PRIVATE_H__ */
diff --git a/gtksourceview/gtksourceencoding.c b/gtksourceview/gtksourceencoding.c
index 824d951..607cc1c 100644
--- a/gtksourceview/gtksourceencoding.c
+++ b/gtksourceview/gtksourceencoding.c
@@ -3,7 +3,7 @@
  * This file is part of GtkSourceView
  *
  * Copyright (C) 2002-2005 - Paolo Maggi
- * Copyright (C) 2014 - Sébastien Wilmet <swilmet gnome org>
+ * Copyright (C) 2014, 2015 - Sébastien Wilmet <swilmet gnome org>
  *
  * GtkSourceView is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -609,8 +609,8 @@ _gtk_source_encoding_remove_duplicates (GSList                      *encodings,
        g_return_val_if_reached (encodings);
 }
 
-/*
- * _gtk_source_encoding_get_default_candidates:
+/**
+ * gtk_source_encoding_get_default_candidates:
  *
  * Gets the list of default candidate encodings to try when loading a file. See
  * gtk_source_file_loader_set_candidate_encodings().
@@ -621,10 +621,10 @@ _gtk_source_encoding_remove_duplicates (GSList                      *encodings,
  *
  * Returns: (transfer container) (element-type GtkSource.Encoding): the list of
  * default candidate encodings. Free with g_slist_free().
- * Since: 3.14
+ * Since: 3.18
  */
 GSList *
-_gtk_source_encoding_get_default_candidates (void)
+gtk_source_encoding_get_default_candidates (void)
 {
        const gchar *encodings_str;
        const gchar *encodings_str_translated;
diff --git a/gtksourceview/gtksourceencoding.h b/gtksourceview/gtksourceencoding.h
index 19db205..8b6f849 100644
--- a/gtksourceview/gtksourceencoding.h
+++ b/gtksourceview/gtksourceencoding.h
@@ -3,7 +3,7 @@
  * This file is part of GtkSourceView
  *
  * Copyright (C) 2002-2005 - Paolo Maggi
- * Copyright (C) 2014 - Sébastien Wilmet <swilmet gnome org>
+ * Copyright (C) 2014, 2015 - Sébastien Wilmet <swilmet gnome org>
  *
  * GtkSourceView is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -45,6 +45,9 @@ const GtkSourceEncoding       *gtk_source_encoding_get_current        (void);
 
 GSList                 *gtk_source_encoding_get_all            (void);
 
+GSList                 *gtk_source_encoding_get_default_candidates
+                                                               (void);
+
 /* These should not be used, they are just to make python bindings happy */
 GtkSourceEncoding      *gtk_source_encoding_copy               (const GtkSourceEncoding *enc);
 void                    gtk_source_encoding_free               (GtkSourceEncoding       *enc);
diff --git a/gtksourceview/gtksourcefileloader.c b/gtksourceview/gtksourcefileloader.c
index d74cdcc..0be985d 100644
--- a/gtksourceview/gtksourcefileloader.c
+++ b/gtksourceview/gtksourcefileloader.c
@@ -273,7 +273,7 @@ set_default_candidate_encodings (GtkSourceFileLoader *loader)
         * GtkSourceFile's encoding has been set by a FileLoader or FileSaver,
         * put it at the beginning of the list.
         */
-       list = _gtk_source_encoding_get_default_candidates ();
+       list = gtk_source_encoding_get_default_candidates ();
 
        if (loader->priv->file == NULL)
        {
@@ -885,11 +885,11 @@ gtk_source_file_loader_new_from_stream (GtkSourceBuffer *buffer,
  * For convenience, @candidate_encodings can contain duplicates. Only the first
  * occurrence of a duplicated encoding is kept in the list.
  *
- * By default the candidate encodings are (in that order):
- * 1. If set, the #GtkSourceFile's encoding. See gtk_source_file_get_encoding().
- * 2. Depending on the current locale (language and country), a list of common
- * encodings are added. The UTF-8 encoding and the current locale encoding are
- * always present.
+ * By default the candidate encodings are (in that order in the list):
+ * 1. If set, the #GtkSourceFile's encoding as returned by
+ * gtk_source_file_get_encoding().
+ * 2. The default candidates as returned by
+ * gtk_source_encoding_get_default_candidates().
  *
  * Since: 3.14
  */


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