eb05362005-11-05Henrik Grubbström (Grubba) /* -*- C -*- */
08367e2005-11-04Lance Dillon require gtksourceview; class GTK2.SourceLanguagesManager; inherit G.Object; %{ #include "gtksourceview/gtksourceview.h" #include "gtksourceview/gtksourcelanguagesmanager.h" %} void create(); //! Create a new language manager. array(GTK2.SourceLanguage) get_available_languages() //! Gets a list of available languages. {
ba9e802006-02-27Martin Stjernholm  pgtk2_verify_inited(); pgtk2_pop_n_elems(args);
08367e2005-11-04Lance Dillon  { const GSList *gsl; int i=0; gsl=gtk_source_languages_manager_get_available_languages( GTK_SOURCE_LANGUAGES_MANAGER(THIS->obj)); while (gsl) { push_gobject(gsl->data); g_object_ref(gsl->data); i++; gsl=g_slist_next(gsl); } f_aggregate(i); } } GTK2.SourceLanguage get_language_from_mime_type(string type); //! Gets the GTK2.SourceLanguage which is associated with the given type in the //! language manager. GTK2.SourceLanguage get_language_from_name(string name) //! Gets the GTK2.SourceLanguage which has this name. {
ba9e802006-02-27Martin Stjernholm  pgtk2_verify_inited();
cdebf82005-12-30Martin Nilsson  {
08367e2005-11-04Lance Dillon  char *name; const GSList *gsl; int sel=0;
387b962006-01-03Marcus Comstedt  get_all_args("get_language_from_name", args, "%s", &name);
08367e2005-11-04Lance Dillon  gsl=gtk_source_languages_manager_get_available_languages( GTK_SOURCE_LANGUAGES_MANAGER(THIS->obj)); while (gsl) { if (!strcmp(gtk_source_language_get_name( GTK_SOURCE_LANGUAGE(gsl->data)),name)) {
ba9e802006-02-27Martin Stjernholm  pgtk2_pop_n_elems(args);
08367e2005-11-04Lance Dillon  push_gobject(gsl->data); g_object_ref(gsl->data); sel=1; break; } gsl=g_slist_next(gsl); }
cdebf82005-12-30Martin Nilsson  if (!sel) {
ba9e802006-02-27Martin Stjernholm  pgtk2_pop_n_elems(args);
08367e2005-11-04Lance Dillon  push_int(0);
cdebf82005-12-30Martin Nilsson  }
08367e2005-11-04Lance Dillon  } } array(string) get_lang_files_dirs() //! Gets a list of language files directories. {
ba9e802006-02-27Martin Stjernholm  pgtk2_verify_inited(); pgtk2_pop_n_elems(args);
08367e2005-11-04Lance Dillon  {
cc0b572008-01-22Henrik Grubbström (Grubba)  const GSList *gsl;
08367e2005-11-04Lance Dillon  int i=0;
cc0b572008-01-22Henrik Grubbström (Grubba)  gsl=gtk_source_languages_manager_get_lang_files_dirs(
08367e2005-11-04Lance Dillon  GTK_SOURCE_LANGUAGES_MANAGER(THIS->obj));
cc0b572008-01-22Henrik Grubbström (Grubba)  while (gsl) {
74a5dd2010-09-19Marcus Comstedt  PGTK_PUSH_GCHAR(gsl->data);
08367e2005-11-04Lance Dillon  i++;
cc0b572008-01-22Henrik Grubbström (Grubba)  gsl=g_slist_next(gsl);
08367e2005-11-04Lance Dillon  } f_aggregate(i); } }