1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-09-28 14:55:26 +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); calls_call_state_to_string (state_str, state);
gtk_label_set_text (self->status, state_str->str); 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); g_string_free (state_str, TRUE);
switch (state) switch (state)

View file

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

View file

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