mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2025-01-07 12:25:31 +00:00
src: Add old state as argument to CallsCall's state-changed signal
This commit is contained in:
parent
74c3987ce1
commit
027c49e8bd
6 changed files with 47 additions and 12 deletions
|
@ -102,12 +102,17 @@ static guint signals [SIGNAL_LAST_SIGNAL];
|
||||||
static void
|
static void
|
||||||
calls_call_default_init (CallsCallInterface *iface)
|
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:
|
* CallsCall::state-changed:
|
||||||
* @self: The #CallsCall instance.
|
* @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
|
* This signal is emitted when the state of the call changes, for
|
||||||
* example when it's answered or when the call is disconnected.
|
* 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,
|
G_SIGNAL_RUN_LAST,
|
||||||
NULL, NULL, NULL, NULL,
|
NULL, NULL, NULL, NULL,
|
||||||
G_TYPE_NONE,
|
G_TYPE_NONE,
|
||||||
1, &arg_types);
|
2, arg_types);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -85,8 +85,18 @@ change_state (CallsCall *call,
|
||||||
CallsDummyCall *self,
|
CallsDummyCall *self,
|
||||||
CallsCallState state)
|
CallsCallState state)
|
||||||
{
|
{
|
||||||
|
CallsCallState old_state = self->state;
|
||||||
|
|
||||||
|
if (old_state == state)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
self->state = state;
|
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
|
static void
|
||||||
|
|
|
@ -110,10 +110,11 @@ remove_calls (CallsDummyOrigin *self, const gchar *reason)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
call_state_changed_cb (CallsDummyOrigin *self,
|
call_state_changed_cb (CallsDummyOrigin *self,
|
||||||
CallsCallState state,
|
CallsCallState new_state,
|
||||||
|
CallsCallState old_state,
|
||||||
CallsCall *call)
|
CallsCall *call)
|
||||||
{
|
{
|
||||||
if (state != CALLS_CALL_STATE_DISCONNECTED)
|
if (new_state != CALLS_CALL_STATE_DISCONNECTED)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,12 +81,21 @@ get_state (CallsCall *call)
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
change_state (CallsMMCall *self,
|
change_state (CallsMMCall *self,
|
||||||
MMCallState state)
|
CallsCallState state)
|
||||||
{
|
{
|
||||||
|
CallsCallState old_state = self->state;
|
||||||
|
|
||||||
|
if (old_state == state)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
self->state = state;
|
self->state = state;
|
||||||
g_signal_emit_by_name (CALLS_CALL (self),
|
g_signal_emit_by_name (CALLS_CALL (self),
|
||||||
"state-changed", state);
|
"state-changed",
|
||||||
|
state,
|
||||||
|
old_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -204,10 +204,11 @@ delete_call (CallsMMOrigin *self,
|
||||||
|
|
||||||
static void
|
static void
|
||||||
call_state_changed_cb (CallsMMOrigin *self,
|
call_state_changed_cb (CallsMMOrigin *self,
|
||||||
CallsCallState state,
|
CallsCallState new_state,
|
||||||
|
CallsCallState old_state,
|
||||||
CallsCall *call)
|
CallsCall *call)
|
||||||
{
|
{
|
||||||
if (state != CALLS_CALL_STATE_DISCONNECTED)
|
if (new_state != CALLS_CALL_STATE_DISCONNECTED)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,9 +87,18 @@ static void
|
||||||
change_state (CallsOfonoCall *self,
|
change_state (CallsOfonoCall *self,
|
||||||
CallsCallState state)
|
CallsCallState state)
|
||||||
{
|
{
|
||||||
|
CallsCallState old_state = self->state;
|
||||||
|
|
||||||
|
if (old_state == state)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
self->state = state;
|
self->state = state;
|
||||||
g_signal_emit_by_name (CALLS_CALL (self),
|
g_signal_emit_by_name (CALLS_CALL (self),
|
||||||
"state-changed", state);
|
"state-changed",
|
||||||
|
state,
|
||||||
|
old_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue