[calls] dbus: Add more DBus properties



commit f45ba43720c825f44d996baba0caab1c5643620c
Author: Guido Günther <agx sigxcpu org>
Date:   Fri Jun 25 15:47:30 2021 +0200

    dbus: Add more DBus properties
    
    These are needed to allow Phosh to handle incoming calls on
    the locked screen.

 src/calls-dbus-manager.c          | 16 ++++++++++++++--
 src/dbus/org.gnome.Calls.Call.xml | 24 ++++++++++++++++++++++--
 2 files changed, 36 insertions(+), 4 deletions(-)
---
diff --git a/src/calls-dbus-manager.c b/src/calls-dbus-manager.c
index 13a2d711..46b9915c 100644
--- a/src/calls-dbus-manager.c
+++ b/src/calls-dbus-manager.c
@@ -108,22 +108,34 @@ call_added_cb (CallsDBusManager *self, CallsCall *call)
   g_autoptr (GError) error = NULL;
   g_autoptr (CallsDBusObjectSkeleton) object = NULL;
   g_autoptr (CallsDBusCallsCall) iface = NULL;
+  g_autoptr (CallsBestMatch) match = NULL;
 
   path = get_obj_path (self, self->iface_num++);
   object = calls_dbus_object_skeleton_new (path);
   iface = calls_dbus_calls_call_skeleton_new ();
   g_dbus_object_skeleton_add_interface (G_DBUS_OBJECT_SKELETON (object),
                                         G_DBUS_INTERFACE_SKELETON (iface));
-  g_object_set_data_full (G_OBJECT (object), "call", g_object_ref (call), g_object_unref);
 
+  /* Keep in sync with call object */
+  g_object_set_data_full (G_OBJECT (object), "call", g_object_ref (call), g_object_unref);
   g_object_connect (iface,
                     "object_signal::handle-accept", G_CALLBACK (on_handle_call_accept), call,
                     "object_signal::handle-hangup", G_CALLBACK (on_handle_call_hangup), call,
                     NULL);
-
   g_object_bind_property (call, "state", iface, "state", G_BINDING_SYNC_CREATE);
   g_object_bind_property (call, "inbound", iface, "inbound", G_BINDING_SYNC_CREATE);
   g_object_bind_property (call, "number", iface, "id", G_BINDING_SYNC_CREATE);
+  g_object_bind_property (call, "protocol", iface, "protocol", G_BINDING_SYNC_CREATE);
+  /* TODO: once calls supports encryption */
+  calls_dbus_calls_call_set_encrypted (iface, FALSE);
+
+  /* Keep in sync BestMatch object */
+  match = calls_call_get_contact (call);
+  if (calls_best_match_has_individual (match)) {
+    g_object_bind_property (match, "name", iface, "display-name", G_BINDING_SYNC_CREATE);
+    /* TODO: avatar once https://source.puri.sm/Librem5/calls/-/issues/161 is fixed */
+  }
+  g_object_set_data_full (G_OBJECT (object), "contact", g_steal_pointer (&match), g_object_unref);
 
   /* Export with properties bound to reduce DBus traffic: */
   g_debug ("Exporting %p at %s", call, path);
diff --git a/src/dbus/org.gnome.Calls.Call.xml b/src/dbus/org.gnome.Calls.Call.xml
index f8ca6fdd..57fc77ff 100644
--- a/src/dbus/org.gnome.Calls.Call.xml
+++ b/src/dbus/org.gnome.Calls.Call.xml
@@ -33,7 +33,27 @@
         </doc:description>
       </doc:doc>
     </property>
-    <property name="Party" type="s" access="read"/>
+    <property name="DisplayName" type="s" access="read">
+      <doc:doc>
+        <doc:description>
+          <doc:para>The DisplayName of the calling party, e.g. from address book</doc:para>
+        </doc:description>
+      </doc:doc>
+    </property>
+    <property name="Protocol" type="s" access="read">
+      <doc:doc>
+        <doc:description>
+          <doc:para>The protocol used for this call</doc:para>
+        </doc:description>
+      </doc:doc>
+    </property>
+    <property name="Encrypted" type="b" access="read">
+      <doc:doc>
+        <doc:description>
+          <doc:para>Whether the call is encrypted. This does not indicate anything about the
+          type of encryption being used.</doc:para>
+        </doc:description>
+      </doc:doc>
+    </property>
   </interface>
-
 </node>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]