1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-06-13 23:39:32 +00:00

Merge branch 'answering-calls-fixes' into 'master'

Answering calls fixes

See merge request Librem5/calls!24
This commit is contained in:
Bob Ham 2018-09-27 08:53:45 +00:00
commit 830475c0bc
3 changed files with 46 additions and 22 deletions

View file

@ -177,6 +177,7 @@ call_state_changed_cb (CallsCallDisplay *self,
calls_call_state_to_string (state_str, state);
gtk_label_set_text (self->status, state_str->str);
g_debug ("Call state changed to `%s'", state_str->str);
g_string_free (state_str, TRUE);
switch (state)

View file

@ -151,22 +151,23 @@ set_disconnect_reason (CallsMMCall *self,
struct CallsMMCallStateMap
{
MMCallState mm;
CallsCallState calls;
MMCallState mm;
CallsCallState calls;
const gchar *name;
};
static const struct CallsMMCallStateMap STATE_MAP[] = {
#define row(MMENUM,CALLSENUM) \
{ MM_CALL_STATE_##MMENUM, CALLS_CALL_STATE_##CALLSENUM } \
#define row(MMENUM,CALLSENUM) \
{ MM_CALL_STATE_##MMENUM, CALLS_CALL_STATE_##CALLSENUM, #MMENUM } \
row (DIALING, DIALING),
row (RINGING_OUT, INCOMING),
row (RINGING_IN, ALERTING),
row (ACTIVE, ACTIVE),
row (HELD, HELD),
row (WAITING, INCOMING),
row (TERMINATED, DISCONNECTED),
row (DIALING, DIALING),
row (RINGING_OUT, ALERTING),
row (RINGING_IN, INCOMING),
row (ACTIVE, ACTIVE),
row (HELD, HELD),
row (WAITING, INCOMING),
row (TERMINATED, DISCONNECTED),
#undef row
@ -191,6 +192,8 @@ state_changed_cb (CallsMMCall *self,
{
if (map_row->mm == mm_new)
{
g_debug ("MM call state changed to `%s'",
map_row->name);
change_state (self, map_row->calls);
return;
}
@ -296,6 +299,7 @@ constructed (GObject *object)
GObjectClass *parent_class = g_type_class_peek (G_TYPE_OBJECT);
CallsMMCall *self = CALLS_MM_CALL (object);
MmGdbusCall *gdbus_call = MM_GDBUS_CALL (self->mm_call);
MMCallState state;
g_signal_connect_swapped (gdbus_call, "notify::number",
G_CALLBACK (notify_number_cb), self);
@ -304,8 +308,14 @@ constructed (GObject *object)
notify_number_cb (self, mm_call_get_number (self->mm_call));
state = mm_call_get_state (self->mm_call);
state_changed_cb (self,
MM_MODEM_STATE_UNKNOWN,
state,
mm_call_get_state_reason (self->mm_call));
/* Start outgoing call */
if (mm_call_get_state (self->mm_call) == MM_CALL_STATE_UNKNOWN
if (state == MM_CALL_STATE_UNKNOWN
&& mm_call_get_direction (self->mm_call) == MM_CALL_DIRECTION_OUTGOING)
{
start_call (CALLS_CALL (self));

View file

@ -182,19 +182,13 @@ delete_call_cb (MMModemVoice *voice,
static void
call_state_changed_cb (CallsMMOrigin *self,
CallsCallState state,
CallsCall *call)
delete_call (CallsMMOrigin *self,
CallsMMCall *call)
{
const gchar *path;
struct CallsMMOriginDeleteCallData *data;
if (state != CALLS_CALL_STATE_DISCONNECTED)
{
return;
}
path = calls_mm_call_get_object_path (CALLS_MM_CALL (call));
path = calls_mm_call_get_object_path (call);
data = g_new0 (struct CallsMMOriginDeleteCallData, 1);
data->self = self;
@ -204,10 +198,23 @@ call_state_changed_cb (CallsMMOrigin *self,
(self->voice,
path,
NULL,
(GAsyncReadyCallback) delete_call_cb,
(GAsyncReadyCallback)delete_call_cb,
data);
}
static void
call_state_changed_cb (CallsMMOrigin *self,
CallsCallState state,
CallsCall *call)
{
if (state != CALLS_CALL_STATE_DISCONNECTED)
{
return;
}
delete_call (self, CALLS_MM_CALL (call));
}
static void
add_call (CallsMMOrigin *self,
@ -228,6 +235,12 @@ add_call (CallsMMOrigin *self,
g_signal_emit_by_name (CALLS_ORIGIN(self), "call-added",
CALLS_CALL(call));
if (mm_call_get_state (mm_call) == MM_CALL_STATE_TERMINATED)
{
// Delete any remnant disconnected call
delete_call (self, call);
}
g_debug ("Call `%s' added", path);
}