mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2025-01-08 04:45:31 +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:
parent
3d85ef802f
commit
cde517096b
2 changed files with 52 additions and 0 deletions
|
@ -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
|
static void
|
||||||
call_added_cb (CallsDBusManager *self, CuiCall *call)
|
call_added_cb (CallsDBusManager *self, CuiCall *call)
|
||||||
{
|
{
|
||||||
|
@ -241,6 +273,12 @@ call_added_cb (CallsDBusManager *self, CuiCall *call)
|
||||||
/* TODO: once calls supports encryption */
|
/* TODO: once calls supports encryption */
|
||||||
calls_dbus_calls_call_set_encrypted (iface, FALSE);
|
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: */
|
/* Export with properties bound to reduce DBus traffic: */
|
||||||
g_debug ("Exporting %p at %s", call, path);
|
g_debug ("Exporting %p at %s", call, path);
|
||||||
g_dbus_object_manager_server_export (self->object_manager, G_DBUS_OBJECT_SKELETON (object));
|
g_dbus_object_manager_server_export (self->object_manager, G_DBUS_OBJECT_SKELETON (object));
|
||||||
|
|
|
@ -147,5 +147,19 @@
|
||||||
</doc:description>
|
</doc:description>
|
||||||
</doc:doc>
|
</doc:doc>
|
||||||
</property>
|
</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>
|
</interface>
|
||||||
</node>
|
</node>
|
||||||
|
|
Loading…
Reference in a new issue