aboutsummaryrefslogtreecommitdiff
path: root/src/mm-base-call.c
diff options
context:
space:
mode:
authorDan Williams <dan@ioncontrol.co>2025-04-30 15:43:52 -0500
committerDan Williams <dan@ioncontrol.co>2025-05-08 20:08:06 -0500
commitec5104c9a87a440bb791987ffe05e53bf235ae02 (patch)
tree48ff299064c675975c2b94c435cd5fef9466e508 /src/mm-base-call.c
parentef5cee3ab578c2fde8ca6cc636f10acfdb79f123 (diff)
Move log parent and connection property binding to helper
Continues removing usage of MMBaseModem in a bunch of files by splitting out bits of its usage to separate interfaces. Signed-off-by: Dan Williams <dan@ioncontrol.co>
Diffstat (limited to 'src/mm-base-call.c')
-rw-r--r--src/mm-base-call.c36
1 files changed, 26 insertions, 10 deletions
diff --git a/src/mm-base-call.c b/src/mm-base-call.c
index c1408559..6308fd18 100644
--- a/src/mm-base-call.c
+++ b/src/mm-base-call.c
@@ -35,16 +35,20 @@
#include "mm-log-object.h"
#include "mm-modem-helpers.h"
#include "mm-error-helpers.h"
+#include "mm-bind.h"
static void log_object_iface_init (MMLogObjectInterface *iface);
+static void bind_iface_init (MMBindInterface *iface);
G_DEFINE_TYPE_EXTENDED (MMBaseCall, mm_base_call, MM_GDBUS_TYPE_CALL_SKELETON, 0,
- G_IMPLEMENT_INTERFACE (MM_TYPE_LOG_OBJECT, log_object_iface_init))
+ G_IMPLEMENT_INTERFACE (MM_TYPE_LOG_OBJECT, log_object_iface_init)
+ G_IMPLEMENT_INTERFACE (MM_TYPE_BIND, bind_iface_init))
enum {
PROP_0,
PROP_PATH,
PROP_CONNECTION,
+ PROP_BIND_TO,
PROP_MODEM,
PROP_SKIP_INCOMING_TIMEOUT,
PROP_SUPPORTS_DIALING_TO_RINGING,
@@ -63,6 +67,9 @@ struct _MMBaseCallPrivate {
MMAuthProvider *authp;
GCancellable *authp_cancellable;
+ /* The object this Call is bound to */
+ GObject *bind_to;
+
/* The modem which owns this call */
MMBaseModem *modem;
/* The path where the call object is exported */
@@ -1304,6 +1311,7 @@ log_object_build_id (MMLogObject *_self)
MMBaseCall *
mm_base_call_new (MMBaseModem *modem,
+ GObject *bind_to,
MMCallDirection direction,
const gchar *number,
gboolean skip_incoming_timeout,
@@ -1312,6 +1320,7 @@ mm_base_call_new (MMBaseModem *modem,
{
return MM_BASE_CALL (g_object_new (MM_TYPE_BASE_CALL,
MM_BASE_CALL_MODEM, modem,
+ MM_BIND_TO, bind_to,
"direction", direction,
"number", number,
MM_BASE_CALL_SKIP_INCOMING_TIMEOUT, skip_incoming_timeout,
@@ -1351,18 +1360,14 @@ set_property (GObject *object,
else if (self->priv->path)
call_dbus_export (self);
break;
+ case PROP_BIND_TO:
+ g_clear_object (&self->priv->bind_to);
+ self->priv->bind_to = g_value_dup_object (value);
+ mm_bind_to (MM_BIND (self), MM_BASE_CALL_CONNECTION, self->priv->bind_to);
+ break;
case PROP_MODEM:
g_clear_object (&self->priv->modem);
self->priv->modem = g_value_dup_object (value);
- if (self->priv->modem) {
- /* Set owner ID */
- mm_log_object_set_owner_id (MM_LOG_OBJECT (self), mm_log_object_get_id (MM_LOG_OBJECT (self->priv->modem)));
- /* Bind the modem's connection (which is set when it is exported,
- * and unset when unexported) to the call's connection */
- g_object_bind_property (self->priv->modem, MM_BASE_MODEM_CONNECTION,
- self, MM_BASE_CALL_CONNECTION,
- G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
- }
break;
case PROP_SKIP_INCOMING_TIMEOUT:
self->priv->skip_incoming_timeout = g_value_get_boolean (value);
@@ -1394,6 +1399,9 @@ get_property (GObject *object,
case PROP_CONNECTION:
g_value_set_object (value, self->priv->connection);
break;
+ case PROP_BIND_TO:
+ g_value_set_object (value, self->priv->bind_to);
+ break;
case PROP_MODEM:
g_value_set_object (value, self->priv->modem);
break;
@@ -1459,6 +1467,7 @@ dispose (GObject *object)
}
g_clear_object (&self->priv->modem);
+ g_clear_object (&self->priv->bind_to);
g_cancellable_cancel (self->priv->authp_cancellable);
g_clear_object (&self->priv->authp_cancellable);
@@ -1472,6 +1481,11 @@ log_object_iface_init (MMLogObjectInterface *iface)
}
static void
+bind_iface_init (MMBindInterface *iface)
+{
+}
+
+static void
mm_base_call_class_init (MMBaseCallClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -1511,6 +1525,8 @@ mm_base_call_class_init (MMBaseCallClass *klass)
G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_PATH, properties[PROP_PATH]);
+ g_object_class_override_property (object_class, PROP_BIND_TO, MM_BIND_TO);
+
properties[PROP_MODEM] =
g_param_spec_object (MM_BASE_CALL_MODEM,
"Modem",