// Generated by gmmproc 2.66.4 -- DO NOT MODIFY!


#include <glibmm.h>

#include <giomm/dbusinterfaceskeleton.h>
#include <giomm/private/dbusinterfaceskeleton_p.h>


/* Copyright (C) 2013 The giomm 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, see <http://www.gnu.org/licenses/>.
 */

#include <giomm/dbusconnection.h>
#include <giomm/dbusintrospection.h>
#include <giomm/dbusmethodinvocation.h>

namespace
{


static gboolean InterfaceSkeleton_signal_authorize_method_callback(GDBusInterfaceSkeleton* self, GDBusMethodInvocation* p0,void* data)
{
  using namespace Gio::DBus;
  using SlotType = sigc::slot< bool,const Glib::RefPtr<MethodInvocation>& >;

  auto obj = dynamic_cast<InterfaceSkeleton*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
  // Do not try to call a signal on a disassociated wrapper.
  if(obj)
  {
    try
    {
      if(const auto slot = Glib::SignalProxyNormal::data_to_slot(data))
        return static_cast<int>((*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
));
    }
    catch(...)
    {
       Glib::exception_handlers_invoke();
    }
  }

  using RType = gboolean;
  return RType();
}

static gboolean InterfaceSkeleton_signal_authorize_method_notify_callback(GDBusInterfaceSkeleton* self, GDBusMethodInvocation* p0, void* data)
{
  using namespace Gio::DBus;
  using SlotType = sigc::slot< void,const Glib::RefPtr<MethodInvocation>& >;

  auto obj = dynamic_cast<InterfaceSkeleton*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
  // Do not try to call a signal on a disassociated wrapper.
  if(obj)
  {
    try
    {
      if(const auto slot = Glib::SignalProxyNormal::data_to_slot(data))
        (*static_cast<SlotType*>(slot))(Glib::wrap(p0, true)
);
    }
    catch(...)
    {
      Glib::exception_handlers_invoke();
    }
  }

  using RType = gboolean;
  return RType();
}

static const Glib::SignalProxyInfo InterfaceSkeleton_signal_authorize_method_info =
{
  "g_authorize_method",
  (GCallback) &InterfaceSkeleton_signal_authorize_method_callback,
  (GCallback) &InterfaceSkeleton_signal_authorize_method_notify_callback
};


} // anonymous namespace

// static
GType Glib::Value<Gio::DBus::InterfaceSkeletonFlags>::value_type()
{
  return g_dbus_interface_skeleton_flags_get_type();
}


namespace Glib
{

Glib::RefPtr<Gio::DBus::InterfaceSkeleton> wrap(GDBusInterfaceSkeleton* object, bool take_copy)
{
  return Glib::RefPtr<Gio::DBus::InterfaceSkeleton>( dynamic_cast<Gio::DBus::InterfaceSkeleton*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
  //We use dynamic_cast<> in case of multiple inheritance.
}

} /* namespace Glib */


namespace Gio
{

namespace DBus
{


/* The *_Class implementation: */

const Glib::Class& InterfaceSkeleton_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_ = &InterfaceSkeleton_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(g_dbus_interface_skeleton_get_type());

    // Add derived versions of interfaces, if the C type implements any interfaces:
  Interface::add_interface(get_type());

  }

  return *this;
}


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


  klass->g_authorize_method = &g_authorize_method_callback;
}


gboolean InterfaceSkeleton_Class::g_authorize_method_callback(GDBusInterfaceSkeleton* self, GDBusMethodInvocation* p0)
{
  const auto obj_base = static_cast<Glib::ObjectBase*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj_base && obj_base->is_derived_())
  {
    const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
        // Call the virtual member method, which derived classes might override.
        return static_cast<int>(obj->on_authorize_method(Glib::wrap(p0, true)
));
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
    }
  }

  const auto base = static_cast<BaseClassType*>(
        g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
    );

  // Call the original underlying C function:
  if(base && base->g_authorize_method)
    return (*base->g_authorize_method)(self, p0);

  using RType = gboolean;
  return RType();
}


Glib::ObjectBase* InterfaceSkeleton_Class::wrap_new(GObject* object)
{
  return new InterfaceSkeleton((GDBusInterfaceSkeleton*)object);
}


/* The implementation: */

GDBusInterfaceSkeleton* InterfaceSkeleton::gobj_copy()
{
  reference();
  return gobj();
}

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

}

InterfaceSkeleton::InterfaceSkeleton(GDBusInterfaceSkeleton* castitem)
:
  Glib::Object((GObject*)(castitem))
{}


InterfaceSkeleton::InterfaceSkeleton(InterfaceSkeleton&& src) noexcept
: Glib::Object(std::move(src))
  , Interface(std::move(src))
{}

InterfaceSkeleton& InterfaceSkeleton::operator=(InterfaceSkeleton&& src) noexcept
{
  Glib::Object::operator=(std::move(src));
  Interface::operator=(std::move(src));
  return *this;
}


