/* sourcelanguagemanager.cc
 *
 * Copyright (C) 2004-2005 Jae Jang
 * Copyright (C) 2005-2006 Rob Page
 * Copyright (C) 2006 Dodji Seketeli
 * Copyright (C) 2009, 2010 Krzesimir Nowak
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include "gtksourceviewmm/sourcelanguagemanager.h"

namespace gtksourceview
{

void
SourceLanguageManager::reset_search_path()
{
  gtk_source_language_manager_set_search_path(gobj(), 0);
}

Glib::RefPtr<SourceLanguage> SourceLanguageManager::guess_language(const Glib::ustring& filename, const Glib::ustring& content_type)
{
  Glib::RefPtr<SourceLanguage> retvalue = Glib::wrap(gtk_source_language_manager_guess_language(gobj(), filename.empty() ? 0 : filename.c_str(), content_type.empty() ? 0 : content_type.c_str()));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;

}

Glib::RefPtr<const SourceLanguage> SourceLanguageManager::guess_language(const Glib::ustring& filename, const Glib::ustring& content_type) const
{
  return const_cast<SourceLanguageManager*>(this)->guess_language(filename, content_type);
}

}//end namespace gtksourceview

