// Generated by gmmproc 2.54.1 -- DO NOT MODIFY!
#include <glibmm.h>
#include <giomm/action.h>
#include <giomm/private/action_p.h>
/* Copyright (C) 2011 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 <gio/gio.h>
namespace Gio
{
void
Action::activate()
{
g_action_activate(gobj(), nullptr);
}
} // namespace Gio
namespace
{
} // anonymous namespace
namespace Glib
{
Glib::RefPtr<Gio::Action> wrap(GAction* object, bool take_copy)
{
return Glib::RefPtr<Gio::Action>( dynamic_cast<Gio::Action*> (Glib::wrap_auto_interface<Gio::Action> ((GObject*)(object), take_copy)) );
//We use dynamic_cast<> in case of multiple inheritance.
}
} // namespace Glib
namespace Gio
{
/* The *_Class implementation: */
const Glib::Interface_Class& Action_Class::init()
{
if(!gtype_) // create the GType if necessary
{
// Glib::Interface_Class has to know the interface init function
// in order to add interfaces to implementing types.
class_init_func_ = &Action_Class::iface_init_function;
// We can not derive from another interface, and it is not necessary anyway.
gtype_ = g_action_get_type();
}
return *this;
}
void Action_Class::iface_init_function(void* g_iface, void*)
{
const auto klass = static_cast<BaseClassType*>(g_iface);
//This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to connect.
//This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
g_assert(klass != nullptr);
klass->get_name = &get_name_vfunc_callback;
klass->get_parameter_type = &get_parameter_type_vfunc_callback;
klass->get_state_type = &get_state_type_vfunc_callback;
klass->get_state_hint = &get_state_hint_vfunc_callback;
klass->get_enabled = &get_enabled_vfunc_callback;
klass->get_state = &get_state_vfunc_callback;
klass->change_state = &change_state_vfunc_callback;
klass->activate = &activate_vfunc_callback;
}
const gchar* Action_Class::get_name_vfunc_callback(GAction* self)
{
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.
static auto quark_return_value = g_quark_from_static_string("Gio::Action::get_name_vfunc");
auto return_value = static_cast<Glib::ustring*>(g_object_get_qdata(obj_base->gobj(), quark_return_value));
if (!return_value)
{
return_value = new Glib::ustring();
g_object_set_qdata_full(obj_base->gobj(), quark_return_value, return_value,
&Glib::destroy_notify_delete<Glib::ustring>);
}
// Keep a copy of the return value. The caller is not expected
// to free the object that the returned pointer points to.
*return_value = obj->get_name_vfunc();
return (*return_value).c_str();
}
catch(...)
{
Glib::exception_handlers_invoke();
}
}
}
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
) );
// Call the original underlying C function:
if(base && base->get_name)
return (*base->get_name)(self);
using RType = const gchar*;
return RType();
}
const GVariantType* Action_Class::get_parameter_type_vfunc_callback(GAction* self)
{
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.
static auto quark_return_value = g_quark_from_static_string("Gio::Action::get_parameter_type_vfunc");
auto return_value = static_cast<Glib::VariantType*>(g_object_get_qdata(obj_base->gobj(), quark_return_value));
if (!return_value)
{
return_value = new Glib::VariantType();
g_object_set_qdata_full(obj_base->gobj(), quark_return_value, return_value,
&Glib::destroy_notify_delete<Glib::VariantType>);
}
// Keep a copy of the return value. The caller is not expected
// to free the object that the returned pointer points to.
*return_value = obj->get_parameter_type_vfunc();
return (*return_value).gobj();
}
catch(...)
{
Glib::exception_handlers_invoke();
}
}
}
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
) );
// Call the original underlying C function:
if(base && base->get_parameter_type)
return (*base->get_parameter_type)(self);
using RType = const GVariantType*;
return RType();
}
const GVariantType* Action_Class::get_state_type_vfunc_callback(GAction* self)
{
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.
static auto quark_return_value = g_quark_from_static_string("Gio::Action::get_state_type_vfunc");
auto return_value = static_cast<Glib::VariantType*>(g_object_get_qdata(obj_base->gobj(), quark_return_value));
if (!return_value)
{
return_value = new Glib::VariantType();
g_object_set_qdata_full(obj_base->gobj(), quark_return_value, return_value,
&Glib::destroy_notify_delete<Glib::VariantType>);
}
// Keep a copy of the return value. The caller is not expected
// to free the object that the returned pointer points to.
*return_value = obj->get_state_type_vfunc();
return (*return_value).gobj();
}
catch(...)
{
Glib::exception_handlers_invoke();
}
}
}
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
) );
// Call the original underlying C function:
if(base && base->get_state_type)
return (*base->get_state_type)(self);
using RType = const GVariantType*;
return RType();
}
GVariant* Action_Class::get_state_hint_vfunc_callback(GAction* self)
{
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 Glib::unwrap_copy(obj->get_state_hint_vfunc());
}
catch(...)
{
Glib::exception_handlers_invoke();
}
}
}
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
) );
// Call the original underlying C function:
if(base && base->get_state_hint)
return (*base->get_state_hint)(self);
using RType = GVariant*;
return RType();
}
gboolean Action_Class::get_enabled_vfunc_callback(GAction* self)
{
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->get_enabled_vfunc());
}
catch(...)
{
Glib::exception_handlers_invoke();
}
}
}
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
) );
// Call the original underlying C function:
if(base && base->get_enabled)
return (*base->get_enabled)(self);
using RType = gboolean;
return RType();
}
GVariant* Action_Class::get_state_vfunc_callback(GAction* self)
{
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 Glib::unwrap_copy(obj->get_state_vfunc());
}
catch(...)
{
Glib::exception_handlers_invoke();
}
}
}
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
) );
// Call the original underlying C function:
if(base && base->get_state)
return (*base->get_state)(self);
using RType = GVariant*;
return RType();
}
void Action_Class::change_state_vfunc_callback(GAction* self, GVariant* value)
{
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.
obj->change_state_vfunc(Glib::wrap(value, true)
);
return;
}
catch(...)
{
Glib::exception_handlers_invoke();
}
}
}
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
) );
// Call the original underlying C function:
if(base && base->change_state)
(*base->change_state)(self, value);
}
void Action_Class::activate_vfunc_callback(GAction* self, GVariant* parameter)
{
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.
obj->activate_vfunc(Glib::wrap(parameter, true)
);
return;
}
catch(...)
{
Glib::exception_handlers_invoke();
}
}
}
BaseClassType *const base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(self), CppObjectType::get_type()) // Get the interface.
) );
// Call the original underlying C function:
if(base && base->activate)
(*base->activate)(self, parameter);
}
Glib::ObjectBase* Action_Class::wrap_new(GObject* object)
{
return new Action((GAction*)(object));
}
/* The implementation: */
Action::Action()
:
Glib::Interface(action_class_.init())
{}
Action::Action(GAction* castitem)
:
Glib::Interface((GObject*)(castitem))
{}
Action::Action(const Glib::Interface_Class& interface_class)
: Glib::Interface(interface_class)
{
}
Action::Action(Action&& src) noexcept
: Glib::Interface(std::move(src))
{}
Action& Action::operator=(Action&& src) noexcept
{
Glib::Interface::operator=(std::move(src));
return *this;
}
Action::~Action() noexcept
{}
// static
void Action::add_interface(GType gtype_implementer)
{
action_class_.init().add_interface(gtype_implementer);
}
Action::CppClassType Action::action_class_; // initialize static member
GType Action::get_type()
{
return action_class_.init().get_type();
}
GType Action::get_base_type()
{
return g_action_get_type();
}
Glib::ustring Action::get_name() const
{
return Glib::convert_const_gchar_ptr_to_ustring(g_action_get_name(const_cast<GAction*>(gobj())));
}
Glib::VariantType Action::get_parameter_type() const
{
return Glib::wrap(const_cast<GVariantType*>(g_action_get_parameter_type(const_cast<GAction*>(gobj()))), true);
}
Glib::VariantType Action::get_state_type() const
{
return Glib::wrap(const_cast<GVariantType*>(g_action_get_state_type(const_cast<GAction*>(gobj()))), true);
}
Glib::VariantBase Action::get_state_hint_variant() const
{
return Glib::wrap(g_action_get_state_hint(const_cast<GAction*>(gobj())), false);
}
bool Action::get_enabled() const
{
return g_action_get_enabled(const_cast<GAction*>(gobj()));
}
void Action::change_state_variant(const Glib::VariantBase& value)
{
g_action_change_state(gobj(), const_cast<GVariant*>((value).gobj()));
}
#ifndef GIOMM_DISABLE_DEPRECATED
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
void Action::change_state(const Glib::VariantBase& value)
{
g_action_change_state(gobj(), const_cast<GVariant*>((value).gobj()));
}
G_GNUC_END_IGNORE_DEPRECATIONS
#endif // GIOMM_DISABLE_DEPRECATED
Glib::VariantBase Action::get_state_variant() const
{
return Glib::wrap(g_action_get_state(const_cast<GAction*>(gobj())), false);
}
void Action::activate_variant(const Glib::VariantBase& parameter)
{
g_action_activate(gobj(), const_cast<GVariant*>((parameter).gobj()));
}
#ifndef GIOMM_DISABLE_DEPRECATED
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
void Action::activate(const Glib::VariantBase& parameter)
{
g_action_activate(gobj(), const_cast<GVariant*>((parameter).gobj()));
}
G_GNUC_END_IGNORE_DEPRECATIONS
#endif // GIOMM_DISABLE_DEPRECATED
bool Action::name_is_valid(const Glib::ustring& action_name)
{
return g_action_name_is_valid(action_name.c_str());
}
void Action::parse_detailed_name_variant(const Glib::ustring& detailed_name, Glib::ustring& action_name, Glib::VariantBase& target_value)
{
GError* gerror = nullptr;
gchar* g_action_name = nullptr;
GVariant* g_target_value = nullptr;
g_action_parse_detailed_name(detailed_name.c_str(), &g_action_name, &g_target_value, &(gerror));
if(gerror)
::Glib::Error::throw_exception(gerror);
action_name = Glib::convert_return_gchar_ptr_to_ustring(g_action_name);
target_value = Glib::wrap(g_target_value);
}
Glib::ustring Action::print_detailed_name_variant(const Glib::ustring& action_name, const Glib::VariantBase& target_value)
{
return Glib::convert_return_gchar_ptr_to_ustring(g_action_print_detailed_name(action_name.c_str(), const_cast<GVariant*>((target_value).gobj())));
}
Glib::PropertyProxy_ReadOnly< bool > Action::property_enabled() const
{
return Glib::PropertyProxy_ReadOnly< bool >(this, "enabled");
}
Glib::PropertyProxy_ReadOnly< Glib::ustring > Action::property_name() const
{
return Glib::PropertyProxy_ReadOnly< Glib::ustring >(this, "name");
}
Glib::PropertyProxy_ReadOnly< Glib::VariantType > Action::property_parameter_type() const
{
return Glib::PropertyProxy_ReadOnly< Glib::VariantType >(this, "parameter-type");
}
Glib::PropertyProxy_ReadOnly< Glib::VariantBase > Action::property_state() const
{
return Glib::PropertyProxy_ReadOnly< Glib::VariantBase >(this, "state");
}
Glib::PropertyProxy_ReadOnly< Glib::VariantType > Action::property_state_type() const
{
return Glib::PropertyProxy_ReadOnly< Glib::VariantType >(this, "state-type");
}
Glib::ustring Gio::Action::get_name_vfunc() const
{
const auto base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
) );
if(base && base->get_name)
{
Glib::ustring retval(Glib::convert_const_gchar_ptr_to_ustring((*base->get_name)(const_cast<GAction*>(gobj()))));
return retval;
}
using RType = Glib::ustring;
return RType();
}
Glib::VariantType Gio::Action::get_parameter_type_vfunc() const
{
const auto base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
) );
if(base && base->get_parameter_type)
{
Glib::VariantType retval(Glib::wrap(const_cast<GVariantType*>((*base->get_parameter_type)(const_cast<GAction*>(gobj()))), true));
return retval;
}
using RType = Glib::VariantType;
return RType();
}
Glib::VariantType Gio::Action::get_state_type_vfunc() const
{
const auto base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
) );
if(base && base->get_state_type)
{
Glib::VariantType retval(Glib::wrap(const_cast<GVariantType*>((*base->get_state_type)(const_cast<GAction*>(gobj()))), true));
return retval;
}
using RType = Glib::VariantType;
return RType();
}
Glib::VariantBase Gio::Action::get_state_hint_vfunc() const
{
const auto base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
) );
if(base && base->get_state_hint)
{
Glib::VariantBase retval(Glib::wrap((*base->get_state_hint)(const_cast<GAction*>(gobj())), false));
return retval;
}
using RType = Glib::VariantBase;
return RType();
}
bool Gio::Action::get_enabled_vfunc() const
{
const auto base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
) );
if(base && base->get_enabled)
{
bool retval((*base->get_enabled)(const_cast<GAction*>(gobj())));
return retval;
}
using RType = bool;
return RType();
}
Glib::VariantBase Gio::Action::get_state_vfunc() const
{
const auto base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
) );
if(base && base->get_state)
{
Glib::VariantBase retval(Glib::wrap((*base->get_state)(const_cast<GAction*>(gobj())), false));
return retval;
}
using RType = Glib::VariantBase;
return RType();
}
void Gio::Action::change_state_vfunc(const Glib::VariantBase& value)
{
const auto base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
) );
if(base && base->change_state)
{
(*base->change_state)(gobj(),const_cast<GVariant*>((value).gobj()));
}
}
void Gio::Action::activate_vfunc(const Glib::VariantBase& parameter)
{
const auto base = static_cast<BaseClassType*>(
g_type_interface_peek_parent( // Get the parent interface of the interface (The original underlying C interface).
g_type_interface_peek(G_OBJECT_GET_CLASS(gobject_), CppObjectType::get_type()) // Get the interface.
) );
if(base && base->activate)
{
(*base->activate)(gobj(),const_cast<GVariant*>((parameter).gobj()));
}
}
} // namespace Gio