gdbusobjectmanager: store signal ids for re-use

Having access to the signal-id is useful when we want to specify additional
signal related settings (such as va_marshaller).
This commit is contained in:
Christian Hergert 2019-06-17 16:11:26 -07:00
parent 266a292a35
commit d7c1d477bc

View File

@ -51,6 +51,16 @@
typedef GDBusObjectManagerIface GDBusObjectManagerInterface;
G_DEFINE_INTERFACE (GDBusObjectManager, g_dbus_object_manager, G_TYPE_OBJECT)
enum {
OBJECT_ADDED,
OBJECT_REMOVED,
INTERFACE_ADDED,
INTERFACE_REMOVED,
N_SIGNALS
};
static guint signals[N_SIGNALS];
static void
g_dbus_object_manager_default_init (GDBusObjectManagerIface *iface)
{
@ -63,16 +73,17 @@ g_dbus_object_manager_default_init (GDBusObjectManagerIface *iface)
*
* Since: 2.30
*/
g_signal_new (I_("object-added"),
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GDBusObjectManagerIface, object_added),
NULL,
NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
G_TYPE_DBUS_OBJECT);
signals[OBJECT_ADDED] =
g_signal_new (I_("object-added"),
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GDBusObjectManagerIface, object_added),
NULL,
NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
G_TYPE_DBUS_OBJECT);
/**
* GDBusObjectManager::object-removed:
@ -83,16 +94,17 @@ g_dbus_object_manager_default_init (GDBusObjectManagerIface *iface)
*
* Since: 2.30
*/
g_signal_new (I_("object-removed"),
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GDBusObjectManagerIface, object_removed),
NULL,
NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
G_TYPE_DBUS_OBJECT);
signals[OBJECT_REMOVED] =
g_signal_new (I_("object-removed"),
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GDBusObjectManagerIface, object_removed),
NULL,
NULL,
g_cclosure_marshal_VOID__OBJECT,
G_TYPE_NONE,
1,
G_TYPE_DBUS_OBJECT);
/**
* GDBusObjectManager::interface-added:
@ -107,17 +119,18 @@ g_dbus_object_manager_default_init (GDBusObjectManagerIface *iface)
*
* Since: 2.30
*/
g_signal_new (I_("interface-added"),
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GDBusObjectManagerIface, interface_added),
NULL,
NULL,
NULL,
G_TYPE_NONE,
2,
G_TYPE_DBUS_OBJECT,
G_TYPE_DBUS_INTERFACE);
signals[INTERFACE_ADDED] =
g_signal_new (I_("interface-added"),
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GDBusObjectManagerIface, interface_added),
NULL,
NULL,
NULL,
G_TYPE_NONE,
2,
G_TYPE_DBUS_OBJECT,
G_TYPE_DBUS_INTERFACE);
/**
* GDBusObjectManager::interface-removed:
@ -132,17 +145,18 @@ g_dbus_object_manager_default_init (GDBusObjectManagerIface *iface)
*
* Since: 2.30
*/
g_signal_new (I_("interface-removed"),
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GDBusObjectManagerIface, interface_removed),
NULL,
NULL,
NULL,
G_TYPE_NONE,
2,
G_TYPE_DBUS_OBJECT,
G_TYPE_DBUS_INTERFACE);
signals[INTERFACE_REMOVED] =
g_signal_new (I_("interface-removed"),
G_TYPE_FROM_INTERFACE (iface),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (GDBusObjectManagerIface, interface_removed),
NULL,
NULL,
NULL,
G_TYPE_NONE,
2,
G_TYPE_DBUS_OBJECT,
G_TYPE_DBUS_INTERFACE);
}