diff options
author | Aleksander Morgado <aleksandermj@chromium.org> | 2024-05-06 11:30:21 +0000 |
---|---|---|
committer | Aleksander Morgado <aleksandermj@chromium.org> | 2024-05-06 13:45:39 +0000 |
commit | 218d6d2c5879e97d5f564aff8fa2546212decdfa (patch) | |
tree | b5f1a32b09e8a858efc37799e9d79205ed10e904 | |
parent | 4afb6a3172ee78c64507932d63b4a081e4c2ad2d (diff) |
shared-simtech: use G_DECLARE|DEFINE_INTERFACE() macros
-rw-r--r-- | src/plugins/simtech/mm-broadband-modem-qmi-simtech.c | 4 | ||||
-rw-r--r-- | src/plugins/simtech/mm-broadband-modem-simtech.c | 4 | ||||
-rw-r--r-- | src/plugins/simtech/mm-shared-simtech.c | 31 | ||||
-rw-r--r-- | src/plugins/simtech/mm-shared-simtech.h | 12 |
4 files changed, 14 insertions, 37 deletions
diff --git a/src/plugins/simtech/mm-broadband-modem-qmi-simtech.c b/src/plugins/simtech/mm-broadband-modem-qmi-simtech.c index d670b26d..bc7d0f41 100644 --- a/src/plugins/simtech/mm-broadband-modem-qmi-simtech.c +++ b/src/plugins/simtech/mm-broadband-modem-qmi-simtech.c @@ -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; diff --git a/src/plugins/simtech/mm-broadband-modem-simtech.c b/src/plugins/simtech/mm-broadband-modem-simtech.c index 49ac86e3..cdc822d8 100644 --- a/src/plugins/simtech/mm-broadband-modem-simtech.c +++ b/src/plugins/simtech/mm-broadband-modem-simtech.c @@ -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; diff --git a/src/plugins/simtech/mm-shared-simtech.c b/src/plugins/simtech/mm-shared-simtech.c index 117ea65e..af89f4e0 100644 --- a/src/plugins/simtech/mm-shared-simtech.c +++ b/src/plugins/simtech/mm-shared-simtech.c @@ -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) -{ -} - -GType -mm_shared_simtech_get_type (void) +mm_shared_simtech_default_init (MMSharedSimtechInterface *iface) { - 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; } diff --git a/src/plugins/simtech/mm-shared-simtech.h b/src/plugins/simtech/mm-shared-simtech.h index 13e0eee6..81e735a4 100644 --- a/src/plugins/simtech/mm-shared-simtech.h +++ b/src/plugins/simtech/mm-shared-simtech.h @@ -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 */ |