diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2014-02-26 12:59:05 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2014-02-28 16:35:18 +0100 |
commit | 73dad3d899316352ab4f058f526069a8724b2b13 (patch) | |
tree | 478a37dbc98eafb492f5a68a9b19ebd4159fed52 /src/mm-iface-modem.c | |
parent | 82340cd5f7e1c464eda820632b07cf55e78cc90f (diff) |
iface-modem: allow requesting the refresh of the access tech
For periodic updates, we may want to request an explicit re-check at some point,
instead of waiting for the next scheduled update.
Diffstat (limited to 'src/mm-iface-modem.c')
-rw-r--r-- | src/mm-iface-modem.c | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c index 9228bebf..c0241977 100644 --- a/src/mm-iface-modem.c +++ b/src/mm-iface-modem.c @@ -964,6 +964,30 @@ periodic_access_technologies_check (MMIfaceModem *self) return TRUE; } +void +mm_iface_modem_refresh_access_technologies (MMIfaceModem *self) +{ + AccessTechnologiesCheckContext *ctx; + + if (G_UNLIKELY (!access_technologies_check_context_quark)) + access_technologies_check_context_quark = (g_quark_from_static_string ( + ACCESS_TECHNOLOGIES_CHECK_CONTEXT_TAG)); + + ctx = g_object_get_qdata (G_OBJECT (self), access_technologies_check_context_quark); + if (!ctx) + return; + + /* Re-set timeout */ + if (ctx->timeout_source) + g_source_remove (ctx->timeout_source); + ctx->timeout_source = g_timeout_add_seconds (ACCESS_TECHNOLOGIES_CHECK_TIMEOUT_SEC, + (GSourceFunc)periodic_access_technologies_check, + self); + + /* Get first access technology value */ + periodic_access_technologies_check (self); +} + static void periodic_access_technologies_check_disable (MMIfaceModem *self) { @@ -1011,16 +1035,13 @@ periodic_access_technologies_check_enable (MMIfaceModem *self) /* Create context and keep it as object data */ mm_dbg ("Periodic access technology checks enabled"); ctx = g_new0 (AccessTechnologiesCheckContext, 1); - ctx->timeout_source = g_timeout_add_seconds (ACCESS_TECHNOLOGIES_CHECK_TIMEOUT_SEC, - (GSourceFunc)periodic_access_technologies_check, - self); g_object_set_qdata_full (G_OBJECT (self), access_technologies_check_context_quark, ctx, (GDestroyNotify)access_technologies_check_context_free); - /* Get first access technology value */ - periodic_access_technologies_check (self); + /* Get first and setup timeout */ + mm_iface_modem_refresh_access_technologies (self); } /*****************************************************************************/ |