InterfaceSkeleton::~InterfaceSkeleton() noexcept
{}


InterfaceSkeleton::CppClassType InterfaceSkeleton::interfaceskeleton_class_; // initialize static member

GType InterfaceSkeleton::get_type()
{
  return interfaceskeleton_class_.init().get_type();
}


GType InterfaceSkeleton::get_base_type()
{
  return g_dbus_interface_skeleton_get_type();
}


void InterfaceSkeleton::flush()
{
  g_dbus_interface_skeleton_flush(gobj());
}

Glib::RefPtr<InterfaceInfo> InterfaceSkeleton::get_info()
{
  return Glib::wrap(g_dbus_interface_skeleton_get_info(gobj()));
}

Glib::RefPtr<const InterfaceInfo> InterfaceSkeleton::get_info() const
{
  return const_cast<InterfaceSkeleton*>(this)->get_info();
}

Glib::VariantBase InterfaceSkeleton::get_properties() const
{
  return Glib::wrap(g_dbus_interface_skeleton_get_properties(const_cast<GDBusInterfaceSkeleton*>(gobj())), false);
}

void InterfaceSkeleton::export_interface_skeleton(const Glib::RefPtr<Connection>& connection, const Glib::ustring& object_path)
{
  GError* gerror = nullptr;
  g_dbus_interface_skeleton_export(gobj(), Glib::unwrap(connection), object_path.c_str(), &(gerror));
  if(gerror)
    ::Glib::Error::throw_exception(gerror);
}

void InterfaceSkeleton::unexport()
{
  g_dbus_interface_skeleton_unexport(gobj());
}

void InterfaceSkeleton::unexport_from_connection(const Glib::RefPtr<Connection>& connection)
{
  g_dbus_interface_skeleton_unexport_from_connection(gobj(), Glib::unwrap(connection));
}

Glib::RefPtr<Connection> InterfaceSkeleton::get_connection()
{
  return Glib::wrap(g_dbus_interface_skeleton_get_connection(gobj()));
}

Glib::RefPtr<const Connection> InterfaceSkeleton::get_connection() const
{
  return const_cast<InterfaceSkeleton*>(this)->get_connection();
}

std::vector< Glib::RefPtr<Connection> > InterfaceSkeleton::get_connections()
{
  return Glib::ListHandler< Glib::RefPtr<Connection> >::list_to_vector(g_dbus_interface_skeleton_get_connections(gobj()), Glib::OWNERSHIP_DEEP);
}

std::vector< Glib::RefPtr<const Connection> > InterfaceSkeleton::get_connections() const
{
  return Glib::ListHandler< Glib::RefPtr<const Connection> >::list_to_vector(g_dbus_interface_skeleton_get_connections(const_cast<GDBusInterfaceSkeleton*>(gobj())), Glib::OWNERSHIP_DEEP);
}

bool InterfaceSkeleton::has_connection(const Glib::RefPtr<const Connection>& connection) const
{
  return g_dbus_interface_skeleton_has_connection(const_cast<GDBusInterfaceSkeleton*>(gobj()), const_cast<GDBusConnection*>(Glib::unwrap(connection)));
}

Glib::ustring InterfaceSkeleton::get_object_path() const
{
  return Glib::convert_const_gchar_ptr_to_ustring(g_dbus_interface_skeleton_get_object_path(const_cast<GDBusInterfaceSkeleton*>(gobj())));
}

InterfaceSkeletonFlags InterfaceSkeleton::get_flags() const
{
  return ((InterfaceSkeletonFlags)(g_dbus_interface_skeleton_get_flags(const_cast<GDBusInterfaceSkeleton*>(gobj()))));
}

void InterfaceSkeleton::set_flags(InterfaceSkeletonFlags flags)
{
  g_dbus_interface_skeleton_set_flags(gobj(), ((GDBusInterfaceSkeletonFlags)(flags)));
}


Glib::SignalProxy< bool,const Glib::RefPtr<MethodInvocation>& > InterfaceSkeleton::signal_authorize_method()
{
  return Glib::SignalProxy< bool,const Glib::RefPtr<MethodInvocation>& >(this, &InterfaceSkeleton_signal_authorize_method_info);
}


Glib::PropertyProxy< InterfaceSkeletonFlags > InterfaceSkeleton::property_g_flags() 
{
  return Glib::PropertyProxy< InterfaceSkeletonFlags >(this, "g-flags");
}

Glib::PropertyProxy_ReadOnly< InterfaceSkeletonFlags > InterfaceSkeleton::property_g_flags() const
{
  return Glib::PropertyProxy_ReadOnly< InterfaceSkeletonFlags >(this, "g-flags");
}


bool Gio::DBus::InterfaceSkeleton::on_authorize_method(const Glib::RefPtr<MethodInvocation>& invocation)
{
  const auto base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->g_authorize_method)
    return (*base->g_authorize_method)(gobj(),Glib::unwrap(invocation));

  using RType = bool;
  return RType();
}


} // namespace DBus

} // namespace Gio


