[calls] message-source: Add API to emit message
- From: Evangelos Ribeiro Tzaras <devrtz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [calls] message-source: Add API to emit message
- Date: Tue, 11 Jan 2022 12:27:24 +0000 (UTC)
commit d1b20bec39dbd0df9dc4dc95d0c1d6ce20752226
Author: Evangelos Ribeiro Tzaras <devrtz fortysixandtwo eu>
Date: Mon Dec 27 20:03:36 2021 +0100
message-source: Add API to emit message
src/calls-message-source.c | 23 ++++++++++++++++++++++-
src/calls-message-source.h | 3 +++
2 files changed, 25 insertions(+), 1 deletion(-)
---
diff --git a/src/calls-message-source.c b/src/calls-message-source.c
index 05f5efcf..875dfd06 100644
--- a/src/calls-message-source.c
+++ b/src/calls-message-source.c
@@ -56,7 +56,8 @@ calls_message_source_default_init (CallsMessageSourceInterface *iface)
*
* This signal is emitted when an implementing-object needs to emit
* a message to the user. The message should be suitable for
- * presentation to the user as-is.
+ * presentation to the user as-is. This means it should be translated
+ * to the users locale.
*/
signals[SIGNAL_MESSAGE] =
g_signal_newv ("message",
@@ -66,3 +67,23 @@ calls_message_source_default_init (CallsMessageSourceInterface *iface)
G_TYPE_NONE,
2, arg_types);
}
+
+/**
+ * calls_message_source_emit_message:
+ * @self: A #CallsMessageSource
+ * @message: The message to emit
+ * @message_type: The type of the message: Error, warning, etc
+ *
+ * Emits a message which should be shown to the user in the user interface.
+ * Messages should be translated into the users locale
+ */
+void
+calls_message_source_emit_message (CallsMessageSource *self,
+ const char *message,
+ GtkMessageType message_type)
+{
+ g_return_if_fail (CALLS_IS_MESSAGE_SOURCE (self));
+ g_return_if_fail (message || *message);
+
+ g_signal_emit (self, signals[SIGNAL_MESSAGE], 0, message, message_type);
+}
diff --git a/src/calls-message-source.h b/src/calls-message-source.h
index 3b08608b..50454bd9 100644
--- a/src/calls-message-source.h
+++ b/src/calls-message-source.h
@@ -69,5 +69,8 @@ struct _CallsMessageSourceInterface
#define CALLS_ERROR(obj,error) \
CALLS_EMIT_MESSAGE (obj, error->message, GTK_MESSAGE_ERROR)
+void calls_message_source_emit_message (CallsMessageSource *self,
+ const char *message,
+ GtkMessageType message_type);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]