1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-06-09 05:19:34 +00:00

dbus: Add hint property

This is a dictionary to allow for future extensibility. Currently we're only
hinting if the UI should be shown for a given call.
This commit is contained in:
Evangelos Ribeiro Tzaras 2022-02-01 10:54:07 +01:00
parent 3d85ef802f
commit cde517096b
2 changed files with 52 additions and 0 deletions

View file

@ -202,6 +202,38 @@ on_handle_call_silence (CallsDBusCallsCall *skeleton,
}
static GVariant *
build_hints (CallsUiCallData *call)
{
GVariantDict dict;
g_return_val_if_fail (CALLS_IS_UI_CALL_DATA (call), NULL);
g_variant_dict_init (&dict, NULL);
g_variant_dict_insert (&dict, "ui-active", "b",
calls_ui_call_data_get_ui_active (call));
return g_variant_dict_end (&dict);
}
static void
on_notify_update_hints (CallsUiCallData *call,
GParamSpec *unused,
CallsDBusCallsCall *iface)
{
GVariant *hints;
g_assert (CALLS_IS_UI_CALL_DATA (call));
g_assert (CALLS_DBUS_IS_CALLS_CALL (iface));
hints = build_hints (call);
calls_dbus_calls_call_set_hints (iface, hints);
}
static void
call_added_cb (CallsDBusManager *self, CuiCall *call)
{
@ -241,6 +273,12 @@ call_added_cb (CallsDBusManager *self, CuiCall *call)
/* TODO: once calls supports encryption */
calls_dbus_calls_call_set_encrypted (iface, FALSE);
g_signal_connect (call,
"notify::ui-active",
G_CALLBACK (on_notify_update_hints),
iface);
on_notify_update_hints (CALLS_UI_CALL_DATA (call), NULL, iface);
/* Export with properties bound to reduce DBus traffic: */
g_debug ("Exporting %p at %s", call, path);
g_dbus_object_manager_server_export (self->object_manager, G_DBUS_OBJECT_SKELETON (object));

View file

@ -147,5 +147,19 @@
</doc:description>
</doc:doc>
</property>
<!--
Hints:
Additional property dictionary with hints.
"ui-active" hints whether the UI should be shown or not.
-->
<property name="Hints" type="a{sv}" access="read">
<doc:doc>
<doc:description>
<doc:para>Additional hints about this call</doc:para>
</doc:description>
</doc:doc>
</property>
</interface>
</node>