// Generated by gtkmmproc -- DO NOT MODIFY!


#include <libgdamm/config.h>
#include <libgdamm/private/config_p.h>

// -*- C++ -*- // this is for the .ccg, I realize gensig puts one in

/* config.cc
 *
 * Copyright 2003 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 <libgdamm/config.h>
#include <libgda/gda-config.h>
#include <libgda/gda-enum-types.h>

namespace Gnome
{

namespace Gda
{

} // namespace Gda

} /* namespace Gnome */

namespace
{


static void Config_signal_dsn_added_callback(GdaConfig* self, gpointer p0,void* data)
{
  using namespace Gnome::Gda;
  typedef sigc::slot< void,GdaDsnInfo* > SlotType;

  // Do not try to call a signal on a disassociated wrapper.
  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
  {
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    try
    {
    #endif //GLIBMM_EXCEPTIONS_ENABLED
      if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))((GdaDsnInfo*)(p0)
);
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }
}

static const Glib::SignalProxyInfo Config_signal_dsn_added_info =
{
  "dsn-added",
  (GCallback) &Config_signal_dsn_added_callback,
  (GCallback) &Config_signal_dsn_added_callback
};


static void Config_signal_dsn_changed_callback(GdaConfig* self, gpointer p0,void* data)
{
  using namespace Gnome::Gda;
  typedef sigc::slot< void,GdaDsnInfo* > SlotType;

  // Do not try to call a signal on a disassociated wrapper.
  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
  {
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    try
    {
    #endif //GLIBMM_EXCEPTIONS_ENABLED
      if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))((GdaDsnInfo*)(p0)
);
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }
}

static const Glib::SignalProxyInfo Config_signal_dsn_changed_info =
{
  "dsn-changed",
  (GCallback) &Config_signal_dsn_changed_callback,
  (GCallback) &Config_signal_dsn_changed_callback
};


static void Config_signal_dsn_removed_callback(GdaConfig* self, gpointer p0,void* data)
{
  using namespace Gnome::Gda;
  typedef sigc::slot< void,GdaDsnInfo* > SlotType;

  // Do not try to call a signal on a disassociated wrapper.
  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
  {
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    try
    {
    #endif //GLIBMM_EXCEPTIONS_ENABLED
      if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))((GdaDsnInfo*)(p0)
);
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }
}

static const Glib::SignalProxyInfo Config_signal_dsn_removed_info =
{
  "dsn-removed",
  (GCallback) &Config_signal_dsn_removed_callback,
  (GCallback) &Config_signal_dsn_removed_callback
};


static void Config_signal_dsn_to_be_removed_callback(GdaConfig* self, gpointer p0,void* data)
{
  using namespace Gnome::Gda;
  typedef sigc::slot< void,GdaDsnInfo* > SlotType;

  // Do not try to call a signal on a disassociated wrapper.
  if(Glib::ObjectBase::_get_current_wrapper((GObject*) self))
  {
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    try
    {
    #endif //GLIBMM_EXCEPTIONS_ENABLED
      if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))((GdaDsnInfo*)(p0)
);
    #ifdef GLIBMM_EXCEPTIONS_ENABLED
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
    #endif //GLIBMM_EXCEPTIONS_ENABLED
  }
}

static const Glib::SignalProxyInfo Config_signal_dsn_to_be_removed_info =
{
  "dsn-to-be-removed",
  (GCallback) &Config_signal_dsn_to_be_removed_callback,
  (GCallback) &Config_signal_dsn_to_be_removed_callback
};


} // anonymous namespace


Gnome::Gda::ConfigError::ConfigError(Gnome::Gda::ConfigError::Code error_code, const Glib::ustring& error_message)
:
  Glib::Error (GDA_CONFIG_ERROR, error_code, error_message)
{}

Gnome::Gda::ConfigError::ConfigError(GError* gobject)
:
  Glib::Error (gobject)
{}

Gnome::Gda::ConfigError::Code Gnome::Gda::ConfigError::code() const
{
  return static_cast<Code>(Glib::Error::code());
}

void Gnome::Gda::ConfigError::throw_func(GError* gobject)
{
  throw Gnome::Gda::ConfigError(gobject);
}

// static
GType Glib::Value<Gnome::Gda::ConfigError::Code>::value_type()
{
  return gda_config_error_get_type();
}


