shared-simtech: use G_DECLARE|DEFINE_INTERFACE() macros

This commit is contained in:
Aleksander Morgado
2024-05-06 13:45:39 +00:00
parent 4afb6a3172
commit 218d6d2c58
4 changed files with 14 additions and 37 deletions
@@ -30,7 +30,7 @@
static void iface_modem_location_init (MMIfaceModemLocationInterface *iface);
static void iface_modem_voice_init (MMIfaceModemVoiceInterface *iface);
static void shared_simtech_init (MMSharedSimtech *iface);
static void shared_simtech_init (MMSharedSimtechInterface *iface);
static MMIfaceModemLocationInterface *iface_modem_location_parent;
static MMIfaceModemVoiceInterface *iface_modem_voice_parent;
@@ -117,7 +117,7 @@ peek_parent_voice_interface (MMSharedSimtech *self)
}
static void
shared_simtech_init (MMSharedSimtech *iface)
shared_simtech_init (MMSharedSimtechInterface *iface)
{
iface->peek_parent_location_interface = peek_parent_location_interface;
iface->peek_parent_voice_interface = peek_parent_voice_interface;
@@ -41,7 +41,7 @@ static void iface_modem_init (MMIfaceModemInterface *iface);
static void iface_modem_3gpp_init (MMIfaceModem3gppInterface *iface);
static void iface_modem_location_init (MMIfaceModemLocationInterface *iface);
static void iface_modem_voice_init (MMIfaceModemVoiceInterface *iface);
static void shared_simtech_init (MMSharedSimtech *iface);
static void shared_simtech_init (MMSharedSimtechInterface *iface);
static MMIfaceModemInterface *iface_modem_parent;
static MMIfaceModem3gppInterface *iface_modem_3gpp_parent;
@@ -1523,7 +1523,7 @@ peek_parent_voice_interface (MMSharedSimtech *self)
}
static void
shared_simtech_init (MMSharedSimtech *iface)
shared_simtech_init (MMSharedSimtechInterface *iface)
{
iface->peek_parent_location_interface = peek_parent_location_interface;
iface->peek_parent_voice_interface = peek_parent_voice_interface;
+7 -24
View File
@@ -30,6 +30,8 @@
#include "mm-shared-simtech.h"
#include "mm-modem-helpers-simtech.h"
G_DEFINE_INTERFACE (MMSharedSimtech, mm_shared_simtech, MM_TYPE_IFACE_MODEM)
/*****************************************************************************/
/* Private data context */
@@ -94,11 +96,11 @@ get_private (MMSharedSimtech *self)
/* Setup parent class' MMIfaceModemLocation and MMIfaceModemVoice */
g_assert (MM_SHARED_SIMTECH_GET_INTERFACE (self)->peek_parent_location_interface);
priv->iface_modem_location_parent = MM_SHARED_SIMTECH_GET_INTERFACE (self)->peek_parent_location_interface (self);
g_assert (MM_SHARED_SIMTECH_GET_IFACE (self)->peek_parent_location_interface);
priv->iface_modem_location_parent = MM_SHARED_SIMTECH_GET_IFACE (self)->peek_parent_location_interface (self);
g_assert (MM_SHARED_SIMTECH_GET_INTERFACE (self)->peek_parent_voice_interface);
priv->iface_modem_voice_parent = MM_SHARED_SIMTECH_GET_INTERFACE (self)->peek_parent_voice_interface (self);
g_assert (MM_SHARED_SIMTECH_GET_IFACE (self)->peek_parent_voice_interface);
priv->iface_modem_voice_parent = MM_SHARED_SIMTECH_GET_IFACE (self)->peek_parent_voice_interface (self);
g_object_set_qdata_full (G_OBJECT (self), private_quark, priv, (GDestroyNotify)private_free);
}
@@ -1237,25 +1239,6 @@ mm_shared_simtech_voice_check_support (MMIfaceModemVoice *self,
/*****************************************************************************/
static void
shared_simtech_init (gpointer g_iface)
mm_shared_simtech_default_init (MMSharedSimtechInterface *iface)
{
}
GType
mm_shared_simtech_get_type (void)
{
static GType shared_simtech_type = 0;
if (!G_UNLIKELY (shared_simtech_type)) {
static const GTypeInfo info = {
sizeof (MMSharedSimtech), /* class_size */
shared_simtech_init, /* base_init */
NULL, /* base_finalize */
};
shared_simtech_type = g_type_register_static (G_TYPE_INTERFACE, "MMSharedSimtech", &info, 0);
g_type_interface_add_prerequisite (shared_simtech_type, MM_TYPE_IFACE_MODEM_LOCATION);
}
return shared_simtech_type;
}
+3 -9
View File
@@ -27,14 +27,10 @@
#include "mm-iface-modem-location.h"
#include "mm-iface-modem-voice.h"
#define MM_TYPE_SHARED_SIMTECH (mm_shared_simtech_get_type ())
#define MM_SHARED_SIMTECH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_SHARED_SIMTECH, MMSharedSimtech))
#define MM_IS_SHARED_SIMTECH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_SHARED_SIMTECH))
#define MM_SHARED_SIMTECH_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), MM_TYPE_SHARED_SIMTECH, MMSharedSimtech))
#define MM_TYPE_SHARED_SIMTECH mm_shared_simtech_get_type ()
G_DECLARE_INTERFACE (MMSharedSimtech, mm_shared_simtech, MM, SHARED_SIMTECH, MMIfaceModem)
typedef struct _MMSharedSimtech MMSharedSimtech;
struct _MMSharedSimtech {
struct _MMSharedSimtechInterface {
GTypeInterface g_iface;
/* Peek location interface of the parent class of the object */
@@ -44,8 +40,6 @@ struct _MMSharedSimtech {
MMIfaceModemVoiceInterface * (* peek_parent_voice_interface) (MMSharedSimtech *self);
};
GType mm_shared_simtech_get_type (void);
/*****************************************************************************/
/* Location interface */