iface-modem-simple: use G_DECLARE|DEFINE_INTERFACE() macros

This commit is contained in:
Aleksander Morgado
2024-05-06 13:45:38 +00:00
parent cc2f1317b3
commit 0a91a6035b
3 changed files with 27 additions and 53 deletions
+2 -2
View File
@@ -66,7 +66,7 @@ static void iface_modem_3gpp_init (MMIfaceModem3gppInterface
static void iface_modem_3gpp_profile_manager_init (MMIfaceModem3gppProfileManagerInterface *iface);
static void iface_modem_3gpp_ussd_init (MMIfaceModem3gppUssdInterface *iface);
static void iface_modem_cdma_init (MMIfaceModemCdma *iface);
static void iface_modem_simple_init (MMIfaceModemSimple *iface);
static void iface_modem_simple_init (MMIfaceModemSimpleInterface *iface);
static void iface_modem_location_init (MMIfaceModemLocationInterface *iface);
static void iface_modem_messaging_init (MMIfaceModemMessagingInterface *iface);
static void iface_modem_voice_init (MMIfaceModemVoice *iface);
@@ -13665,7 +13665,7 @@ iface_modem_cdma_init (MMIfaceModemCdma *iface)
}
static void
iface_modem_simple_init (MMIfaceModemSimple *iface)
iface_modem_simple_init (MMIfaceModemSimpleInterface *iface)
{
}
+20 -41
View File
@@ -30,6 +30,8 @@
#include "mm-log-object.h"
#include "mm-log-helpers.h"
G_DEFINE_INTERFACE (MMIfaceModemSimple, mm_iface_modem_simple, MM_TYPE_IFACE_MODEM)
/*****************************************************************************/
/* Private data context */
@@ -1166,52 +1168,29 @@ mm_iface_modem_simple_shutdown (MMIfaceModemSimple *self)
/*****************************************************************************/
static void
iface_modem_simple_init (gpointer g_iface)
mm_iface_modem_simple_default_init (MMIfaceModemSimpleInterface *iface)
{
static gboolean initialized = FALSE;
static gsize initialized = 0;
if (initialized)
if (!g_once_init_enter (&initialized))
return;
/* Properties */
g_object_interface_install_property
(g_iface,
g_param_spec_object (MM_IFACE_MODEM_SIMPLE_DBUS_SKELETON,
"Simple DBus skeleton",
"DBus skeleton for the Simple interface",
MM_GDBUS_TYPE_MODEM_SIMPLE_SKELETON,
G_PARAM_READWRITE));
g_object_interface_install_property (
iface,
g_param_spec_object (MM_IFACE_MODEM_SIMPLE_DBUS_SKELETON,
"Simple DBus skeleton",
"DBus skeleton for the Simple interface",
MM_GDBUS_TYPE_MODEM_SIMPLE_SKELETON,
G_PARAM_READWRITE));
g_object_interface_install_property
(g_iface,
g_param_spec_object (MM_IFACE_MODEM_SIMPLE_STATUS,
"Simple status",
"Compilation of status values",
MM_TYPE_SIMPLE_STATUS,
G_PARAM_READWRITE));
g_object_interface_install_property (
iface,
g_param_spec_object (MM_IFACE_MODEM_SIMPLE_STATUS,
"Simple status",
"Compilation of status values",
MM_TYPE_SIMPLE_STATUS,
G_PARAM_READWRITE));
initialized = TRUE;
}
GType
mm_iface_modem_simple_get_type (void)
{
static GType iface_modem_simple_type = 0;
if (!G_UNLIKELY (iface_modem_simple_type)) {
static const GTypeInfo info = {
sizeof (MMIfaceModemSimple), /* class_size */
iface_modem_simple_init, /* base_init */
NULL, /* base_finalize */
};
iface_modem_simple_type = g_type_register_static (G_TYPE_INTERFACE,
"MMIfaceModemSimple",
&info,
0);
g_type_interface_add_prerequisite (iface_modem_simple_type, MM_TYPE_IFACE_MODEM);
}
return iface_modem_simple_type;
g_once_init_leave (&initialized, 1);
}
+5 -10
View File
@@ -19,23 +19,18 @@
#include <glib-object.h>
#include <gio/gio.h>
#define MM_TYPE_IFACE_MODEM_SIMPLE (mm_iface_modem_simple_get_type ())
#define MM_IFACE_MODEM_SIMPLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_IFACE_MODEM_SIMPLE, MMIfaceModemSimple))
#define MM_IS_IFACE_MODEM_SIMPLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_IFACE_MODEM_SIMPLE))
#define MM_IFACE_MODEM_SIMPLE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), MM_TYPE_IFACE_MODEM_SIMPLE, MMIfaceModemSimple))
#include "mm-iface-modem.h"
#define MM_TYPE_IFACE_MODEM_SIMPLE mm_iface_modem_simple_get_type ()
G_DECLARE_INTERFACE (MMIfaceModemSimple, mm_iface_modem_simple, MM, IFACE_MODEM_SIMPLE, MMIfaceModem)
#define MM_IFACE_MODEM_SIMPLE_DBUS_SKELETON "iface-modem-simple-dbus-skeleton"
#define MM_IFACE_MODEM_SIMPLE_STATUS "iface-modem-simple-status"
typedef struct _MMIfaceModemSimple MMIfaceModemSimple;
struct _MMIfaceModemSimple {
struct _MMIfaceModemSimpleInterface {
GTypeInterface g_iface;
};
GType mm_iface_modem_simple_get_type (void);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MMIfaceModemSimple, g_object_unref)
/* Initialize Modem Simple interface */
void mm_iface_modem_simple_initialize (MMIfaceModemSimple *self);