Don't present users with the hidden highlight languages (#167)

Fixes a crash when choosing 'Defaults' as the the highlight language.

Adapted from 0434e2f918

Closes https://github.com/linuxmint/xed/issues/160
This commit is contained in:
JosephMcc 2017-09-05 00:21:09 -07:00 committed by Clement Lefebvre
parent 1f85332906
commit 54a8c6c616
1 changed files with 16 additions and 8 deletions

View File

@ -837,8 +837,12 @@ get_languages_sorted_by_section (XedWindow *window)
GtkSourceLanguage *lang; GtkSourceLanguage *lang;
lang = gtk_source_language_manager_get_language (lm, ids[i]); lang = gtk_source_language_manager_get_language (lm, ids[i]);
if (!gtk_source_language_get_hidden (lang))
{
languages = g_slist_prepend (languages, lang); languages = g_slist_prepend (languages, lang);
} }
}
return g_slist_sort (languages, (GCompareFunc)language_compare); return g_slist_sort (languages, (GCompareFunc)language_compare);
} }
@ -1691,6 +1695,9 @@ fill_language_combo (XedWindow *window)
GtkSourceLanguage *lang; GtkSourceLanguage *lang;
lang = gtk_source_language_manager_get_language (lm, ids[i]); lang = gtk_source_language_manager_get_language (lm, ids[i]);
if (!gtk_source_language_get_hidden (lang))
{
name = gtk_source_language_get_name (lang); name = gtk_source_language_get_name (lang);
menu_item = gtk_menu_item_new_with_label (name); menu_item = gtk_menu_item_new_with_label (name);
gtk_widget_show (menu_item); gtk_widget_show (menu_item);
@ -1701,6 +1708,7 @@ fill_language_combo (XedWindow *window)
GTK_MENU_ITEM (menu_item), name); GTK_MENU_ITEM (menu_item), name);
} }
} }
}
static void static void
create_statusbar (XedWindow *window, create_statusbar (XedWindow *window,