mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2025-01-05 19:15:32 +00:00
provider: Add API to query supported protocols
These are the protocols that the provider plugin may support. The origins must be queried independently whether or not they support any given protocol. Example: A SIP origin/account may or may not support the "tel" protocol.
This commit is contained in:
parent
6d8c227b24
commit
7ad0f4cdd6
6 changed files with 70 additions and 0 deletions
|
@ -30,6 +30,10 @@
|
|||
#include <libpeas/peas.h>
|
||||
#include <glib-unix.h>
|
||||
|
||||
static const char * const supported_protocols[] = {
|
||||
"tel",
|
||||
NULL
|
||||
};
|
||||
|
||||
struct _CallsDummyProvider
|
||||
{
|
||||
|
@ -95,6 +99,12 @@ calls_dummy_provider_get_origins (CallsProvider *provider)
|
|||
return G_LIST_MODEL (self->origins);
|
||||
}
|
||||
|
||||
static const char * const *
|
||||
calls_dummy_provider_get_protocols (CallsProvider *provider)
|
||||
{
|
||||
return supported_protocols;
|
||||
}
|
||||
|
||||
static void
|
||||
constructed (GObject *object)
|
||||
{
|
||||
|
@ -134,6 +144,7 @@ calls_dummy_provider_class_init (CallsDummyProviderClass *klass)
|
|||
provider_class->get_name = calls_dummy_provider_get_name;
|
||||
provider_class->get_status = calls_dummy_provider_get_status;
|
||||
provider_class->get_origins = calls_dummy_provider_get_origins;
|
||||
provider_class->get_protocols = calls_dummy_provider_get_protocols;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -32,6 +32,11 @@
|
|||
#include <libpeas/peas.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
static const char * const supported_protocols[] = {
|
||||
"tel",
|
||||
NULL
|
||||
};
|
||||
|
||||
struct _CallsMMProvider
|
||||
{
|
||||
CallsProvider parent_instance;
|
||||
|
@ -354,6 +359,12 @@ calls_mm_provider_get_origins (CallsProvider *provider)
|
|||
return G_LIST_MODEL (self->origins);
|
||||
}
|
||||
|
||||
static const char * const *
|
||||
calls_mm_provider_get_protocols (CallsProvider *provider)
|
||||
{
|
||||
return supported_protocols;
|
||||
}
|
||||
|
||||
static void
|
||||
constructed (GObject *object)
|
||||
{
|
||||
|
@ -415,6 +426,7 @@ calls_mm_provider_class_init (CallsMMProviderClass *klass)
|
|||
provider_class->get_name = calls_mm_provider_get_name;
|
||||
provider_class->get_status = calls_mm_provider_get_status;
|
||||
provider_class->get_origins = calls_mm_provider_get_origins;
|
||||
provider_class->get_protocols = calls_mm_provider_get_protocols;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -34,6 +34,10 @@
|
|||
#include <glib/gi18n.h>
|
||||
#include <libpeas/peas.h>
|
||||
|
||||
static const char * const supported_protocols[] = {
|
||||
"tel",
|
||||
NULL
|
||||
};
|
||||
|
||||
struct _CallsOfonoProvider
|
||||
{
|
||||
|
@ -296,6 +300,11 @@ modem_properties_get_name (GVariant *properties)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static const char * const *
|
||||
calls_ofono_provider_get_protocols (CallsProvider *provider)
|
||||
{
|
||||
return supported_protocols;
|
||||
}
|
||||
|
||||
static void
|
||||
modem_added_cb (GDBOManager *manager,
|
||||
|
@ -525,6 +534,7 @@ calls_ofono_provider_class_init (CallsOfonoProviderClass *klass)
|
|||
provider_class->get_name = calls_ofono_provider_get_name;
|
||||
provider_class->get_status = calls_ofono_provider_get_status;
|
||||
provider_class->get_origins = calls_ofono_provider_get_origins;
|
||||
provider_class->get_protocols = calls_ofono_provider_get_protocols;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -40,6 +40,13 @@
|
|||
#include <sofia-sip/nua.h>
|
||||
#include <sofia-sip/su_glib.h>
|
||||
|
||||
static const char * const supported_protocols[] = {
|
||||
"tel",
|
||||
"sip",
|
||||
"sips",
|
||||
NULL
|
||||
};
|
||||
|
||||
/**
|
||||
* SECTION:sip-provider
|
||||
* @short_description: A #CallsProvider for the SIP protocol
|
||||
|
@ -156,6 +163,12 @@ calls_sip_provider_get_origins (CallsProvider *provider)
|
|||
return G_LIST_MODEL (self->origins);
|
||||
}
|
||||
|
||||
static const char * const *
|
||||
calls_sip_provider_get_protocols (CallsProvider *provider)
|
||||
{
|
||||
return supported_protocols;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
calls_sip_provider_deinit_sip (CallsSipProvider *self)
|
||||
|
@ -319,6 +332,7 @@ calls_sip_provider_class_init (CallsSipProviderClass *klass)
|
|||
provider_class->get_name = calls_sip_provider_get_name;
|
||||
provider_class->get_status = calls_sip_provider_get_status;
|
||||
provider_class->get_origins = calls_sip_provider_get_origins;
|
||||
provider_class->get_protocols = calls_sip_provider_get_protocols;
|
||||
|
||||
props[PROP_SIP_STATE] =
|
||||
g_param_spec_enum ("sip-state",
|
||||
|
|
|
@ -72,6 +72,12 @@ calls_provider_real_get_origins (CallsProvider *self)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static const char * const *
|
||||
calls_provider_real_get_protocols (CallsProvider *self)
|
||||
{
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
calls_provider_get_property (GObject *object,
|
||||
|
@ -101,6 +107,7 @@ calls_provider_class_init (CallsProviderClass *klass)
|
|||
klass->get_name = calls_provider_real_get_name;
|
||||
klass->get_status = calls_provider_real_get_status;
|
||||
klass->get_origins = calls_provider_real_get_origins;
|
||||
klass->get_protocols = calls_provider_real_get_protocols;
|
||||
|
||||
props[PROP_STATUS] =
|
||||
g_param_spec_string ("status",
|
||||
|
@ -223,3 +230,17 @@ calls_provider_unload_plugin (const char *name)
|
|||
else
|
||||
g_warning ("Can't unload plugin: No plugin with name %s found", name);
|
||||
}
|
||||
|
||||
/**
|
||||
* calls_provider_get_protocols:
|
||||
* @self: A #CallsProvider
|
||||
*
|
||||
* Returns: (transfer none): A null-terminated array of strings
|
||||
*/
|
||||
const char * const *
|
||||
calls_provider_get_protocols (CallsProvider *self)
|
||||
{
|
||||
g_return_val_if_fail (CALLS_IS_PROVIDER (self), NULL);
|
||||
|
||||
return CALLS_PROVIDER_GET_CLASS (self)->get_protocols (self);
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@ struct _CallsProviderClass
|
|||
const char *(*get_name) (CallsProvider *self);
|
||||
const char *(*get_status) (CallsProvider *self);
|
||||
GListModel *(*get_origins) (CallsProvider *self);
|
||||
const char * const *(*get_protocols) (CallsProvider *self);
|
||||
};
|
||||
|
||||
const char *calls_provider_get_name (CallsProvider *self);
|
||||
|
@ -54,6 +55,7 @@ const char *calls_provider_get_status (CallsProvider *self);
|
|||
GListModel *calls_provider_get_origins (CallsProvider *self);
|
||||
CallsProvider *calls_provider_load_plugin (const char *name);
|
||||
void calls_provider_unload_plugin (const char *name);
|
||||
const char * const *calls_provider_get_protocols (CallsProvider *self);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
|
Loading…
Reference in a new issue