diff -Naurp gobby-0.4.5orig/ChangeLog gobby-0.4.5/ChangeLog --- gobby-0.4.5orig/ChangeLog 2007-08-18 12:42:48.000000000 -0500 +++ gobby-0.4.5/ChangeLog 2008-01-13 16:52:20.000000000 -0600 @@ -1,3 +1,11 @@ +2007-09-17 Armin Burgmeier + + * src/preferencesdialog.cpp: + * src/header.cpp: + * src/docwindow.cpp: + * src/preferences.cpp: Adapted to latest (and final) GtkSourceView2 + API. + 2007-08-18 Armin Burgmeier * src/icon.cpp: Win32 build fix. @@ -2636,4 +2644,3 @@ 2005-03-30 Armin Burgmeier Empty gobby window - diff -Naurp gobby-0.4.5orig/src/docwindow.cpp gobby-0.4.5/src/docwindow.cpp --- gobby-0.4.5orig/src/docwindow.cpp 2007-08-18 11:02:12.000000000 -0500 +++ gobby-0.4.5/src/docwindow.cpp 2008-01-13 16:52:20.000000000 -0600 @@ -16,12 +16,13 @@ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "features.hpp" + #include #include -#include "features.hpp" #ifdef WITH_GTKSOURCEVIEW2 -# include +# include #endif #include "preferences.hpp" @@ -69,7 +70,7 @@ Gobby::DocWindow::DocWindow(LocalDocumen Glib::wrap(GTK_TEXT_BUFFER(buffer), true); // Set source language by filename - gtk_source_buffer_set_highlight(buffer, FALSE); + gtk_source_buffer_set_highlight_syntax(buffer, FALSE); for(Preferences::FileList::iterator iter = preferences.files.begin(); iter != preferences.files.end(); @@ -79,7 +80,7 @@ Gobby::DocWindow::DocWindow(LocalDocumen if(spec.match(info.get_title()) ) { gtk_source_buffer_set_language(buffer, iter.language()); - gtk_source_buffer_set_highlight(buffer, TRUE); + gtk_source_buffer_set_highlight_syntax(buffer, TRUE); } } @@ -87,10 +88,10 @@ Gobby::DocWindow::DocWindow(LocalDocumen // Set a theme so we see anything. // TODO: This should be temporary code until gtksourceview2 sets a default // theme. - GtkSourceStyleManager* sm = gtk_source_style_manager_new(); +/* GtkSourceStyleManager* sm = gtk_source_style_manager_new(); GtkSourceStyleScheme* scheme = gtk_source_style_manager_get_scheme(sm, "gvim"); gtk_source_buffer_set_style_scheme(buffer, scheme); - g_object_unref(G_OBJECT(sm)); + g_object_unref(G_OBJECT(sm));*/ #endif cpp_buffer->signal_mark_set().connect( @@ -224,7 +225,7 @@ void Gobby::DocWindow::set_language(GtkS gtk_text_view_get_buffer(GTK_TEXT_VIEW(m_view))); gtk_source_buffer_set_language(buffer, language); - gtk_source_buffer_set_highlight(buffer, language != NULL); + gtk_source_buffer_set_highlight_syntax(buffer, language != NULL); m_signal_language_changed.emit(); } @@ -342,7 +343,7 @@ void Gobby::DocWindow::apply_preferences { GtkTextBuffer* buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(m_view)); - gtk_source_view_set_tabs_width(GTK_SOURCE_VIEW(m_view), + gtk_source_view_set_tab_width(GTK_SOURCE_VIEW(m_view), m_preferences.editor.tab_width); gtk_source_view_set_insert_spaces_instead_of_tabs(GTK_SOURCE_VIEW(m_view), m_preferences.editor.tab_spaces); @@ -364,11 +365,11 @@ void Gobby::DocWindow::apply_preferences m_preferences.view.linenum_display); gtk_source_view_set_highlight_current_line(GTK_SOURCE_VIEW(m_view), m_preferences.view.curline_highlight); - gtk_source_view_set_show_margin(GTK_SOURCE_VIEW(m_view), + gtk_source_view_set_show_right_margin(GTK_SOURCE_VIEW(m_view), m_preferences.view.margin_display); - gtk_source_view_set_margin(GTK_SOURCE_VIEW(m_view), + gtk_source_view_set_right_margin_position(GTK_SOURCE_VIEW(m_view), m_preferences.view.margin_pos); - gtk_source_buffer_set_check_brackets(GTK_SOURCE_BUFFER(buffer), + gtk_source_buffer_set_highlight_matching_brackets(GTK_SOURCE_BUFFER(buffer), m_preferences.view.bracket_highlight); gtk_widget_modify_font(GTK_WIDGET(m_view), m_preferences.font.desc.gobj()); diff -Naurp gobby-0.4.5orig/src/header.cpp gobby-0.4.5/src/header.cpp --- gobby-0.4.5orig/src/header.cpp 2007-08-18 11:02:12.000000000 -0500 +++ gobby-0.4.5/src/header.cpp 2008-01-13 16:52:20.000000000 -0600 @@ -97,7 +97,7 @@ namespace { gunichar c = *iter; // Not an ASCII character, or a dangerous one? - if(c == '<' || c == '>' || c == '\"' || c > 0x7f) + if(c == '<' || c == '>' || c == '\"' || c > 0x7f || Glib::Unicode::isspace(c)) { // Get next iter to find the end position Glib::ustring::iterator next = iter; @@ -610,15 +610,21 @@ Gobby::Header::Header(const ApplicationS // Get available languages #ifdef WITH_GTKSOURCEVIEW2 - const GSList* list = gtk_source_language_manager_list_languages( - lang_mgr); + GSList* lang_list = NULL; + const gchar* const* ids = gtk_source_language_manager_get_language_ids(lang_mgr); + for(const gchar* const* id = ids; *id != NULL; ++ id) + { + GtkSourceLanguage* language = gtk_source_language_manager_get_language(lang_mgr, *id); + lang_list = g_slist_prepend(lang_list, language); + } #else const GSList* list = gtk_source_languages_manager_get_available_languages( lang_mgr); -#endif - // Copy the last, so we can sort languages by name + // Copy the list, so we can sort languages by name GSList* lang_list = g_slist_copy(const_cast(list)); +#endif + lang_list = g_slist_sort(lang_list, &language_sort_callback); // Add None-Language diff -Naurp gobby-0.4.5orig/src/preferences.cpp gobby-0.4.5/src/preferences.cpp --- gobby-0.4.5orig/src/preferences.cpp 2007-08-18 11:02:12.000000000 -0500 +++ gobby-0.4.5/src/preferences.cpp 2008-01-13 16:52:20.000000000 -0600 @@ -32,15 +32,18 @@ namespace const gchar* mime_type) { #ifdef WITH_GTKSOURCEVIEW2 - const GSList* list = - gtk_source_language_manager_list_languages(manager); + const gchar* const* ids = gtk_source_language_manager_get_language_ids(manager); - for(; list != NULL; list = list->next) + for(const gchar* const* id = ids; *id != NULL; ++ id) { + GtkSourceLanguage* language = gtk_source_language_manager_get_language(manager, *id); + g_assert(language != NULL); + gchar** mime_types = gtk_source_language_get_mime_types( - GTK_SOURCE_LANGUAGE(list->data) + GTK_SOURCE_LANGUAGE(language) ); + if(mime_types != NULL) { for(gchar** type = mime_types; *type != NULL; ++type) @@ -48,7 +51,7 @@ namespace if(strcmp(mime_type, *type) == 0) { g_strfreev(mime_types); - return GTK_SOURCE_LANGUAGE(list->data); + return language; } } @@ -251,12 +254,12 @@ Gobby::Preferences::FileList::FileList(C else { #ifdef WITH_GTKSOURCEVIEW2 - const GSList* list = gtk_source_language_manager_list_languages( - lang_mgr); + const gchar* const* ids = gtk_source_language_manager_get_language_ids(lang_mgr); - for(; list != NULL; list = list->next) + for(const gchar* const* id = ids; *id != NULL; ++ id) { - GtkSourceLanguage* language = GTK_SOURCE_LANGUAGE(list->data); + GtkSourceLanguage* language = gtk_source_language_manager_get_language(lang_mgr, *id); + gchar** globs = gtk_source_language_get_globs(language); if(globs != NULL) { diff -Naurp gobby-0.4.5orig/src/preferencesdialog.cpp gobby-0.4.5/src/preferencesdialog.cpp --- gobby-0.4.5orig/src/preferencesdialog.cpp 2007-08-18 11:02:12.000000000 -0500 +++ gobby-0.4.5/src/preferencesdialog.cpp 2008-01-13 16:52:20.000000000 -0600 @@ -349,14 +349,19 @@ Gobby::PreferencesDialog::FileList::File m_file_list(Gtk::ListStore::create(file_columns) ) { #ifdef WITH_GTKSOURCEVIEW2 - const GSList* list = - gtk_source_language_manager_list_languages(lang_mgr); + GSList* languages = NULL; + const gchar* const* ids = gtk_source_language_manager_get_language_ids(lang_mgr); + for(const gchar* const* id = ids; *id != NULL; ++ id) + { + GtkSourceLanguage* language = gtk_source_language_manager_get_language(lang_mgr, *id); + languages = g_slist_prepend(languages, language); + } #else const GSList* list = gtk_source_languages_manager_get_available_languages(lang_mgr); + GSList* languages = g_slist_copy(const_cast(list)); #endif - GSList* languages = g_slist_copy(const_cast(list)); languages = g_slist_sort(languages, &lang_sort); for(GSList* iter = languages; iter != NULL; iter = iter->next) @@ -520,13 +525,13 @@ void Gobby::PreferencesDialog::FileList: const Glib::ustring& new_text) { #ifdef WITH_GTKSOURCEVIEW2 - const GSList* list = - gtk_source_language_manager_list_languages(m_lang_mgr); + const gchar* const* ids = gtk_source_language_manager_get_language_ids(m_lang_mgr); GtkSourceLanguage* lang = NULL; - for(; list != NULL; list = list->next) + for(const gchar* const* id = ids; *id != NULL; ++ id) { - GtkSourceLanguage* language = GTK_SOURCE_LANGUAGE(list->data); + GtkSourceLanguage* language = gtk_source_language_manager_get_language(m_lang_mgr, *id); + gchar** mime_types = gtk_source_language_get_mime_types(language); for(gchar** mime_type = mime_types; *mime_type != NULL; ++ mime_type) {