/* Copyright (C) 2019 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 .
*/
_CONFIGINCLUDE(giommconfig.h)
#include
#include
#include
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/interface_p.h)
_PINCLUDE(gio/gio.h)
#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GDBusObjectManagerIface GDBusObjectManagerIface;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */
namespace Gio
{
namespace DBus
{
class GIOMM_API Interface;
class GIOMM_API Object;
_GMMPROC_EXTRA_NAMESPACE(DBus)
/** Base type for D-Bus object managers.
*
* The %Gio::DBus::ObjectManager type is the base type for service- and
* client-side implementations of the standardized
*
* org.freedesktop.DBus.ObjectManager interface.
*
* See Gio::DBus::ObjectManagerClient for the client-side implementation
* and Gio::DBus::ObjectManagerServer for the service-side implementation.
*
* @newin{2,62}
* @ingroup DBus
*/
class GIOMM_API ObjectManager : public Glib::Interface
{
_CLASS_INTERFACE(ObjectManager, GDBusObjectManager, G_DBUS_OBJECT_MANAGER, GDBusObjectManagerIface, , , GIOMM_API)
public:
_WRAP_METHOD(Glib::ustring get_object_path() const, g_dbus_object_manager_get_object_path)
#m4 _CONVERSION(`GList*',`std::vector>',
#m4 `Glib::ListHandler>::list_to_vector($3, Glib::OWNERSHIP_DEEP)')
_WRAP_METHOD(std::vector> get_objects(), g_dbus_object_manager_get_objects)
#m4 _CONVERSION(`GList*',`std::vector>',
#m4 `Glib::ListHandler>::list_to_vector($3, Glib::OWNERSHIP_DEEP)')
_WRAP_METHOD(std::vector> get_objects() const, g_dbus_object_manager_get_objects)
_WRAP_METHOD(Glib::RefPtr get_object(const Glib::ustring& object_path), g_dbus_object_manager_get_object)
_WRAP_METHOD(Glib::RefPtr get_object(const Glib::ustring& object_path) const,
g_dbus_object_manager_get_object, constversion)
_WRAP_METHOD(Glib::RefPtr get_interface(const Glib::ustring& object_path,
const Glib::ustring& interface_name), g_dbus_object_manager_get_interface)
_WRAP_METHOD(Glib::RefPtr get_interface(const Glib::ustring& object_path,
const Glib::ustring& interface_name) const, g_dbus_object_manager_get_interface, constversion)
#m4 _CONVERSION(`GDBusObject*',`const Glib::RefPtr&',`Glib::wrap($3, true)')
_WRAP_SIGNAL(void object_added(const Glib::RefPtr& object), "object-added")
_WRAP_SIGNAL(void object_removed(const Glib::RefPtr& object), "object-removed")
// The parameter name 'interface' can cause compilation errors with MinGW.
// See https://bugzilla.gnome.org/show_bug.cgi?id=735137
// The parameter name in glib is 'interface'.
#m4 _CONVERSION(`GDBusInterface*',`const Glib::RefPtr&',`Glib::wrap($3, true)')
_WRAP_SIGNAL(void interface_added(const Glib::RefPtr& object,
const Glib::RefPtr& iface), "interface-added")
_WRAP_SIGNAL(void interface_removed(const Glib::RefPtr& object,
const Glib::RefPtr& iface), "interface-removed")
protected:
#m4 _CONVERSION(`Glib::ustring', `const gchar*', `$3.c_str()')
_WRAP_VFUNC(Glib::ustring get_object_path() const, "get_object_path", keep_return)
#m4 _CONVERSION(`std::vector>',`GList*',
#m4 `g_list_copy_deep(Glib::ListHandler>::vector_to_list($3).data(), list_copy_ref, nullptr)')
_WRAP_VFUNC(std::vector> get_objects() const, "get_objects")
// Can't use refreturn_ctype here. It generates a call to Glib::unwrap_copy(), which
// can't be used for Glib::Interface classes. They have no gobj_copy() method.
#m4 _CONVERSION(`Glib::RefPtr',`GDBusObject*',`local_unwrap_copy($3)')
_WRAP_VFUNC(Glib::RefPtr get_object(const Glib::ustring& object_path) const, "get_object")
#m4 _CONVERSION(`Glib::RefPtr',`GDBusInterface*',`local_unwrap_copy($3)')
_WRAP_VFUNC(Glib::RefPtr get_interface(const Glib::ustring& object_path,
const Glib::ustring& interface_name) const, "get_interface")
};
} // namespace DBus
} // namespace Gio