[gtksourceview/wip/encodings: 6/6] Ensure that UTF-8 and CURRENT are present in the candidate encodings
- From: SĂŠbastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/encodings: 6/6] Ensure that UTF-8 and CURRENT are present in the candidate encodings
- Date: Tue, 12 Aug 2014 14:12:03 +0000 (UTC)
commit 68a073eb10c320096f9c9026563162e513efdee8
Author: SĂŠbastien Wilmet <swilmet gnome org>
Date: Sun Aug 10 21:59:40 2014 +0200
Ensure that UTF-8 and CURRENT are present in the candidate encodings
In the gedit translations, CURRENT was sometimes translated (and there
is a translator comment to explain that it should not be translated...).
So it's better to ensure that UTF-8 and CURRENT are present, just in
case.
gtksourceview/gtksourceencoding.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/gtksourceview/gtksourceencoding.c b/gtksourceview/gtksourceencoding.c
index 40421e4..acf9e7b 100644
--- a/gtksourceview/gtksourceencoding.c
+++ b/gtksourceview/gtksourceencoding.c
@@ -613,7 +613,8 @@ _gtk_source_encoding_remove_duplicates (GSList *encodings,
* gtk_source_file_loader_set_candidate_encodings().
*
* This function returns a different list depending on the current locale (i.e.
- * language, country and default encoding).
+ * language, country and default encoding). The UTF-8 encoding and the current
+ * locale encoding are guaranteed to be present in the returned list.
*
* Returns: (transfer container) (element-type GtkSource.Encoding): the list of
* default candidate encodings. Free with g_slist_free().
@@ -649,6 +650,16 @@ gtk_source_encoding_get_default_candidates (void)
encodings_list = strv_to_list (encodings_strv);
+ /* Ensure that UTF-8 and CURRENT are present. */
+ encodings_list = g_slist_prepend (encodings_list,
+ (gpointer) gtk_source_encoding_get_current ());
+
+ encodings_list = g_slist_prepend (encodings_list,
+ (gpointer) &utf8_encoding);
+
+ encodings_list = _gtk_source_encoding_remove_duplicates (encodings_list,
+ GTK_SOURCE_ENCODING_DUPLICATES_KEEP_LAST);
+
g_variant_unref (encodings_variant);
return encodings_list;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]