namespace Glib
{

Glib::RefPtr<Gnome::Gda::Config> wrap(GdaConfig* object, bool take_copy)
{
  return Glib::RefPtr<Gnome::Gda::Config>( dynamic_cast<Gnome::Gda::Config*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
  //We use dynamic_cast<> in case of multiple inheritance.
}

} /* namespace Glib */


namespace Gnome
{

namespace Gda
{


/* The *_Class implementation: */

const Glib::Class& Config_Class::init()
{
  if(!gtype_) // create the GType if necessary
  {
    // Glib::Class has to know the class init function to clone custom types.
    class_init_func_ = &Config_Class::class_init_function;

    // This is actually just optimized away, apparently with no harm.
    // Make sure that the parent type has been created.
    //CppClassParent::CppObjectType::get_type();

    // Create the wrapper type, with the same class/instance size as the base type.
    register_derived_type(gda_config_get_type());

    // Add derived versions of interfaces, if the C type implements any interfaces:

  }

  return *this;
}


void Config_Class::class_init_function(void* g_class, void* class_data)
{
  BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
  CppClassParent::class_init_function(klass, class_data);


}


Glib::ObjectBase* Config_Class::wrap_new(GObject* object)
{
  return new Config((GdaConfig*)object);
}


/* The implementation: */

GdaConfig* Config::gobj_copy()
{
  reference();
  return gobj();
}

Config::Config(const Glib::ConstructParams& construct_params)
:
  Glib::Object(construct_params)
{

}

Config::Config(GdaConfig* castitem)
:
  Glib::Object((GObject*)(castitem))
{}


Config::~Config()
{}


Config::CppClassType Config::config_class_; // initialize static member

GType Config::get_type()
{
  return config_class_.init().get_type();
}


GType Config::get_base_type()
{
  return gda_config_get_type();
}


Config::Config()
:
  // Mark this class as non-derived to allow C++ vfuncs to be skipped.
  Glib::ObjectBase(0),
  Glib::Object(Glib::ConstructParams(config_class_.init()))
{
  

}

Glib::RefPtr<Config> Config::get()
{

  Glib::RefPtr<Config> retvalue = Glib::wrap(gda_config_get());

  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us
  return retvalue;
}


GdaDsnInfo* Config::get_dsn_info(const Glib::ustring& dsn_name)
{
  return gda_config_get_dsn_info(dsn_name.c_str());
}


bool Config::dsn_needs_authentication(const Glib::ustring& dsn_name)
{
  return gda_config_dsn_needs_authentication(dsn_name.c_str());
}


Glib::RefPtr<DataModel> Config::list_dsn()
{
  return Glib::wrap(gda_config_list_dsn());
}


Glib::RefPtr<ServerProvider> Config::get_provider(const Glib::ustring& provider_name)
{
  GError* gerror = 0;
  Glib::RefPtr<ServerProvider> retvalue = Glib::wrap(gda_config_get_provider(provider_name.c_str(), &(gerror)));

  if(gerror)
    ::Glib::Error::throw_exception(gerror);

  return retvalue;
}


Glib::RefPtr<DataModel> Config::list_providers()
{
  return Glib::wrap(gda_config_list_providers());
}


int Config::get_nb_dsn()
{
  return gda_config_get_nb_dsn();
}


bool Config::can_modify_system_config()
{
  return gda_config_can_modify_system_config();
}


Glib::SignalProxy1< void,GdaDsnInfo* > Config::signal_dsn_added()
{
  return Glib::SignalProxy1< void,GdaDsnInfo* >(this, &Config_signal_dsn_added_info);
}


Glib::SignalProxy1< void,GdaDsnInfo* > Config::signal_dsn_changed()
{
  return Glib::SignalProxy1< void,GdaDsnInfo* >(this, &Config_signal_dsn_changed_info);
}


Glib::SignalProxy1< void,GdaDsnInfo* > Config::signal_dsn_removed()
{
  return Glib::SignalProxy1< void,GdaDsnInfo* >(this, &Config_signal_dsn_removed_info);
}


Glib::SignalProxy1< void,GdaDsnInfo* > Config::signal_dsn_to_be_removed()
{
  return Glib::SignalProxy1< void,GdaDsnInfo* >(this, &Config_signal_dsn_to_be_removed_info);
}


#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<Glib::ustring> Config::property_system_filename() 
{
  return Glib::PropertyProxy<Glib::ustring>(this, "system-filename");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<Glib::ustring> Config::property_system_filename() const
{
  return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "system-filename");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<Glib::ustring> Config::property_user_filename() 
{
  return Glib::PropertyProxy<Glib::ustring>(this, "user-filename");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<Glib::ustring> Config::property_user_filename() const
{
  return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "user-filename");
}
#endif //GLIBMM_PROPERTIES_ENABLED


} // namespace Gda

} // namespace Gnome


