account: Add address property

This commit is contained in:
Evangelos Ribeiro Tzaras
2021-07-04 00:24:30 +02:00
committed by Evangelos Ribeiro Tzaras
parent dd3fbf646e
commit a638b64402
3 changed files with 53 additions and 1 deletions

View File

@@ -48,6 +48,15 @@ calls_account_default_init (CallsAccountInterface *iface)
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY));
g_object_interface_install_property (iface,
g_param_spec_string ("address",
"Address",
"The address of this account",
NULL,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS |
G_PARAM_EXPLICIT_NOTIFY));
}
/**
@@ -88,3 +97,23 @@ calls_account_get_state (CallsAccount *self)
return state;
}
/**
* calls_account_get_address:
* @self: A #CallsAccount
*
* Returns: The address under which this account can be reached.
* For example: alice@example.org for SIP and XMPP/Jingle or @alice:example.org for Matrix
*/
const char *
calls_account_get_address (CallsAccount *self)
{
CallsAccountInterface *iface;
g_return_val_if_fail (CALLS_IS_ACCOUNT (self), NULL);
iface = CALLS_ACCOUNT_GET_IFACE (self);
g_return_val_if_fail (iface->get_address, NULL);
return iface->get_address (self);
}

View File

@@ -42,6 +42,7 @@ struct _CallsAccountInterface
void (*go_online) (CallsAccount *self,
gboolean online);
const char *(*get_address) (CallsAccount *self);
};
/**
* CallsAccountState:
@@ -69,6 +70,7 @@ typedef enum {
void calls_account_go_online (CallsAccount *self,
gboolean online);
const char *calls_account_get_address (CallsAccount *self);
CallsAccountState calls_account_get_state (CallsAccount *self);
G_END_DECLS