diff options
author | Dan Williams <dan@ioncontrol.co> | 2025-05-23 14:22:50 -0500 |
---|---|---|
committer | Dan Williams <dan@ioncontrol.co> | 2025-05-23 14:22:50 -0500 |
commit | 39f4cf77f25f345af4efd1e7ea31c1e02a67b433 (patch) | |
tree | 918e3fd0d66d0897e7c9e591887b29dc15eef04f /libmm-glib/mm-cbm.c | |
parent | 9cc5582bf28ba6cc30bc000f1f759fe530b6be55 (diff) | |
parent | 87aaebcec0443a4b93d12b0de6782d685f8f9fe5 (diff) |
Merge request !1361 from 'cbm-lang'
Parse CBM's language when available and export it on DBus
https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1361
Diffstat (limited to 'libmm-glib/mm-cbm.c')
-rw-r--r-- | libmm-glib/mm-cbm.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/libmm-glib/mm-cbm.c b/libmm-glib/mm-cbm.c index 5044408f..407b0792 100644 --- a/libmm-glib/mm-cbm.c +++ b/libmm-glib/mm-cbm.c @@ -215,6 +215,52 @@ mm_cbm_get_update (MMCbm *self) /*****************************************************************************/ +/** + * mm_cbm_get_language: + * @self: A #MMCbm. + * + * Gets the language the message is in as ISO639 two letter code + * + * <warning>The returned value is only valid until the property changes so it is + * only safe to use this function on the thread where @self was constructed. Use + * mm_cbm_dup_language() if on another thread.</warning> + * + * Returns: (transfer none): The message's language, or %NULL if unknown + * + * Since: 1.26 + */ +const gchar * +mm_cbm_get_language (MMCbm *self) +{ + g_return_val_if_fail (MM_IS_CBM (self), NULL); + + RETURN_NON_EMPTY_CONSTANT_STRING ( + mm_gdbus_cbm_get_language (MM_GDBUS_CBM (self))); +} + +/** + * mm_cbm_dup_language: + * @self: A #MMCbm. + * + * Gets the language the message is in as ISO639 two letter code + * + * Returns: (transfer full): The message lang, or %NULL if it doesn't contain + * any (e.g. contains data instead). The returned value should be freed with + * g_free(). + * + * Since: 1.26 + */ +gchar * +mm_cbm_dup_language (MMCbm *self) +{ + g_return_val_if_fail (MM_IS_CBM (self), NULL); + + RETURN_NON_EMPTY_STRING ( + mm_gdbus_cbm_dup_language (MM_GDBUS_CBM (self))); +} + +/*****************************************************************************/ + static void mm_cbm_init (MMCbm *self) { |