Commit 94b90713 authored by David Zeuthen's avatar David Zeuthen

Start merging gdbus-codegen code

Signed-off-by: default avatarDavid Zeuthen <davidz@redhat.com>
parent 07292601
......@@ -82,6 +82,14 @@ gdbus_headers = \
gdbusintrospection.h \
gdbusmethodinvocation.h \
gdbusserver.h \
gdbusinterface.h \
gdbusinterfacestub.h \
gdbusobject.h \
gdbusobjectstub.h \
gdbusobjectproxy.h \
gdbusobjectmanager.h \
gdbusobjectmanagerclient.h \
gdbusobjectmanagerserver.h \
$(NULL)
gdbus_sources = \
......@@ -103,6 +111,14 @@ gdbus_sources = \
gdbusintrospection.h gdbusintrospection.c \
gdbusmethodinvocation.h gdbusmethodinvocation.c \
gdbusserver.h gdbusserver.c \
gdbusinterface.h gdbusinterface.c \
gdbusinterfacestub.h gdbusinterfacestub.c \
gdbusobject.h gdbusobject.c \
gdbusobjectstub.h gdbusobjectstub.c \
gdbusobjectproxy.h gdbusobjectproxy.c \
gdbusobjectmanager.h gdbusobjectmanager.c \
gdbusobjectmanagerclient.h gdbusobjectmanagerclient.c \
gdbusobjectmanagerserver.h gdbusobjectmanagerserver.c \
$(NULL)
settings_headers = \
......
......@@ -27,6 +27,7 @@
#include "gcredentials.h"
#include "gioenumtypes.h"
#include "giostream.h"
#include "gdbusprivate.h"
#include "glibintl.h"
......@@ -130,22 +131,6 @@ g_dbus_auth_observer_authorize_authenticated_peer_real (GDBusAuthObserver *obse
return TRUE;
}
gboolean
_g_signal_accumulator_false_handled (GSignalInvocationHint *ihint,
GValue *return_accu,
const GValue *handler_return,
gpointer dummy)
{
gboolean continue_emission;
gboolean signal_handled;
signal_handled = g_value_get_boolean (handler_return);
g_value_set_boolean (return_accu, signal_handled);
continue_emission = signal_handled;
return continue_emission;
}
static void
g_dbus_auth_observer_class_init (GDBusAuthObserverClass *klass)
{
......
/* GDBus - GLib D-Bus Library
*
* Copyright (C) 2008-2010 Red Hat, Inc.
*
* 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 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., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: David Zeuthen <davidz@redhat.com>
*/
#include "config.h"
#include "gdbusobject.h"
#include "gdbusinterface.h"
#include "gio-marshal.h"
#include "glibintl.h"
/**
* SECTION:gdbusinterface
* @short_description: Base type for D-Bus interfaces
* @include: gio/gio.h
*
* The #GDBusInterface type is the base type for D-Bus interfaces both
* on the service side (see #GDBusInterfaceStub) and client side (see
* #GDBusProxy).
*/
typedef GDBusInterfaceIface GDBusInterfaceInterface;
G_DEFINE_INTERFACE (GDBusInterface, g_dbus_interface, G_TYPE_OBJECT)
static void
g_dbus_interface_default_init (GDBusInterfaceIface *iface)
{
}
/* ---------------------------------------------------------------------------------------------------- */
/**
* g_dbus_interface_get_info:
* @interface: An exported D-Bus interface.
*
* Gets D-Bus introspection information for the D-Bus interface
* implemented by @interface.
*
* Returns: (transfer none): A #GDBusInterfaceInfo. Do not free.
*/
GDBusInterfaceInfo *
g_dbus_interface_get_info (GDBusInterface *interface)
{
g_return_val_if_fail (G_IS_DBUS_INTERFACE (interface), NULL);
return G_DBUS_INTERFACE_GET_IFACE (interface)->get_info (interface);
}
/**
* g_dbus_interface_get_object:
* @interface: An exported D-Bus interface.
*
* Gets the #GDBusObject that @interface belongs to, if any.
*
* Returns: (transfer none): A #GDBusObject or %NULL. The returned
* reference belongs to @interface and should not be freed.
*/
GDBusObject *
g_dbus_interface_get_object (GDBusInterface *interface)
{
g_return_val_if_fail (G_IS_DBUS_INTERFACE (interface), NULL);
return G_DBUS_INTERFACE_GET_IFACE (interface)->get_object (interface);
}
/**
* g_dbus_interface_set_object:
* @interface: An exported D-Bus interface.
* @object: A #GDBusObject or %NULL.
*
* Sets the #GDBusObject for @interface to @object.
*
* Note that @interface will hold a weak reference to @object.
*/
void
g_dbus_interface_set_object (GDBusInterface *interface,
GDBusObject *object)
{
g_return_if_fail (G_IS_DBUS_INTERFACE (interface));
g_return_if_fail (object == NULL || G_IS_DBUS_OBJECT (object));
G_DBUS_INTERFACE_GET_IFACE (interface)->set_object (interface, object);
}
/* Keep it here for now. TODO: move */
#include <string.h>
/**
* g_dbus_gvariant_to_gvalue:
* @value: A #GVariant.
* @out_gvalue: Return location for the #GValue.
*
* Convert a #GVariant to a #GValue. If @value is floating, it is consumed.
*
* Note that the passed @out_gvalue does not have to have a #GType set.
*
* Returns: %TRUE if the conversion succeeded, %FALSE otherwise.
*/
gboolean
g_dbus_gvariant_to_gvalue (GVariant *value,
GValue *out_gvalue)
{
gboolean ret;
const GVariantType *type;
gchar **array;
g_return_val_if_fail (value != NULL, FALSE);
g_return_val_if_fail (out_gvalue != NULL, FALSE);
ret = FALSE;
memset (out_gvalue, '\0', sizeof (GValue));
switch (g_variant_classify (value))
{
case G_VARIANT_CLASS_BOOLEAN:
g_value_init (out_gvalue, G_TYPE_BOOLEAN);
g_value_set_boolean (out_gvalue, g_variant_get_boolean (value));
break;
case G_VARIANT_CLASS_BYTE:
g_value_init (out_gvalue, G_TYPE_UCHAR);
g_value_set_uchar (out_gvalue, g_variant_get_byte (value));
break;
case G_VARIANT_CLASS_INT16:
g_value_init (out_gvalue, G_TYPE_INT);
g_value_set_int (out_gvalue, g_variant_get_int16 (value));
break;
case G_VARIANT_CLASS_UINT16:
g_value_init (out_gvalue, G_TYPE_UINT);
g_value_set_uint (out_gvalue, g_variant_get_uint16 (value));
break;
case G_VARIANT_CLASS_INT32:
g_value_init (out_gvalue, G_TYPE_INT);
g_value_set_int (out_gvalue, g_variant_get_int32 (value));
break;
case G_VARIANT_CLASS_UINT32:
g_value_init (out_gvalue, G_TYPE_UINT);
g_value_set_uint (out_gvalue, g_variant_get_uint32 (value));
break;
case G_VARIANT_CLASS_INT64:
g_value_init (out_gvalue, G_TYPE_INT64);
g_value_set_int64 (out_gvalue, g_variant_get_int64 (value));
break;
case G_VARIANT_CLASS_UINT64:
g_value_init (out_gvalue, G_TYPE_UINT64);
g_value_set_uint64 (out_gvalue, g_variant_get_uint64 (value));
break;
case G_VARIANT_CLASS_HANDLE:
g_value_init (out_gvalue, G_TYPE_INT);
g_value_set_int (out_gvalue, g_variant_get_int32 (value));
break;
case G_VARIANT_CLASS_DOUBLE:
g_value_init (out_gvalue, G_TYPE_DOUBLE);
g_value_set_double (out_gvalue, g_variant_get_double (value));
break;
case G_VARIANT_CLASS_STRING:
g_value_init (out_gvalue, G_TYPE_STRING);
g_value_set_string (out_gvalue, g_variant_get_string (value, NULL));
break;
case G_VARIANT_CLASS_OBJECT_PATH:
g_value_init (out_gvalue, G_TYPE_STRING);
g_value_set_string (out_gvalue, g_variant_get_string (value, NULL));
break;
case G_VARIANT_CLASS_SIGNATURE:
g_value_init (out_gvalue, G_TYPE_STRING);
g_value_set_string (out_gvalue, g_variant_get_string (value, NULL));
break;
case G_VARIANT_CLASS_ARRAY:
type = g_variant_get_type (value);
switch (g_variant_type_peek_string (type)[1])
{
case G_VARIANT_CLASS_BYTE:
g_value_init (out_gvalue, G_TYPE_STRING);
g_value_set_string (out_gvalue, g_variant_get_bytestring (value));
break;
case G_VARIANT_CLASS_STRING:
g_value_init (out_gvalue, G_TYPE_STRV);
array = g_variant_dup_strv (value, NULL);
g_value_take_boxed (out_gvalue, array);
break;
case G_VARIANT_CLASS_ARRAY:
switch (g_variant_type_peek_string (type)[2])
{
case G_VARIANT_CLASS_BYTE:
g_value_init (out_gvalue, G_TYPE_STRV);
array = g_variant_dup_bytestring_array (value, NULL);
g_value_take_boxed (out_gvalue, array);
break;
default:
g_value_init (out_gvalue, G_TYPE_VARIANT);
g_value_set_variant (out_gvalue, value);
break;
}
break;
default:
g_value_init (out_gvalue, G_TYPE_VARIANT);
g_value_set_variant (out_gvalue, value);
break;
}
break;
case G_VARIANT_CLASS_VARIANT:
case G_VARIANT_CLASS_MAYBE:
case G_VARIANT_CLASS_TUPLE:
case G_VARIANT_CLASS_DICT_ENTRY:
g_value_init (out_gvalue, G_TYPE_VARIANT);
g_value_set_variant (out_gvalue, value);
break;
}
ret = TRUE;
return ret;
}
/**
* g_dbus_gvalue_to_gvariant:
* @gvalue: A #GValue to convert to a #GVariant.
* @expected_type: The #GVariantType to create.
*
* Convert a #GValue to #GVariant.
*
* Returns: A #GVariant (never floating) holding the data from @gvalue
* or %NULL in case of error. Free with g_variant_unref().
*/
GVariant *
g_dbus_gvalue_to_gvariant (const GValue *gvalue,
const GVariantType *expected_type)
{
GVariant *ret;
const gchar *s;
const gchar * const *as;
const gchar *empty_strv[1] = {NULL};
g_return_val_if_fail (gvalue != NULL, NULL);
g_return_val_if_fail (expected_type != NULL, NULL);
ret = NULL;
/* The expected type could easily be e.g. "s" with the GValue holding a string.
* because of the UseGVariant annotation
*/
if (G_VALUE_TYPE (gvalue) == G_TYPE_VARIANT)
{
ret = g_value_dup_variant (gvalue);
}
else
{
switch (g_variant_type_peek_string (expected_type)[0])
{
case G_VARIANT_CLASS_BOOLEAN:
ret = g_variant_ref_sink (g_variant_new_boolean (g_value_get_boolean (gvalue)));
break;
case G_VARIANT_CLASS_BYTE:
ret = g_variant_ref_sink (g_variant_new_byte (g_value_get_uchar (gvalue)));
break;
case G_VARIANT_CLASS_INT16:
ret = g_variant_ref_sink (g_variant_new_int16 (g_value_get_int (gvalue)));
break;
case G_VARIANT_CLASS_UINT16:
ret = g_variant_ref_sink (g_variant_new_uint16 (g_value_get_uint (gvalue)));
break;
case G_VARIANT_CLASS_INT32:
ret = g_variant_ref_sink (g_variant_new_int32 (g_value_get_int (gvalue)));
break;
case G_VARIANT_CLASS_UINT32:
ret = g_variant_ref_sink (g_variant_new_uint32 (g_value_get_uint (gvalue)));
break;
case G_VARIANT_CLASS_INT64:
ret = g_variant_ref_sink (g_variant_new_int64 (g_value_get_int64 (gvalue)));
break;
case G_VARIANT_CLASS_UINT64:
ret = g_variant_ref_sink (g_variant_new_uint64 (g_value_get_uint64 (gvalue)));
break;
case G_VARIANT_CLASS_HANDLE:
ret = g_variant_ref_sink (g_variant_new_handle (g_value_get_int (gvalue)));
break;
case G_VARIANT_CLASS_DOUBLE:
ret = g_variant_ref_sink (g_variant_new_double (g_value_get_double (gvalue)));
break;
case G_VARIANT_CLASS_STRING:
s = g_value_get_string (gvalue);
if (s == NULL)
s = "";
ret = g_variant_ref_sink (g_variant_new_string (s));
break;
case G_VARIANT_CLASS_OBJECT_PATH:
s = g_value_get_string (gvalue);
if (s == NULL)
s = "/";
ret = g_variant_ref_sink (g_variant_new_object_path (s));
break;
case G_VARIANT_CLASS_SIGNATURE:
s = g_value_get_string (gvalue);
if (s == NULL)
s = "";
ret = g_variant_ref_sink (g_variant_new_signature (s));
break;
case G_VARIANT_CLASS_ARRAY:
switch (g_variant_type_peek_string (expected_type)[1])
{
case G_VARIANT_CLASS_BYTE:
s = g_value_get_string (gvalue);
if (s == NULL)
s = "";
ret = g_variant_ref_sink (g_variant_new_bytestring (s));
break;
case G_VARIANT_CLASS_STRING:
as = g_value_get_boxed (gvalue);
if (as == NULL)
as = empty_strv;
ret = g_variant_ref_sink (g_variant_new_strv (as, -1));
break;
case G_VARIANT_CLASS_ARRAY:
switch (g_variant_type_peek_string (expected_type)[2])
{
case G_VARIANT_CLASS_BYTE:
as = g_value_get_boxed (gvalue);
if (as == NULL)
as = empty_strv;
ret = g_variant_ref_sink (g_variant_new_bytestring_array (as, -1));
break;
default:
ret = g_value_dup_variant (gvalue);
break;
}
break;
default:
ret = g_value_dup_variant (gvalue);
break;
}
break;
default:
case G_VARIANT_CLASS_VARIANT:
case G_VARIANT_CLASS_MAYBE:
case G_VARIANT_CLASS_TUPLE:
case G_VARIANT_CLASS_DICT_ENTRY:
ret = g_value_dup_variant (gvalue);
break;
}
}
/* Could be that the GValue is holding a NULL GVariant - in that case,
* we return an "empty" GVariant instead of a NULL GVariant
*/
if (ret == NULL)
{
GVariant *untrusted_empty;
untrusted_empty = g_variant_new_from_data (expected_type, NULL, 0, FALSE, NULL, NULL);
ret = g_variant_ref_sink (g_variant_get_normal_form (untrusted_empty));
g_variant_unref (untrusted_empty);
}
g_assert (!g_variant_is_floating (ret));
return ret;
}
/* GDBus - GLib D-Bus Library
*
* Copyright (C) 2008-2010 Red Hat, Inc.
*
* 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 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., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: David Zeuthen <davidz@redhat.com>
*/
#ifndef __G_DBUS_INTERFACE_H__
#define __G_DBUS_INTERFACE_H__
#include <gio/giotypes.h>
G_BEGIN_DECLS
#define G_TYPE_DBUS_INTERFACE (g_dbus_interface_get_type())
#define G_DBUS_INTERFACE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_INTERFACE, GDBusInterface))
#define G_IS_DBUS_INTERFACE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_INTERFACE))
#define G_DBUS_INTERFACE_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE((o), G_TYPE_DBUS_INTERFACE, GDBusInterfaceIface))
/**
* GDBusInterface:
*
* Base type for D-Bus interfaces.
*/
typedef struct _GDBusInterface GDBusInterface; /* Dummy typedef */
typedef struct _GDBusInterfaceIface GDBusInterfaceIface;
/**
* GDBusInterfaceIface:
* @parent_iface: The parent interface.
* @get_info: Returns a #GDBusInterfaceInfo. See g_dbus_interface_get_info().
* @get_object: Gets the enclosing #GDBusObject. See g_dbus_interface_get_object().
* @set_object: Sets the enclosing #GDBusObject. See g_dbus_interface_set_object().
*
* Base type for D-Bus interfaces.
*/
struct _GDBusInterfaceIface
{
GTypeInterface parent_iface;
/* Virtual Functions */
GDBusInterfaceInfo *(*get_info) (GDBusInterface *interface);
GDBusObject *(*get_object) (GDBusInterface *interface);
void (*set_object) (GDBusInterface *interface,
GDBusObject *object);
};
GType g_dbus_interface_get_type (void) G_GNUC_CONST;
GDBusInterfaceInfo *g_dbus_interface_get_info (GDBusInterface *interface);
GDBusObject *g_dbus_interface_get_object (GDBusInterface *interface);
void g_dbus_interface_set_object (GDBusInterface *interface,
GDBusObject *object);
/* Keep it here for now. TODO: move */
gboolean g_dbus_gvariant_to_gvalue (GVariant *value,
GValue *out_gvalue);
GVariant *g_dbus_gvalue_to_gvariant (const GValue *gvalue,
const GVariantType *expected_type);
G_END_DECLS
#endif /* __G_DBUS_INTERFACE_H__ */
This diff is collapsed.
/* GDBus - GLib D-Bus Library
*
* Copyright (C) 2008-2010 Red Hat, Inc.
*
* 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 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., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: David Zeuthen <davidz@redhat.com>
*/
#ifndef __G_DBUS_INTERFACE_STUB_H__
#define __G_DBUS_INTERFACE_STUB_H__
#include <gio/giotypes.h>
G_BEGIN_DECLS
#define G_TYPE_DBUS_INTERFACE_STUB (g_dbus_interface_stub_get_type ())
#define G_DBUS_INTERFACE_STUB(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_INTERFACE_STUB, GDBusInterfaceStub))
#define G_DBUS_INTERFACE_STUB_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DBUS_INTERFACE_STUB, GDBusInterfaceStubClass))
#define G_DBUS_INTERFACE_STUB_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DBUS_INTERFACE_STUB, GDBusInterfaceStubClass))
#define G_IS_DBUS_INTERFACE_STUB(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_INTERFACE_STUB))
#define G_IS_DBUS_INTERFACE_STUB_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DBUS_INTERFACE_STUB))
typedef struct _GDBusInterfaceStubClass GDBusInterfaceStubClass;
typedef struct _GDBusInterfaceStubPrivate GDBusInterfaceStubPrivate;
/**
* GDBusInterfaceStub:
*
* The #GDBusInterfaceStub structure contains private data and should
* only be accessed using the provided API.
*/
struct _GDBusInterfaceStub
{
/*< private >*/
GObject parent_instance;
GDBusInterfaceStubPrivate *priv;
};
/**
* GDBusInterfaceStubClass:
* @parent_class: The parent class.
* @get_info: Returns a #GDBusInterfaceInfo. See g_dbus_interface_stub_get_info() for details.
* @get_vtable: Returns a #GDBusInterfaceVTable. See g_dbus_interface_stub_get_vtable() for details.
* @get_properties: Returns a new, floating, #GVariant with all properties. See g_dbus_interface_stub_get_properties().
* @flush: Emits outstanding changes, if any. See g_dbus_interface_stub_flush().
* @g_authorize_method: Signal class handler for the #GDBusInterfaceStub::g-authorize-method signal.
*
* Class structure for #GDBusInterfaceStub.
*/
struct _GDBusInterfaceStubClass
{
GObjectClass parent_class;
/* Virtual Functions */
GDBusInterfaceInfo *(*get_info) (GDBusInterfaceStub *stub);
GDBusInterfaceVTable *(*get_vtable) (GDBusInterfaceStub *stub);
GVariant *(*get_properties) (GDBusInterfaceStub *stub);
void (*flush) (GDBusInterfaceStub *stub);
/*< private >*/
gpointer vfunc_padding[8];
/*< public >*/
/* Signals */
gboolean (*g_authorize_method) (GDBusInterfaceStub *stub,
GDBusMethodInvocation *invocation);
/*< private >*/
gpointer signal_padding[8];
};
GType g_dbus_interface_stub_get_type (void) G_GNUC_CONST;
GDBusInterfaceStubFlags g_dbus_interface_stub_get_flags (GDBusInterfaceStub *stub);
void g_dbus_interface_stub_set_flags (GDBusInterfaceStub *stub,
GDBusInterfaceStubFlags flags);
GDBusInterfaceInfo *g_dbus_interface_stub_get_info (GDBusInterfaceStub *stub);
GDBusInterfaceVTable *g_dbus_interface_stub_get_vtable (GDBusInterfaceStub *stub);
GVariant *g_dbus_interface_stub_get_properties (GDBusInterfaceStub *stub);
void g_dbus_interface_stub_flush (GDBusInterfaceStub *stub);
gboolean g_dbus_interface_stub_export (GDBusInterfaceStub *stub,
GDBusConnection *connection,
const gchar *object_path,
GError **error);
void g_dbus_interface_stub_unexport (GDBusInterfaceStub *stub);
GDBusConnection *g_dbus_interface_stub_get_connection (GDBusInterfaceStub *stub);
const gchar *g_dbus_interface_stub_get_object_path (GDBusInterfaceStub *stub);
G_END_DECLS
#endif /* __G_DBUS_INTERFACE_STUB_H */
/* GDBus - GLib D-Bus Library
*
* Copyright (C) 2008-2010 Red Hat, Inc.
*
* 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 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., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: David Zeuthen <davidz@redhat.com>
*/
#include "config.h"
#include "gdbusobject.h"
#include "gdbusinterface.h"
#include "gdbusutils.h"
#include "gio-marshal.h"
#include "glibintl.h"
/**
* SECTION:gdbusobject
* @short_description: Base type for D-Bus objects
* @include: gio/gio.h
*
* The #GDBusObject type is the base type for D-Bus objects on both
* the service side (see #GDBusObjectStub) and the client side (see
* #GDBusObjectProxy). It is essentially just a container of
* interfaces.
*/
typedef GDBusObjectIface GDBusObjectInterface;
G_DEFINE_INTERFACE (GDBusObject, g_dbus_object, G_TYPE_OBJECT)
static void
g_dbus_object_default_init (GDBusObjectIface *iface)
{
/**
* GDBusObject::interface-added:
* @object: The #GDBusObject emitting the signal.
* @interface: The #GDBusInterface that was added.
*
* Emitted when @interface is added to @object.
*/
g_signal_new ("interface-added",
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GDBusObjectIface, interface_added),
NULL,
NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
G_TYPE_DBUS_INTERFACE);
/**
* GDBusObject::interface-removed:
* @object: The #GDBusObject emitting the signal.
* @interface: The #GDBusInterface that was removed.
*
* Emitted when @interface is removed from @object.
*/
g_signal_new ("interface-removed",
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GDBusObjectIface, interface_removed),
NULL,
NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
G_TYPE_DBUS_INTERFACE);
}
/* ---------------------------------------------------------------------------------------------------- */
/**
* g_dbus_object_get_object_path:
* @object: A #GDBusObject.
*
* Gets the object path for @object.