1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-11-15 12:55:36 +00:00

mm-call: Sanitise disconnect messages

Clean up the disconnect messages so they make sense when presented to
the user.  Also add new state change reasons from ModemManager 1.10
and 1.12.

Fixes #90
This commit is contained in:
Bob Ham 2020-01-21 13:25:47 +00:00
parent 7d02dcbb66
commit dc9b7102de
3 changed files with 23 additions and 18 deletions

2
debian/control vendored
View file

@ -7,7 +7,7 @@ Build-Depends:
libhandy-0.0-dev (>= 0.0.10),
libgtk-3-dev,
modemmanager-dev,
libmm-glib-dev,
libmm-glib-dev (>= 1.12.0),
libgsound-dev,
libpeas-dev,
libgom-1.0-dev,

View file

@ -119,13 +119,16 @@ static const struct CallsMMCallStateReasonMap STATE_REASON_MAP[] = {
#define row(ENUMVALUE,DESCRIPTION) \
{ MM_CALL_STATE_REASON_##ENUMVALUE, DESCRIPTION } \
row (UNKNOWN, "Outgoing call created"),
row (OUTGOING_STARTED, "Outgoing call started"),
row (INCOMING_NEW, "Incoming call"),
row (ACCEPTED, "Call accepted"),
row (TERMINATED, "Call terminated"),
row (REFUSED_OR_BUSY, "Busy or call refused"),
row (ERROR, "Wrong number or network problem"),
row (UNKNOWN, N_("Call disconnected (unknown reason)")),
row (OUTGOING_STARTED, N_("Outgoing call started")),
row (INCOMING_NEW, N_("New incoming call")),
row (ACCEPTED, N_("Call accepted")),
row (TERMINATED, N_("Call ended")),
row (REFUSED_OR_BUSY, N_("Call disconnected (busy or call refused)")),
row (ERROR, N_("Call disconnected (wrong number or network problem)")),
row (AUDIO_SETUP_FAILED, N_("Call disconnected (error setting up audio channel)")),
row (TRANSFERRED, N_("Call transferred")),
row (DEFLECTED, N_("Call deflected")),
#undef row
@ -137,25 +140,27 @@ set_disconnect_reason (CallsMMCall *self,
MMCallStateReason reason)
{
const struct CallsMMCallStateReasonMap *map_row;
GString *reason_str;
if (self->disconnect_reason)
{
g_free (self->disconnect_reason);
}
for (map_row = STATE_REASON_MAP; map_row->desc; ++map_row)
{
if (map_row->value == reason)
{
self->disconnect_reason = g_strdup(map_row->desc);
self->disconnect_reason =
g_strdup (gettext (map_row->desc));
return;
}
}
reason_str = g_string_new ("Unknown disconnect reason ");
g_string_append_printf (reason_str, "(%i)", (int)reason);
self->disconnect_reason =
g_strdup_printf (_("Call disconnected (unknown reason code %i)"),
(int)reason);
g_warning ("%s", reason_str->str);
CALLS_SET_PTR_PROPERTY (self->disconnect_reason,
reason_str->str);
g_string_free (reason_str, FALSE);
g_warning ("%s", self->disconnect_reason);
}

View file

@ -34,7 +34,7 @@ mm_deps = [
dependency('gobject-2.0'),
dependency('gtk+-3.0'),
dependency('ModemManager'),
dependency('mm-glib'),
dependency('mm-glib', version: '>= 1.12.0'),
dependency('libpeas-1.0'),
]