From 0dc906c2bb429a6fbbaad445694e0361646e0bb1 Mon Sep 17 00:00:00 2001 From: Bob Ham Date: Fri, 28 Jun 2019 13:59:03 +0100 Subject: [PATCH] plugins/mm: Implement inbound property --- plugins/mm/calls-mm-call.c | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/plugins/mm/calls-mm-call.c b/plugins/mm/calls-mm-call.c index 467147e..a7c304b 100644 --- a/plugins/mm/calls-mm-call.c +++ b/plugins/mm/calls-mm-call.c @@ -52,6 +52,7 @@ G_DEFINE_TYPE_WITH_CODE (CallsMMCall, calls_mm_call, G_TYPE_OBJECT, enum { PROP_0, PROP_MM_CALL, + PROP_INBOUND, PROP_LAST_PROP, }; static GParamSpec *props[PROP_LAST_PROP]; @@ -334,6 +335,28 @@ constructed (GObject *object) } +static void +get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + CallsMMCall *self = CALLS_MM_CALL (object); + + switch (property_id) { + case PROP_INBOUND: + g_value_set_boolean (value, + mm_call_get_direction (self->mm_call) + == MM_CALL_DIRECTION_INCOMING); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + static void dispose (GObject *object) { @@ -364,6 +387,7 @@ calls_mm_call_class_init (CallsMMCallClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + object_class->get_property = get_property; object_class->set_property = set_property; object_class->constructed = constructed; object_class->dispose = dispose; @@ -375,8 +399,17 @@ calls_mm_call_class_init (CallsMMCallClass *klass) _("A libmm-glib proxy object for the underlying call object"), MM_TYPE_CALL, G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY); + g_object_class_install_property (object_class, PROP_MM_CALL, + props[PROP_MM_CALL]); - g_object_class_install_properties (object_class, PROP_LAST_PROP, props); + + props[PROP_INBOUND] = + g_param_spec_boolean ("inbound", + _("Inbound"), + _("Whether the call is inbound"), + FALSE, + G_PARAM_READABLE | G_PARAM_CONSTRUCT); + g_object_class_override_property (object_class, PROP_INBOUND, "inbound"); }