// -*- C++ -*- //

/* config.h
 *
 * Copyright 2006 libgdamm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <glibmm/object.h>
#include <libgdamm/serverprovider.h>
#include <libgdamm/datamodel.h>
#include <libgda/gda-config.h>

_DEFS(libgdamm,libgda)
_PINCLUDE(glibmm/private/object_p.h)

namespace Gnome
{

namespace Gda
{

_WRAP_GERROR(ConfigError, GdaConfigError, GDA_CONFIG_ERROR)


/** Configuration — Access/Management of libgda configuration.
 *
 * @ingroup Configuration
 */
class Config : public Glib::Object
{
  _CLASS_GOBJECT(Config, GdaConfig, GDA_CONFIG, Glib::Object, GObject)
protected:
  _CTOR_DEFAULT;
public:
  _WRAP_METHOD(static Glib::RefPtr<Config> get(), gda_config_get, refreturn)

  _WRAP_METHOD(static GdaDsnInfo* get_dsn_info(const Glib::ustring& dsn_name), gda_config_get_dsn_info)
  _WRAP_METHOD(static bool dsn_needs_authentication(const Glib::ustring& dsn_name), gda_config_dsn_needs_authentication)

  _WRAP_METHOD(static Glib::RefPtr<DataModel> list_dsn(), gda_config_list_dsn)

  _WRAP_METHOD(static Glib::RefPtr<ServerProvider> get_provider(const Glib::ustring& provider_name), gda_config_get_provider, errthrow)

  _WRAP_METHOD(static Glib::RefPtr<DataModel> list_providers(), gda_config_list_providers)

  _WRAP_METHOD(static int get_nb_dsn(), gda_config_get_nb_dsn)

  _WRAP_METHOD(static bool can_modify_system_config(), gda_config_can_modify_system_config)

  #m4 _CONVERSION(`gpointer',`GdaDsnInfo*',`(GdaDsnInfo*)($3)')
  _WRAP_SIGNAL(void dsn_added(GdaDsnInfo* info), "dsn-added", no_default_handler)
  _WRAP_SIGNAL(void dsn_changed(GdaDsnInfo* info), "dsn-changed", no_default_handler)
  _WRAP_SIGNAL(void dsn_removed(GdaDsnInfo* info), "dsn-removed", no_default_handler)
  _WRAP_SIGNAL(void dsn_to_be_removed(GdaDsnInfo* info), "dsn-to-be-removed", no_default_handler)

  _WRAP_PROPERTY("system-filename", Glib::ustring)
  _WRAP_PROPERTY("user-filename", Glib::ustring)
};

} // namespace Gda
} // namespace Gnome
