static void ensure_internal_timezone (MMModemTime *self, MMNetworkTimezone **dup) { g_mutex_lock (&self->priv->timezone_mutex); { /* If this is the first time ever asking for the object, setup the * update listener and the initial object, if any. */ if (!self->priv->timezone_id) { GVariant *dictionary; dictionary = mm_gdbus_modem_time_dup_network_timezone (MM_GDBUS_MODEM_TIME (self)); if (dictionary) { self->priv->timezone = mm_network_timezone_new_from_dictionary (dictionary, NULL); g_variant_unref (dictionary); } /* No need to clear this signal connection when freeing self */ self->priv->timezone_id = g_signal_connect (self, "notify::network-timezone", G_CALLBACK (timezone_updated), NULL); } if (dup && self->priv->timezone) *dup = g_object_ref (self->priv->timezone); } g_mutex_unlock (&self->priv->timezone_mutex); }
MMNetworkTimezone * mm_modem_time_get_network_timezone (MMModemTime *self) { GVariant *dictionary; MMNetworkTimezone *tz; g_return_val_if_fail (MM_GDBUS_IS_MODEM_TIME (self), NULL); dictionary = mm_gdbus_modem_time_dup_network_timezone (self); tz = mm_network_timezone_new_from_dictionary (dictionary, NULL); g_variant_unref (dictionary); return tz; }