mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-09-06 17:14:02 +00:00
exported-object: add "path" GObject property to have notify signal
(cherry picked from commit e4e0daeed4
)
This commit is contained in:
parent
cd8e8ab1ca
commit
183d49f759
|
@ -35,8 +35,16 @@
|
|||
#define _ASSERT_NO_EARLY_EXPORT
|
||||
#endif
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static gboolean quitting = FALSE;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
NM_GOBJECT_PROPERTIES_DEFINE (NMExportedObject,
|
||||
PROP_PATH,
|
||||
);
|
||||
|
||||
typedef struct {
|
||||
GDBusInterfaceSkeleton *interface;
|
||||
guint property_changed_signal_id;
|
||||
|
@ -677,6 +685,8 @@ nm_exported_object_export (NMExportedObject *self)
|
|||
|
||||
nm_bus_manager_register_object (priv->bus_mgr, (GDBusObjectSkeleton *) self);
|
||||
|
||||
_notify (self, PROP_PATH);
|
||||
|
||||
return priv->path;
|
||||
}
|
||||
|
||||
|
@ -715,6 +725,8 @@ nm_exported_object_unexport (NMExportedObject *self)
|
|||
g_clear_pointer (&priv->path, g_free);
|
||||
|
||||
nm_clear_g_source (&priv->notify_idle_id);
|
||||
|
||||
_notify (self, PROP_PATH);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -987,7 +999,8 @@ constructed (GObject *object)
|
|||
static void
|
||||
dispose (GObject *object)
|
||||
{
|
||||
NMExportedObjectPrivate *priv = NM_EXPORTED_OBJECT_GET_PRIVATE (NM_EXPORTED_OBJECT (object));
|
||||
NMExportedObject *self = NM_EXPORTED_OBJECT (object);
|
||||
NMExportedObjectPrivate *priv = NM_EXPORTED_OBJECT_GET_PRIVATE (self);
|
||||
|
||||
/* Objects should have already been unexported by their owner, unless
|
||||
* we are quitting, where many objects stick around until exit.
|
||||
|
@ -997,8 +1010,8 @@ dispose (GObject *object)
|
|||
g_warn_if_reached ();
|
||||
nm_exported_object_unexport (NM_EXPORTED_OBJECT (object));
|
||||
}
|
||||
} else
|
||||
g_clear_pointer (&priv->path, g_free);
|
||||
} else if (nm_clear_g_free (&priv->path))
|
||||
_notify (self, PROP_PATH);
|
||||
|
||||
nm_clear_g_source (&priv->notify_idle_id);
|
||||
|
||||
|
@ -1015,4 +1028,12 @@ nm_exported_object_class_init (NMExportedObjectClass *klass)
|
|||
object_class->constructed = constructed;
|
||||
object_class->notify = nm_exported_object_notify;
|
||||
object_class->dispose = dispose;
|
||||
|
||||
obj_properties[PROP_PATH] =
|
||||
g_param_spec_string (NM_EXPORTED_OBJECT_PATH, "", "",
|
||||
NULL,
|
||||
G_PARAM_READABLE |
|
||||
G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties);
|
||||
}
|
||||
|
|
|
@ -49,6 +49,8 @@ void nm_exported_object_skeleton_release (GDBusInterfaceSkeleton *interface);
|
|||
#define NM_IS_EXPORTED_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_EXPORTED_OBJECT))
|
||||
#define NM_EXPORTED_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_EXPORTED_OBJECT, NMExportedObjectClass))
|
||||
|
||||
#define NM_EXPORTED_OBJECT_PATH "path"
|
||||
|
||||
struct _NMExportedObjectPrivate;
|
||||
|
||||
struct _NMExportedObject {
|
||||
|
|
Loading…
Reference in a new issue