anjuta r4733 - in trunk: . plugins/sourceview



Author: jhs
Date: Wed Feb 11 08:39:47 2009
New Revision: 4733
URL: http://svn.gnome.org/viewvc/anjuta?rev=4733&view=rev

Log:
2009-02-11  Johannes Schmid  <jhs gnome org>

	* plugins/sourceview/sourceview.c (ilanguage_set_language):
	Don't crash when language manager returns a NULL list of languages (#570492)
	Avoid duplicated code that was causing the same behaviour as previous commit.

Modified:
   trunk/ChangeLog
   trunk/plugins/sourceview/sourceview.c

Modified: trunk/plugins/sourceview/sourceview.c
==============================================================================
--- trunk/plugins/sourceview/sourceview.c	(original)
+++ trunk/plugins/sourceview/sourceview.c	Wed Feb 11 08:39:47 2009
@@ -1939,15 +1939,13 @@
 {
 	Sourceview* sv = ANJUTA_SOURCEVIEW (ilanguage);
 	gboolean found = FALSE;
-	GStrv languages;
-	GStrv cur_lang;
-	g_object_get (G_OBJECT (gtk_source_language_manager_get_default ()), "language-ids",
-							&languages, NULL);
-	for (cur_lang = languages; *cur_lang != NULL && language != NULL; cur_lang++)
+	const GList* languages = ilanguage_get_supported_languages(ilanguage, err);
+	const GList* cur_lang;
+	for (cur_lang = languages; cur_lang != NULL && language != NULL; cur_lang = g_list_next (cur_lang))
 	{
 		GtkSourceLanguage* source_language = 
 			gtk_source_language_manager_get_language (gtk_source_language_manager_get_default(),
-													  *cur_lang);
+													  cur_lang->data);
 		const gchar* id = gtk_source_language_get_id (source_language);
 		
 		if (g_str_equal (language, id))
@@ -1960,7 +1958,6 @@
 			break;
 		}
 	}
-	g_strfreev(languages);
 	if (!found)
 	{
 		autodetect_language (sv);



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