1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-06-25 05:09:30 +00:00

src: Add old state as argument to CallsCall's state-changed signal

This commit is contained in:
Bob Ham 2018-11-09 12:38:04 +00:00
parent 74c3987ce1
commit 027c49e8bd
6 changed files with 47 additions and 12 deletions

View file

@ -102,12 +102,17 @@ static guint signals [SIGNAL_LAST_SIGNAL];
static void
calls_call_default_init (CallsCallInterface *iface)
{
GType arg_types = CALLS_TYPE_CALL_STATE;
GType arg_types[2] =
{
CALLS_TYPE_CALL_STATE,
CALLS_TYPE_CALL_STATE
};
/**
* CallsCall::state-changed:
* @self: The #CallsCall instance.
* @state: The new state of the call.
* @new_state: The new state of the call.
* @old_state: The old state of the call.
*
* This signal is emitted when the state of the call changes, for
* example when it's answered or when the call is disconnected.
@ -118,7 +123,7 @@ calls_call_default_init (CallsCallInterface *iface)
G_SIGNAL_RUN_LAST,
NULL, NULL, NULL, NULL,
G_TYPE_NONE,
1, &arg_types);
2, arg_types);
}

View file

@ -85,8 +85,18 @@ change_state (CallsCall *call,
CallsDummyCall *self,
CallsCallState state)
{
CallsCallState old_state = self->state;
if (old_state == state)
{
return;
}
self->state = state;
g_signal_emit_by_name (call, "state-changed", state);
g_signal_emit_by_name (call,
"state-changed",
state,
old_state);
}
static void

View file

@ -110,10 +110,11 @@ remove_calls (CallsDummyOrigin *self, const gchar *reason)
static void
call_state_changed_cb (CallsDummyOrigin *self,
CallsCallState state,
CallsCallState new_state,
CallsCallState old_state,
CallsCall *call)
{
if (state != CALLS_CALL_STATE_DISCONNECTED)
if (new_state != CALLS_CALL_STATE_DISCONNECTED)
{
return;
}

View file

@ -81,12 +81,21 @@ get_state (CallsCall *call)
static void
change_state (CallsMMCall *self,
MMCallState state)
change_state (CallsMMCall *self,
CallsCallState state)
{
CallsCallState old_state = self->state;
if (old_state == state)
{
return;
}
self->state = state;
g_signal_emit_by_name (CALLS_CALL (self),
"state-changed", state);
"state-changed",
state,
old_state);
}

View file

@ -204,10 +204,11 @@ delete_call (CallsMMOrigin *self,
static void
call_state_changed_cb (CallsMMOrigin *self,
CallsCallState state,
CallsCallState new_state,
CallsCallState old_state,
CallsCall *call)
{
if (state != CALLS_CALL_STATE_DISCONNECTED)
if (new_state != CALLS_CALL_STATE_DISCONNECTED)
{
return;
}

View file

@ -87,9 +87,18 @@ static void
change_state (CallsOfonoCall *self,
CallsCallState state)
{
CallsCallState old_state = self->state;
if (old_state == state)
{
return;
}
self->state = state;
g_signal_emit_by_name (CALLS_CALL (self),
"state-changed", state);
"state-changed",
state,
old_state);
}