[gtranslator] XML language syntax for the source view
- From: Daniel Garcia Moreno <danigm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtranslator] XML language syntax for the source view
- Date: Sun, 3 Feb 2019 19:53:21 +0000 (UTC)
commit 0e2ea579a668052b0026d9822b7a87aa644323e6
Author: Daniel GarcĂa Moreno <dani danigm net>
Date: Sun Feb 3 20:52:00 2019 +0100
XML language syntax for the source view
See #50
src/gtr-view.c | 8 ++++++++
1 file changed, 8 insertions(+)
---
diff --git a/src/gtr-view.c b/src/gtr-view.c
index bc91a716..1db3e113 100644
--- a/src/gtr-view.c
+++ b/src/gtr-view.c
@@ -336,14 +336,22 @@ gtr_view_enable_visible_whitespace (GtrView * view, gboolean enable)
GtkSourceView *source;
GtkSourceSpaceDrawer *drawer;
GtkSourceBuffer *buffer;
+ GtkSourceLanguageManager *manager;
+ GtkSourceLanguage *lang;
g_return_if_fail (GTR_IS_VIEW (view));
+ manager = gtk_source_language_manager_get_default ();
+ lang = gtk_source_language_manager_guess_language (manager, "file.xml", NULL);
+
source = GTK_SOURCE_VIEW (view);
drawer = gtk_source_view_get_space_drawer (source);
gtk_source_space_drawer_set_enable_matrix (drawer, TRUE);
buffer = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));
gtk_source_buffer_set_implicit_trailing_newline (buffer, FALSE);
+ gtk_source_buffer_set_language (buffer, lang);
+
+ gtk_source_buffer_set_highlight_syntax (buffer, TRUE);
if (enable)
gtk_source_space_drawer_set_types_for_locations (drawer,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]