[conglomerate] Port to gtksourceview 2.4



commit bb892b7a86f4d04ece199d0601b0175ab9e06d2e
Author: P. F. Chimento <philip chimento gmail com>
Date:   Sat Aug 13 23:41:03 2011 +0200

    Port to gtksourceview 2.4
    
    Fixes bug #520588.
    
    This patch updates Conglomerate to use gtksourceview-2.0, minimum
    version 2.4, instead of gtksourceview-1.0.

 configure.ac            |    4 ++--
 src/cong-parser-error.c |   12 +++++-------
 src/cong-source-view.c  |   17 ++++++++---------
 3 files changed, 15 insertions(+), 18 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 01b3139..5e8f778 100644
--- a/configure.ac
+++ b/configure.ac
@@ -43,7 +43,7 @@ LIBGLADE2_REQUIRED=2.0.0
 LIBFO_REQUIRED=0.2.3
 SEWFOX_REQUIRED=0.0.0
 GCONF2_REQUIRED=1.2.0
-GTKSOURCEVIEW_REQUIRED=0.6
+GTKSOURCEVIEW_REQUIRED=2.4
 ENCHANT_REQUIRED=0.1.0
 
 dnl --- Fundamentals ---
@@ -151,7 +151,7 @@ AC_ARG_ENABLE(gtksourceview, [  --enable-gtksourceview  build with GtkSourceView
 
 if test x$enable_gtksourceview = xauto || test x$enable_gtksourceview = xyes ; then
         PKG_CHECK_MODULES(GTKSOURCEVIEW, \
-                          gtksourceview-1.0 >= $GTKSOURCEVIEW_REQUIRED, \
+                          gtksourceview-2.0 >= $GTKSOURCEVIEW_REQUIRED, \
                           have_gtksourceview=yes, have_gtksourceview=no)
         if test x"$have_gtksourceview" = "xyes"; then
                 enable_gtksourceview=yes
diff --git a/src/cong-parser-error.c b/src/cong-parser-error.c
index 70d093f..e5dc971 100644
--- a/src/cong-parser-error.c
+++ b/src/cong-parser-error.c
@@ -4,7 +4,7 @@
 
 #ifdef ENABLE_GTKSOURCEVIEW
 #include <gtksourceview/gtksourceview.h>
-#include <gtksourceview/gtksourcelanguagesmanager.h>
+#include <gtksourceview/gtksourcelanguagemanager.h>
 #endif
 
 #include "global.h"
@@ -205,7 +205,7 @@ cong_parser_result_dialog_new(CongParserResult *parser_result)
 	GtkWidget *text_view;
 #ifdef ENABLE_GTKSOURCEVIEW
         GtkSourceBuffer *text_buffer;
-        GtkSourceLanguagesManager *lang_manager;
+        GtkSourceLanguageManager *lang_manager;
         GtkSourceLanguage *lang;
 #else
         GtkTextBuffer *text_buffer;
@@ -244,14 +244,12 @@ cong_parser_result_dialog_new(CongParserResult *parser_result)
 
 
 #ifdef ENABLE_GTKSOURCEVIEW
-        lang_manager = gtk_source_languages_manager_new();
-        lang = gtk_source_languages_manager_get_language_from_mime_type(lang_manager, "text/xml");
+        lang_manager = gtk_source_language_manager_get_default();
+        lang = gtk_source_language_manager_get_language(lang_manager, "xml");
         text_buffer = gtk_source_buffer_new_with_language(lang);
         text_view = gtk_source_view_new_with_buffer(text_buffer);
-        gtk_source_buffer_set_highlight(text_buffer, TRUE);
+        gtk_source_buffer_set_highlight_syntax(text_buffer, TRUE);
         gtk_source_view_set_show_line_numbers(GTK_SOURCE_VIEW(text_view), TRUE);
-        g_object_unref(lang_manager);
-        g_object_unref(lang);
 #else
 	text_view = gtk_text_view_new ();
 	text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
diff --git a/src/cong-source-view.c b/src/cong-source-view.c
index ce5ee29..eea6954 100644
--- a/src/cong-source-view.c
+++ b/src/cong-source-view.c
@@ -8,7 +8,7 @@
 
 #ifdef ENABLE_GTKSOURCEVIEW
 #include <gtksourceview/gtksourceview.h>
-#include <gtksourceview/gtksourcelanguagesmanager.h>
+#include <gtksourceview/gtksourcelanguagemanager.h>
 #include <gtksourceview/gtksourcelanguage.h>
 #endif
 
@@ -332,7 +332,7 @@ cong_util_make_source_view (const gchar *source_mime_type,
 			    GtkTextView **output_text_view)
 {
 #ifdef ENABLE_GTKSOURCEVIEW
-        GtkSourceLanguagesManager *lang_manager;
+        GtkSourceLanguageManager *lang_manager;
         GtkSourceLanguage *lang;
         GtkSourceBuffer *text_buffer;
         GtkSourceView *text_view;
@@ -348,15 +348,14 @@ cong_util_make_source_view (const gchar *source_mime_type,
 					GTK_POLICY_AUTOMATIC);
 
 #ifdef ENABLE_GTKSOURCEVIEW
-        lang_manager = gtk_source_languages_manager_new ();
-        lang = gtk_source_languages_manager_get_language_from_mime_type (lang_manager, 
-									 source_mime_type);
+        lang_manager = gtk_source_language_manager_get_default ();
+        lang = gtk_source_language_manager_guess_language (lang_manager,
+                                                           NULL,
+                                                           source_mime_type);
         text_buffer = gtk_source_buffer_new_with_language (lang);
 	text_view = GTK_SOURCE_VIEW (gtk_source_view_new_with_buffer (text_buffer));
-        gtk_source_buffer_set_highlight (text_buffer, 
-					 TRUE);
-        g_object_unref(lang_manager);
-        g_object_unref(lang);
+        gtk_source_buffer_set_highlight_syntax (text_buffer,
+                                                TRUE);
 #else
         text_buffer = gtk_text_buffer_new (NULL);
         text_view = GTK_TEXT_VIEW (gtk_text_view_new_with_buffer(text_buffer));



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