diff options
author | Guido Günther <agx@sigxcpu.org> | 2025-05-20 09:00:21 +0200 |
---|---|---|
committer | Dan Williams <dan@ioncontrol.co> | 2025-05-23 14:15:14 -0500 |
commit | 9625c81d39c27449e0b70426e7084a9d7450ef75 (patch) | |
tree | 5d2a871b6ef98a1a060e44efcfb2d3a69e5d0d58 | |
parent | 95d65ecd8dabcfb6c2432217c2393447b593a163 (diff) |
mm-glib/cbm: Allow to get language
Signed-off-by: Guido Günther <agx@sigxcpu.org>
-rw-r--r-- | libmm-glib/mm-cbm.c | 46 | ||||
-rw-r--r-- | libmm-glib/mm-cbm.h | 3 |
2 files changed, 49 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) { diff --git a/libmm-glib/mm-cbm.h b/libmm-glib/mm-cbm.h index eb6c2ecf..1731f531 100644 --- a/libmm-glib/mm-cbm.h +++ b/libmm-glib/mm-cbm.h @@ -75,6 +75,9 @@ guint mm_cbm_get_channel (MMCbm *self); guint mm_cbm_get_message_code (MMCbm *self); guint mm_cbm_get_update (MMCbm *self); +const gchar *mm_cbm_get_language (MMCbm *self); +gchar *mm_cbm_dup_language (MMCbm *self); + G_END_DECLS #endif /* _MM_CBM_H_ */ |