aboutsummaryrefslogtreecommitdiff
path: root/plugins/mm-modem-icera.c
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2011-04-18 22:08:19 -0500
committerDan Williams <dcbw@redhat.com>2011-04-18 22:08:19 -0500
commit8333fb657ab6e30e51aec8f4449dc4c505fea6f4 (patch)
tree2aca93c0b471dfb61cd9ae2c001873beed9fede3 /plugins/mm-modem-icera.c
parent74b1503c602e1268b5199ef36c9611d7cb08adc1 (diff)
icera: fix abuse of GInterface
The GInterface structure for MMModemIcera isn't instance data, thus we shouldn't be storing an instance pointer in it. Instead, make implemtors store the intstance data in their private structure, and have them implement an accessor for the Icera-private data. This makes everone (especially GObject) happy. It's a bit of additional indirection, but we still get to use the MM_MODEM_ICERA_GET_PRIVATE() and we still get to cast the passed-in GInterface MMModemIcera into the various GSM MMModem subclasses, which is all we ever wanted anyway.
Diffstat (limited to 'plugins/mm-modem-icera.c')
-rw-r--r--plugins/mm-modem-icera.c44
1 files changed, 24 insertions, 20 deletions
diff --git a/plugins/mm-modem-icera.c b/plugins/mm-modem-icera.c
index 22c25b94..11f95b54 100644
--- a/plugins/mm-modem-icera.c
+++ b/plugins/mm-modem-icera.c
@@ -45,7 +45,7 @@ struct _MMModemIceraPrivate {
MMModemGsmAccessTech last_act;
};
-#define MM_MODEM_ICERA_GET_PRIVATE(m) (MM_MODEM_ICERA_GET_INTERFACE(m)->priv)
+#define MM_MODEM_ICERA_GET_PRIVATE(m) (MM_MODEM_ICERA_GET_INTERFACE (m)->get_private(m))
static void
get_allowed_mode_done (MMAtSerialPort *port,
@@ -447,10 +447,10 @@ icera_connect_timed_out (gpointer data)
}
static void
-icera_enabled (MMAtSerialPort *port,
- GString *response,
- GError *error,
- gpointer user_data)
+icera_connected (MMAtSerialPort *port,
+ GString *response,
+ GError *error,
+ gpointer user_data)
{
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
@@ -478,7 +478,7 @@ old_context_clear_done (MMAtSerialPort *port,
MMCallbackInfo *info = (MMCallbackInfo *) user_data;
/* Activate the PDP context and start the data session */
- icera_call_control (MM_MODEM_ICERA (info->modem), TRUE, icera_enabled, info);
+ icera_call_control (MM_MODEM_ICERA (info->modem), TRUE, icera_connected, info);
}
static void
@@ -731,14 +731,6 @@ mm_modem_icera_is_icera (MMModemIcera *self,
mm_at_serial_port_queue_command (port, "%IPSYS?", 5, is_icera_done, info);
}
-/****************************************************************/
-
-void
-mm_modem_icera_prepare (MMModemIcera *self)
-{
- self->priv = g_malloc0 (sizeof (MMModemIceraPrivate));
-}
-
void
mm_modem_icera_cleanup (MMModemIcera *self)
{
@@ -748,20 +740,32 @@ mm_modem_icera_cleanup (MMModemIcera *self)
connect_pending_done (self);
g_free (priv->username);
+ priv->username = NULL;
g_free (priv->password);
+ priv->password = NULL;
+}
- memset (priv, 0, sizeof (MMModemIceraPrivate));
+/****************************************************************/
+
+MMModemIceraPrivate *
+mm_modem_icera_init_private (void)
+{
+ return g_malloc0 (sizeof (MMModemIceraPrivate));
+}
+
+void
+mm_modem_icera_dispose_private (MMModemIcera *self)
+{
+ MMModemIceraPrivate *priv = MM_MODEM_ICERA_GET_PRIVATE (self);
+
+ mm_modem_icera_cleanup (self);
+ memset (priv, 0, sizeof (*priv));
g_free (priv);
}
static void
mm_modem_icera_init (gpointer g_iface)
{
- static gboolean initialized = FALSE;
-
- if (!initialized) {
- initialized = TRUE;
- }
}
GType