[calls] notifier: Switch to CallsUiCallData
- From: Evangelos Ribeiro Tzaras <devrtz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [calls] notifier: Switch to CallsUiCallData
- Date: Tue, 1 Feb 2022 05:50:58 +0000 (UTC)
commit 3fa290f5a708b377113680224ebe4610ce286c99
Author: Evangelos Ribeiro Tzaras <devrtz fortysixandtwo eu>
Date: Tue Feb 1 06:10:38 2022 +0100
notifier: Switch to CallsUiCallData
src/calls-notifier.c | 41 +++++++++++++++++++++--------------------
1 file changed, 21 insertions(+), 20 deletions(-)
---
diff --git a/src/calls-notifier.c b/src/calls-notifier.c
index 1aaa579f..6d4ee7e2 100644
--- a/src/calls-notifier.c
+++ b/src/calls-notifier.c
@@ -28,6 +28,9 @@
#include "calls-manager.h"
#include "calls-notifier.h"
+#include "calls-ui-call-data.h"
+
+#include <cui-call.h>
#include <glib/gi18n.h>
#include <glib-object.h>
@@ -42,32 +45,32 @@ struct _CallsNotifier
G_DEFINE_TYPE (CallsNotifier, calls_notifier, G_TYPE_OBJECT);
static void
-notify (CallsNotifier *self, CallsCall *call)
+notify (CallsNotifier *self, CuiCall *call)
{
GApplication *app = g_application_get_default ();
g_autoptr (GNotification) notification = g_notification_new (_("Missed call"));
- g_autoptr (CallsBestMatch) contact = NULL;
g_autofree gchar *msg = NULL;
g_autofree gchar *ref = NULL;
g_autofree gchar *label_callback = NULL;
const char *name;
const char *id;
gboolean got_id;
+ gboolean got_contact;
#if GLIB_CHECK_VERSION(2,70,0)
g_notification_set_category (notification, "x-gnome.call.unanswered");
#endif
- contact = calls_call_get_contact (call);
/* TODO: We need to update the notification when the contact name changes
We would need to resend the notification in this case, as changing the properties
after having called g_application_send_notification() will have no effect.
*/
- name = calls_best_match_get_name (contact);
- id = calls_call_get_id (call);
+ name = cui_call_get_display_name (call);
+ id = cui_call_get_id (call);
got_id = !!id && (g_strcmp0 (id, "") != 0);
+ got_contact = got_id && (g_strcmp0 (id, name) != 0);
- if (calls_best_match_has_individual (contact))
+ if (got_contact)
/* %s is a name here */
msg = g_strdup_printf (_("Missed call from <b>%s</b>"), name);
else if (got_id)
@@ -89,28 +92,26 @@ notify (CallsNotifier *self, CallsCall *call)
static void
-state_changed_cb (CallsNotifier *self,
- CallsCallState new_state,
- CallsCallState old_state,
- CallsCall *call)
+state_changed_cb (CallsNotifier *self,
+ CuiCallState new_state,
+ CuiCallState old_state,
+ CuiCall *call)
{
guint n;
g_return_if_fail (CALLS_IS_NOTIFIER (self));
- g_return_if_fail (CALLS_IS_CALL (call));
+ g_return_if_fail (CUI_IS_CALL (call));
g_return_if_fail (old_state != new_state);
- if (old_state == CALLS_CALL_STATE_INCOMING &&
- new_state == CALLS_CALL_STATE_DISCONNECTED)
- {
- notify (self, call);
- }
+ if (old_state == CUI_CALL_STATE_INCOMING &&
+ new_state == CUI_CALL_STATE_DISCONNECTED)
+ notify (self, call);
/* Can use g_list_store_find with newer glib */
n = g_list_model_get_n_items (G_LIST_MODEL (self->unanswered));
for (int i = 0; i < n; i++)
{
- g_autoptr (CallsCall) item = g_list_model_get_item (G_LIST_MODEL (self->unanswered), i);
+ g_autoptr (CuiCall) item = g_list_model_get_item (G_LIST_MODEL (self->unanswered), i);
if (item == call)
{
g_list_store_remove (self->unanswered, i);
@@ -120,7 +121,7 @@ state_changed_cb (CallsNotifier *self,
}
static void
-call_added_cb (CallsNotifier *self, CallsCall *call)
+call_added_cb (CallsNotifier *self, CuiCall *call)
{
g_list_store_append(self->unanswered, call);
@@ -134,7 +135,7 @@ call_added_cb (CallsNotifier *self, CallsCall *call)
static void
calls_notifier_init (CallsNotifier *self)
{
- self->unanswered = g_list_store_new (CALLS_TYPE_CALL);
+ self->unanswered = g_list_store_new (CUI_TYPE_CALL);
}
@@ -146,7 +147,7 @@ calls_notifier_constructed (GObject *object)
CallsNotifier *self = CALLS_NOTIFIER (object);
g_signal_connect_swapped (calls_manager_get_default (),
- "call-add",
+ "ui-call-added",
G_CALLBACK (call_added_cb),
self);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]