origin: Add id property and adapt to changes

The id property will be used to keep track of which origin was used for a call,
so that we can default to reusing the same origin when placing a call from the
history.
This commit is contained in:
Evangelos Ribeiro Tzaras
2022-01-27 15:28:35 +01:00
parent 04605efac7
commit 16b86c29b2
12 changed files with 101 additions and 6 deletions

View File

@@ -70,6 +70,14 @@ calls_origin_default_init (CallsOriginInterface *iface)
NULL,
G_PARAM_READABLE));
g_object_interface_install_property (
iface,
g_param_spec_string ("id",
"ID",
"ID of the origin",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
signals[SIGNAL_CALL_ADDED] =
g_signal_newv ("call-added",
G_TYPE_FROM_INTERFACE (iface),
@@ -101,6 +109,17 @@ calls_origin_default_init (CallsOriginInterface *iface)
*/
DEFINE_ORIGIN_GETTER(name, char *, NULL);
/**
* calls_origin_get_id:
* @self: a #CallsOrigin
*
* Get the id of the origin.
*
* Returns (transfer full): A string containing the id. The string must be freed by
* the caller.
*/
DEFINE_ORIGIN_GETTER(id, char *, NULL);
/**
* calls_origin_get_calls:
* @self: a #CallsOrigin

View File

@@ -51,6 +51,7 @@ struct _CallsOriginInterface
typedef void (*CallsOriginForeachCallFunc) (gpointer param, CallsCall* call, CallsOrigin* origin);
char * calls_origin_get_name (CallsOrigin *self);
char * calls_origin_get_id (CallsOrigin *self);
GList * calls_origin_get_calls (CallsOrigin *self);
void calls_origin_foreach_call (CallsOrigin *self,
CallsOriginForeachCallFunc callback,