[calls/notifer-unknown-caller] notifier: Explicitly handle unknown callers
- From: Evangelos Ribeiro Tzaras <devrtz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [calls/notifer-unknown-caller] notifier: Explicitly handle unknown callers
- Date: Fri, 16 Jul 2021 12:16:32 +0000 (UTC)
commit 3504287110bf96c3c280d2243758b40ecde07ac4
Author: Evangelos Ribeiro Tzaras <evangelos tzaras puri sm>
Date: Fri Jun 18 11:47:21 2021 +0200
notifier: Explicitly handle unknown callers
Closes #288
src/calls-notifier.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/calls-notifier.c b/src/calls-notifier.c
index 7551f3f3..89d98fcf 100644
--- a/src/calls-notifier.c
+++ b/src/calls-notifier.c
@@ -49,24 +49,31 @@ notify (CallsNotifier *self, CallsCall *call)
g_autofree gchar *ref = NULL;
g_autofree gchar *label_callback = NULL;
const char *name;
+ const char *number;
+ gboolean got_number;
contact = calls_call_get_contact (call);
// TODO: We need to update the notification when the contact name changes
name = calls_best_match_get_name (contact);
+ number = calls_call_get_number (call);
+
+ got_number = !!number && (g_strcmp0 (number, "") != 0);
if (calls_best_match_has_individual (contact))
msg = g_strdup_printf (_("Missed call from <b>%s</b>"), name);
+ else if (got_number)
+ msg = g_strdup_printf (_("Missed call from %s"), number);
else
- msg = g_strdup_printf (_("Missed call from %s"), calls_call_get_number (call));
+ msg = g_strdup (_("Missed call from unknown caller"));
g_notification_set_body (notification, msg);
- if (calls_call_get_number (call)) {
- label_callback = g_strdup_printf ("app.dial::%s", calls_call_get_number (call));
+ if (got_number) {
+ label_callback = g_strdup_printf ("app.dial::%s", number);
g_notification_add_button (notification, _("Call back"), label_callback);
}
- ref = g_strdup_printf ("missed-call-%s", calls_call_get_number (call) ?: "unknown");
+ ref = g_strdup_printf ("missed-call-%s", number ?: "unknown");
g_application_send_notification (app, ref, notification);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]