origin: Add API to query supported protocols
This will allow selecting a suitable origin when placing outgoing calls.
This commit is contained in:
@@ -162,3 +162,25 @@ calls_origin_dial(CallsOrigin *self,
|
||||
|
||||
return iface->dial(self, number);
|
||||
}
|
||||
|
||||
/**
|
||||
* calls_origin_supports_protocol:
|
||||
* @self: A #CallsOrigin
|
||||
* @protocol: The protocol to check support for
|
||||
*
|
||||
* Returns: %TRUE if the origin supports the protocol, %FALSE otherwise
|
||||
*/
|
||||
gboolean
|
||||
calls_origin_supports_protocol (CallsOrigin *self,
|
||||
const char *protocol)
|
||||
{
|
||||
CallsOriginInterface *iface;
|
||||
|
||||
g_return_val_if_fail (CALLS_IS_ORIGIN (self), FALSE);
|
||||
g_return_val_if_fail (protocol != NULL, FALSE);
|
||||
|
||||
iface = CALLS_ORIGIN_GET_IFACE (self);
|
||||
g_return_val_if_fail (iface->supports_protocol != NULL, FALSE);
|
||||
|
||||
return iface->supports_protocol (self, protocol);
|
||||
}
|
||||
|
||||
@@ -44,6 +44,8 @@ struct _CallsOriginInterface
|
||||
|
||||
void (*dial) (CallsOrigin *self,
|
||||
const char *number);
|
||||
gboolean (*supports_protocol) (CallsOrigin *self,
|
||||
const char *protocol);
|
||||
};
|
||||
|
||||
typedef void (*CallsOriginForeachCallFunc) (gpointer param, CallsCall* call, CallsOrigin* origin);
|
||||
@@ -55,6 +57,8 @@ void calls_origin_foreach_call (CallsOrigin *self,
|
||||
gpointer param);
|
||||
void calls_origin_dial (CallsOrigin *self,
|
||||
const char *number);
|
||||
gboolean calls_origin_supports_protocol (CallsOrigin *self,
|
||||
const char *protocol);
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* CALLS_ORIGIN_H__ */
|
||||
|
||||
Reference in New Issue
Block a user