[calls] manager: Propagate messages from account
- From: Evangelos Ribeiro Tzaras <devrtz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [calls] manager: Propagate messages from account
- Date: Tue, 11 Jan 2022 12:27:24 +0000 (UTC)
commit 339093876c712cd6cf890fdab063943807b848c9
Author: Evangelos Ribeiro Tzaras <devrtz fortysixandtwo eu>
Date: Tue Dec 28 15:32:22 2021 +0100
manager: Propagate messages from account
Not all portions from the user interface are listening directly to messages from
accounts, so the manager should propagate them to allow the UI to pick them up.
Closes #340
src/calls-manager.c | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
---
diff --git a/src/calls-manager.c b/src/calls-manager.c
index 2a029da3..7d5e4b3d 100644
--- a/src/calls-manager.c
+++ b/src/calls-manager.c
@@ -27,6 +27,7 @@
#include "config.h"
+#include "calls-account.h"
#include "calls-application.h"
#include "calls-contacts-provider.h"
#include "calls-manager.h"
@@ -199,6 +200,36 @@ update_protocols (CallsManager *self)
update_state (self);
}
+/* propagate any message from origins, providers, calls, etc */
+static void
+on_message (CallsMessageSource *source,
+ const char *message,
+ GtkMessageType message_type,
+ CallsManager *self)
+{
+ g_autofree char *notification = NULL;
+
+ g_assert (CALLS_IS_MESSAGE_SOURCE (source));
+ g_assert (CALLS_IS_MANAGER (self));
+
+ /* Prefix the message with the name of the source, if known */
+ if (CALLS_IS_ACCOUNT (source)) {
+ notification = g_strdup_printf ("%s: %s",
+ calls_account_get_address (CALLS_ACCOUNT (source)),
+ message);
+ }
+
+ if (notification) {
+ calls_message_source_emit_message (CALLS_MESSAGE_SOURCE (self),
+ notification,
+ message_type);
+ } else {
+ calls_message_source_emit_message (CALLS_MESSAGE_SOURCE (self),
+ message,
+ message_type);
+ }
+}
+
static void
add_call (CallsManager *self, CallsCall *call, CallsOrigin *origin)
@@ -288,6 +319,11 @@ add_origin (CallsManager *self, CallsOrigin *origin)
g_list_store_append (self->origins, origin);
+ g_signal_connect (origin,
+ "message",
+ G_CALLBACK (on_message),
+ self);
+
g_signal_connect_object (origin,
"notify::country-code",
G_CALLBACK (update_country_code_cb),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]