mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2024-12-14 00:17:35 +00:00
message-source: Add API to emit message
This commit is contained in:
parent
e148930cc4
commit
d1b20bec39
2 changed files with 25 additions and 1 deletions
|
@ -56,7 +56,8 @@ calls_message_source_default_init (CallsMessageSourceInterface *iface)
|
||||||
*
|
*
|
||||||
* This signal is emitted when an implementing-object needs to emit
|
* This signal is emitted when an implementing-object needs to emit
|
||||||
* a message to the user. The message should be suitable for
|
* 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] =
|
signals[SIGNAL_MESSAGE] =
|
||||||
g_signal_newv ("message",
|
g_signal_newv ("message",
|
||||||
|
@ -66,3 +67,23 @@ calls_message_source_default_init (CallsMessageSourceInterface *iface)
|
||||||
G_TYPE_NONE,
|
G_TYPE_NONE,
|
||||||
2, arg_types);
|
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);
|
||||||
|
}
|
||||||
|
|
|
@ -69,5 +69,8 @@ struct _CallsMessageSourceInterface
|
||||||
#define CALLS_ERROR(obj,error) \
|
#define CALLS_ERROR(obj,error) \
|
||||||
CALLS_EMIT_MESSAGE (obj, error->message, GTK_MESSAGE_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
|
G_END_DECLS
|
||||||
|
|
Loading…
Reference in a new issue