mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2024-11-04 23:51:17 +00:00
Let calls-provider be an abstract class
And adapt to changes. A calls-mm-provider IS-A calls-provider (and so on)
This commit is contained in:
parent
1c8eb87e7f
commit
5684d54bbd
8 changed files with 177 additions and 201 deletions
|
@ -33,55 +33,30 @@
|
|||
|
||||
struct _CallsDummyProvider
|
||||
{
|
||||
GObject parent_instance;
|
||||
CallsProvider parent_instance;
|
||||
|
||||
GList *origins;
|
||||
};
|
||||
|
||||
static void calls_dummy_provider_message_source_interface_init (CallsProviderInterface *iface);
|
||||
static void calls_dummy_provider_provider_interface_init (CallsProviderInterface *iface);
|
||||
static void calls_dummy_provider_message_source_interface_init (CallsMessageSourceInterface *iface);
|
||||
|
||||
|
||||
#ifdef FOR_TESTING
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE
|
||||
(CallsDummyProvider, calls_dummy_provider, G_TYPE_OBJECT,
|
||||
(CallsDummyProvider, calls_dummy_provider, CALLS_TYPE_PROVIDER,
|
||||
G_IMPLEMENT_INTERFACE (CALLS_TYPE_MESSAGE_SOURCE,
|
||||
calls_dummy_provider_message_source_interface_init)
|
||||
G_IMPLEMENT_INTERFACE (CALLS_TYPE_PROVIDER,
|
||||
calls_dummy_provider_provider_interface_init))
|
||||
calls_dummy_provider_message_source_interface_init))
|
||||
|
||||
#else
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED
|
||||
(CallsDummyProvider, calls_dummy_provider, G_TYPE_OBJECT, 0,
|
||||
(CallsDummyProvider, calls_dummy_provider, CALLS_TYPE_PROVIDER, 0,
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (CALLS_TYPE_MESSAGE_SOURCE,
|
||||
calls_dummy_provider_message_source_interface_init)
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (CALLS_TYPE_PROVIDER,
|
||||
calls_dummy_provider_provider_interface_init))
|
||||
calls_dummy_provider_message_source_interface_init))
|
||||
|
||||
#endif /* FOR_TESTING */
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_STATUS,
|
||||
PROP_LAST_PROP,
|
||||
};
|
||||
|
||||
static const gchar *
|
||||
get_name (CallsProvider *iface)
|
||||
{
|
||||
return "Dummy provider";
|
||||
}
|
||||
|
||||
|
||||
static GList *
|
||||
get_origins (CallsProvider *iface)
|
||||
{
|
||||
CallsDummyProvider *self = CALLS_DUMMY_PROVIDER (iface);
|
||||
return g_list_copy (self->origins);
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
usr1_handler (CallsDummyProvider *self)
|
||||
|
@ -98,6 +73,25 @@ usr1_handler (CallsDummyProvider *self)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static const char *
|
||||
calls_dummy_provider_get_name (CallsProvider *provider)
|
||||
{
|
||||
return "Dummy provider";
|
||||
}
|
||||
|
||||
static const char *
|
||||
calls_dummy_provider_get_status (CallsProvider *provider)
|
||||
{
|
||||
return "Normal";
|
||||
}
|
||||
|
||||
static GList *
|
||||
calls_dummy_provider_get_origins (CallsProvider *provider)
|
||||
{
|
||||
CallsDummyProvider *self = CALLS_DUMMY_PROVIDER (provider);
|
||||
|
||||
return g_list_copy (self->origins);
|
||||
}
|
||||
|
||||
static void
|
||||
constructed (GObject *object)
|
||||
|
@ -114,24 +108,6 @@ constructed (GObject *object)
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
switch (property_id) {
|
||||
case PROP_STATUS:
|
||||
g_value_set_string (value, "Normal");
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
dispose (GObject *object)
|
||||
{
|
||||
|
@ -157,29 +133,23 @@ static void
|
|||
calls_dummy_provider_class_init (CallsDummyProviderClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
CallsProviderClass *provider_class = CALLS_PROVIDER_CLASS (klass);
|
||||
|
||||
object_class->constructed = constructed;
|
||||
object_class->get_property = get_property;
|
||||
object_class->dispose = dispose;
|
||||
|
||||
g_object_class_override_property (object_class, PROP_STATUS, "status");
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
calls_dummy_provider_message_source_interface_init (CallsProviderInterface *iface)
|
||||
calls_dummy_provider_message_source_interface_init (CallsMessageSourceInterface *iface)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
calls_dummy_provider_provider_interface_init (CallsProviderInterface *iface)
|
||||
{
|
||||
iface->get_name = get_name;
|
||||
iface->get_origins = get_origins;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
calls_dummy_provider_init (CallsDummyProvider *self)
|
||||
{
|
||||
|
|
|
@ -27,11 +27,13 @@
|
|||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "calls-provider.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CALLS_TYPE_DUMMY_PROVIDER (calls_dummy_provider_get_type ())
|
||||
|
||||
G_DECLARE_FINAL_TYPE (CallsDummyProvider, calls_dummy_provider, CALLS, DUMMY_PROVIDER, GObject);
|
||||
G_DECLARE_FINAL_TYPE (CallsDummyProvider, calls_dummy_provider, CALLS, DUMMY_PROVIDER, CallsProvider)
|
||||
|
||||
CallsDummyProvider *calls_dummy_provider_new ();
|
||||
void calls_dummy_provider_add_origin (CallsDummyProvider *self,
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
struct _CallsMMProvider
|
||||
{
|
||||
GObject parent_instance;
|
||||
CallsProvider parent_instance;
|
||||
|
||||
/* The status property */
|
||||
gchar *status;
|
||||
|
@ -46,37 +46,12 @@ struct _CallsMMProvider
|
|||
GHashTable *origins;
|
||||
};
|
||||
|
||||
static void calls_mm_provider_message_source_interface_init (CallsProviderInterface *iface);
|
||||
static void calls_mm_provider_provider_interface_init (CallsProviderInterface *iface);
|
||||
static void calls_mm_provider_message_source_interface_init (CallsMessageSourceInterface *iface);
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED
|
||||
(CallsMMProvider, calls_mm_provider, G_TYPE_OBJECT, 0,
|
||||
(CallsMMProvider, calls_mm_provider, CALLS_TYPE_PROVIDER, 0,
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (CALLS_TYPE_MESSAGE_SOURCE,
|
||||
calls_mm_provider_message_source_interface_init)
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (CALLS_TYPE_PROVIDER,
|
||||
calls_mm_provider_provider_interface_init))
|
||||
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_STATUS,
|
||||
PROP_LAST_PROP,
|
||||
};
|
||||
|
||||
|
||||
static const gchar *
|
||||
get_name (CallsProvider *iface)
|
||||
{
|
||||
return "ModemManager";
|
||||
}
|
||||
|
||||
|
||||
static GList *
|
||||
get_origins (CallsProvider *iface)
|
||||
{
|
||||
CallsMMProvider *self = CALLS_MM_PROVIDER (iface);
|
||||
return g_hash_table_get_values (self->origins);
|
||||
}
|
||||
calls_mm_provider_message_source_interface_init))
|
||||
|
||||
|
||||
static void
|
||||
|
@ -357,6 +332,28 @@ mm_vanished_cb (GDBusConnection *connection,
|
|||
}
|
||||
|
||||
|
||||
static const char *
|
||||
calls_mm_provider_get_name (CallsProvider *provider)
|
||||
{
|
||||
return "ModemManager";
|
||||
}
|
||||
|
||||
static const char *
|
||||
calls_mm_provider_get_status (CallsProvider *provider)
|
||||
{
|
||||
CallsMMProvider *self = CALLS_MM_PROVIDER (provider);
|
||||
|
||||
return self->status;
|
||||
}
|
||||
|
||||
static GList *
|
||||
calls_mm_provider_get_origins (CallsProvider *provider)
|
||||
{
|
||||
CallsMMProvider *self = CALLS_MM_PROVIDER (provider);
|
||||
|
||||
return g_hash_table_get_values (self->origins);
|
||||
}
|
||||
|
||||
static void
|
||||
constructed (GObject *object)
|
||||
{
|
||||
|
@ -376,26 +373,6 @@ constructed (GObject *object)
|
|||
}
|
||||
|
||||
|
||||
static void
|
||||
get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
CallsMMProvider *self = CALLS_MM_PROVIDER (object);
|
||||
|
||||
switch (property_id) {
|
||||
case PROP_STATUS:
|
||||
g_value_set_string (value, self->status);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
dispose (GObject *object)
|
||||
{
|
||||
|
@ -429,13 +406,15 @@ static void
|
|||
calls_mm_provider_class_init (CallsMMProviderClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
CallsProviderClass *provider_class = CALLS_PROVIDER_CLASS (klass);
|
||||
|
||||
object_class->constructed = constructed;
|
||||
object_class->get_property = get_property;
|
||||
object_class->dispose = dispose;
|
||||
object_class->finalize = finalize;
|
||||
|
||||
g_object_class_override_property (object_class, PROP_STATUS, "status");
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -445,19 +424,11 @@ calls_mm_provider_class_finalize (CallsMMProviderClass *klass)
|
|||
}
|
||||
|
||||
static void
|
||||
calls_mm_provider_message_source_interface_init (CallsProviderInterface *iface)
|
||||
calls_mm_provider_message_source_interface_init (CallsMessageSourceInterface *iface)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
calls_mm_provider_provider_interface_init (CallsProviderInterface *iface)
|
||||
{
|
||||
iface->get_name = get_name;
|
||||
iface->get_origins = get_origins;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
calls_mm_provider_init (CallsMMProvider *self)
|
||||
{
|
||||
|
|
|
@ -28,11 +28,13 @@
|
|||
#include <glib-object.h>
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include "calls-provider.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CALLS_TYPE_MM_PROVIDER (calls_mm_provider_get_type ())
|
||||
|
||||
G_DECLARE_FINAL_TYPE (CallsMMProvider, calls_mm_provider, CALLS, MM_PROVIDER, GObject);
|
||||
G_DECLARE_FINAL_TYPE (CallsMMProvider, calls_mm_provider, CALLS, MM_PROVIDER, CallsProvider)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
struct _CallsOfonoProvider
|
||||
{
|
||||
GObject parent_instance;
|
||||
CallsProvider parent_instance;
|
||||
|
||||
/** D-Bus connection */
|
||||
GDBusConnection *connection;
|
||||
|
@ -50,23 +50,13 @@ struct _CallsOfonoProvider
|
|||
};
|
||||
|
||||
|
||||
static void calls_ofono_provider_message_source_interface_init (CallsProviderInterface *iface);
|
||||
static void calls_ofono_provider_provider_interface_init (CallsProviderInterface *iface);
|
||||
static void calls_ofono_provider_message_source_interface_init (CallsMessageSourceInterface *iface);
|
||||
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE_EXTENDED
|
||||
(CallsOfonoProvider, calls_ofono_provider, G_TYPE_OBJECT, 0,
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (CALLS_TYPE_MESSAGE_SOURCE,
|
||||
calls_ofono_provider_message_source_interface_init)
|
||||
G_IMPLEMENT_INTERFACE_DYNAMIC (CALLS_TYPE_PROVIDER,
|
||||
calls_ofono_provider_provider_interface_init))
|
||||
|
||||
|
||||
static const gchar *
|
||||
get_name (CallsProvider *iface)
|
||||
{
|
||||
return "oFono";
|
||||
}
|
||||
calls_ofono_provider_message_source_interface_init))
|
||||
|
||||
|
||||
static void
|
||||
|
@ -78,19 +68,6 @@ add_origin_to_list (const gchar *path,
|
|||
}
|
||||
|
||||
|
||||
static GList *
|
||||
get_origins (CallsProvider *iface)
|
||||
{
|
||||
CallsOfonoProvider *self = CALLS_OFONO_PROVIDER (iface);
|
||||
GList *list = NULL;
|
||||
|
||||
g_hash_table_foreach (self->origins,
|
||||
(GHFunc)add_origin_to_list, &list);
|
||||
|
||||
return g_list_reverse (list);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
add_origin (CallsOfonoProvider *self,
|
||||
const gchar *path,
|
||||
|
@ -376,6 +353,30 @@ get_modems_cb (GDBOManager *manager,
|
|||
g_variant_unref (modems);
|
||||
}
|
||||
|
||||
static const char *
|
||||
calls_ofono_provider_get_name (CallsProvider *provider)
|
||||
{
|
||||
return "Ofono";
|
||||
}
|
||||
|
||||
static const char *
|
||||
calls_ofono_provider_get_status (CallsProvider *provider)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
static GList *
|
||||
calls_ofono_provider_get_origins (CallsProvider *provider)
|
||||
{
|
||||
CallsOfonoProvider *self = CALLS_OFONO_PROVIDER (provider);
|
||||
GList *list = NULL;
|
||||
|
||||
g_hash_table_foreach (self->origins,
|
||||
(GHFunc)add_origin_to_list, &list);
|
||||
|
||||
return g_list_reverse (list);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
constructed (GObject *object)
|
||||
|
@ -446,10 +447,15 @@ static void
|
|||
calls_ofono_provider_class_init (CallsOfonoProviderClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
CallsProviderClass *provider_class = CALLS_PROVIDER_CLASS (klass);
|
||||
|
||||
object_class->constructed = constructed;
|
||||
object_class->dispose = dispose;
|
||||
object_class->finalize = finalize;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
@ -460,19 +466,11 @@ calls_ofono_provider_class_finalize (CallsOfonoProviderClass *klass)
|
|||
|
||||
|
||||
static void
|
||||
calls_ofono_provider_message_source_interface_init (CallsProviderInterface *iface)
|
||||
calls_ofono_provider_message_source_interface_init (CallsMessageSourceInterface *iface)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
calls_ofono_provider_provider_interface_init (CallsProviderInterface *iface)
|
||||
{
|
||||
iface->get_name = get_name;
|
||||
iface->get_origins = get_origins;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
calls_ofono_provider_init (CallsOfonoProvider *self)
|
||||
{
|
||||
|
|
|
@ -28,11 +28,13 @@
|
|||
#include <glib-object.h>
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include "calls-provider.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define CALLS_TYPE_OFONO_PROVIDER (calls_ofono_provider_get_type ())
|
||||
|
||||
G_DECLARE_FINAL_TYPE (CallsOfonoProvider, calls_ofono_provider, CALLS, OFONO_PROVIDER, GObject);
|
||||
G_DECLARE_FINAL_TYPE (CallsOfonoProvider, calls_ofono_provider, CALLS, OFONO_PROVIDER, CallsProvider)
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Purism SPC
|
||||
* Copyright (C) 2018,2021 Purism SPC
|
||||
*
|
||||
* This file is part of Calls.
|
||||
*
|
||||
|
@ -35,7 +35,7 @@
|
|||
* oFono, Telepathy or some SIP library.
|
||||
* @Title: CallsProvider
|
||||
*
|
||||
* The #CallsProvider interface is the root of the interface tree that
|
||||
* The #CallsProvider abstract class is the root of the class tree that
|
||||
* needs to be implemented by a call provider. A #CallsProvider
|
||||
* provides access to a list of #CallsOrigin interfaces, through the
|
||||
* #calls_provider_get_origins function and the #origin-added and
|
||||
|
@ -43,7 +43,12 @@
|
|||
*/
|
||||
|
||||
|
||||
G_DEFINE_INTERFACE (CallsProvider, calls_provider, CALLS_TYPE_MESSAGE_SOURCE);
|
||||
typedef struct
|
||||
{
|
||||
int dummy;
|
||||
} CallsProviderPrivate;
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (CallsProvider, calls_provider, G_TYPE_OBJECT)
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
|
@ -61,39 +66,59 @@ enum {
|
|||
static guint signals [SIGNAL_LAST_SIGNAL];
|
||||
|
||||
static void
|
||||
calls_provider_default_init (CallsProviderInterface *iface)
|
||||
calls_provider_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GType arg_types = CALLS_TYPE_ORIGIN;
|
||||
CallsProvider *self = CALLS_PROVIDER (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_STATUS:
|
||||
g_value_set_string (value, calls_provider_get_status (self));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
calls_provider_class_init (CallsProviderClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->get_property = calls_provider_get_property;
|
||||
|
||||
props[PROP_STATUS] =
|
||||
g_param_spec_string ("status",
|
||||
"Status",
|
||||
"A text string describing the status for display to the user",
|
||||
"",
|
||||
G_PARAM_READABLE);
|
||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_interface_install_property (iface, props[PROP_STATUS]);
|
||||
g_object_class_install_properties (object_class, PROP_LAST_PROP, props);
|
||||
|
||||
signals[SIGNAL_ORIGIN_ADDED] =
|
||||
g_signal_newv ("origin-added",
|
||||
G_TYPE_FROM_INTERFACE (iface),
|
||||
g_signal_new ("origin-added",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
NULL, NULL, NULL, NULL,
|
||||
G_TYPE_NONE,
|
||||
1, &arg_types);
|
||||
0, NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1, CALLS_TYPE_ORIGIN);
|
||||
|
||||
signals[SIGNAL_ORIGIN_REMOVED] =
|
||||
g_signal_newv ("origin-removed",
|
||||
G_TYPE_FROM_INTERFACE (iface),
|
||||
g_signal_new ("origin-removed",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
NULL, NULL, NULL, NULL,
|
||||
G_TYPE_NONE,
|
||||
1, &arg_types);
|
||||
0, NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1, CALLS_TYPE_ORIGIN);
|
||||
}
|
||||
|
||||
#define DEFINE_PROVIDER_FUNC(function,rettype,errval) \
|
||||
CALLS_DEFINE_IFACE_FUNC(provider, Provider, PROVIDER, \
|
||||
function, rettype, errval)
|
||||
static void
|
||||
calls_provider_init (CallsProvider *self)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* calls_provider_get_name:
|
||||
|
@ -103,22 +128,21 @@ calls_provider_default_init (CallsProviderInterface *iface)
|
|||
*
|
||||
* Returns: A string containing the name.
|
||||
*/
|
||||
DEFINE_PROVIDER_FUNC(get_name, const gchar *, NULL);
|
||||
|
||||
gchar *
|
||||
calls_provider_get_status (CallsProvider *self)
|
||||
const char *
|
||||
calls_provider_get_name (CallsProvider *self)
|
||||
{
|
||||
gchar *status;
|
||||
|
||||
g_return_val_if_fail (CALLS_IS_PROVIDER (self), NULL);
|
||||
|
||||
g_object_get (G_OBJECT (self),
|
||||
"status", &status,
|
||||
NULL);
|
||||
|
||||
return status;
|
||||
return CALLS_PROVIDER_GET_CLASS (self)->get_name (self);
|
||||
}
|
||||
|
||||
const char *
|
||||
calls_provider_get_status (CallsProvider *self)
|
||||
{
|
||||
g_return_val_if_fail (CALLS_IS_PROVIDER (self), NULL);
|
||||
|
||||
return CALLS_PROVIDER_GET_CLASS (self)->get_status (self);
|
||||
}
|
||||
|
||||
/**
|
||||
* calls_provider_get_origins:
|
||||
|
@ -130,4 +154,10 @@ calls_provider_get_status (CallsProvider *self)
|
|||
* Returns: A newly-allocated GList of objects implementing
|
||||
* #CallsOrigin or NULL if there was an error.
|
||||
*/
|
||||
DEFINE_PROVIDER_FUNC(get_origins, GList *, NULL);
|
||||
GList *
|
||||
calls_provider_get_origins (CallsProvider *self)
|
||||
{
|
||||
g_return_val_if_fail (CALLS_IS_PROVIDER (self), NULL);
|
||||
|
||||
return CALLS_PROVIDER_GET_CLASS (self)->get_origins (self);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018 Purism SPC
|
||||
* Copyright (C) 2018,2021 Purism SPC
|
||||
*
|
||||
* This file is part of Calls.
|
||||
*
|
||||
|
@ -37,21 +37,22 @@ G_BEGIN_DECLS
|
|||
|
||||
#define CALLS_TYPE_PROVIDER (calls_provider_get_type ())
|
||||
|
||||
G_DECLARE_INTERFACE (CallsProvider, calls_provider, CALLS, PROVIDER, GObject);
|
||||
G_DECLARE_DERIVABLE_TYPE (CallsProvider, calls_provider, CALLS, PROVIDER, GObject)
|
||||
|
||||
|
||||
struct _CallsProviderInterface
|
||||
struct _CallsProviderClass
|
||||
{
|
||||
GTypeInterface parent_iface;
|
||||
GObjectClass parent_iface;
|
||||
|
||||
const gchar * (*get_name) (CallsProvider *self);
|
||||
GList * (*get_origins) (CallsProvider *self);
|
||||
const char *(*get_name) (CallsProvider *self);
|
||||
const char *(*get_status) (CallsProvider *self);
|
||||
GList *(*get_origins) (CallsProvider *self);
|
||||
};
|
||||
|
||||
|
||||
const gchar * calls_provider_get_name (CallsProvider *self);
|
||||
gchar * calls_provider_get_status (CallsProvider *self);
|
||||
GList * calls_provider_get_origins (CallsProvider *self);
|
||||
const char *calls_provider_get_name (CallsProvider *self);
|
||||
const char *calls_provider_get_status (CallsProvider *self);
|
||||
GList *calls_provider_get_origins (CallsProvider *self);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
|
Loading…
Reference in a new issue