mirror of
https://gitlab.gnome.org/GNOME/calls.git
synced 2025-01-05 19:15:32 +00:00
ringer: Add debugging
This commit is contained in:
parent
9fff41fd53
commit
f02d22150e
1 changed files with 28 additions and 0 deletions
|
@ -60,11 +60,29 @@ struct _CallsRinger {
|
||||||
|
|
||||||
G_DEFINE_TYPE (CallsRinger, calls_ringer, G_TYPE_OBJECT);
|
G_DEFINE_TYPE (CallsRinger, calls_ringer, G_TYPE_OBJECT);
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
ring_state_to_string (CallsRingState state)
|
||||||
|
{
|
||||||
|
switch (state) {
|
||||||
|
case CALLS_RING_STATE_INACTIVE:
|
||||||
|
return "inactive";
|
||||||
|
case CALLS_RING_STATE_REQUEST_PLAY:
|
||||||
|
return "request-play";
|
||||||
|
case CALLS_RING_STATE_PLAYING:
|
||||||
|
return "playing";
|
||||||
|
case CALLS_RING_STATE_REQUEST_STOP:
|
||||||
|
return "request-stop";
|
||||||
|
default:
|
||||||
|
return "unknown";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
change_ring_state (CallsRinger *self,
|
change_ring_state (CallsRinger *self,
|
||||||
CallsRingState state)
|
CallsRingState state)
|
||||||
{
|
{
|
||||||
|
g_debug ("%s: old: %s; new: %s",
|
||||||
|
__func__, ring_state_to_string (self->state), ring_state_to_string (state));
|
||||||
if (self->state == state)
|
if (self->state == state)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -75,6 +93,8 @@ change_ring_state (CallsRinger *self,
|
||||||
state == CALLS_RING_STATE_REQUEST_STOP)
|
state == CALLS_RING_STATE_REQUEST_STOP)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
g_debug ("%s: notify ring", __func__);
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_IS_RINGING]);
|
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_IS_RINGING]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,6 +108,7 @@ on_event_triggered (LfbEvent *event,
|
||||||
g_return_if_fail (LFB_IS_EVENT (event));
|
g_return_if_fail (LFB_IS_EVENT (event));
|
||||||
g_return_if_fail (CALLS_IS_RINGER (self));
|
g_return_if_fail (CALLS_IS_RINGER (self));
|
||||||
|
|
||||||
|
g_debug ("%s", __func__);
|
||||||
if (lfb_event_trigger_feedback_finish (event, res, &err)) {
|
if (lfb_event_trigger_feedback_finish (event, res, &err)) {
|
||||||
change_ring_state (self, CALLS_RING_STATE_PLAYING);
|
change_ring_state (self, CALLS_RING_STATE_PLAYING);
|
||||||
} else {
|
} else {
|
||||||
|
@ -104,6 +125,7 @@ static void
|
||||||
start (CallsRinger *self,
|
start (CallsRinger *self,
|
||||||
gboolean quiet)
|
gboolean quiet)
|
||||||
{
|
{
|
||||||
|
g_debug ("%s: state: %s", __func__, ring_state_to_string (self->state));
|
||||||
if (self->event)
|
if (self->event)
|
||||||
lfb_event_set_feedback_profile (self->event, quiet ? "quiet" : NULL);
|
lfb_event_set_feedback_profile (self->event, quiet ? "quiet" : NULL);
|
||||||
|
|
||||||
|
@ -135,6 +157,8 @@ on_event_feedback_ended (LfbEvent *event,
|
||||||
g_return_if_fail (LFB_IS_EVENT (event));
|
g_return_if_fail (LFB_IS_EVENT (event));
|
||||||
g_return_if_fail (CALLS_IS_RINGER (self));
|
g_return_if_fail (CALLS_IS_RINGER (self));
|
||||||
|
|
||||||
|
g_debug ("%s: state: %s", __func__, ring_state_to_string (self->state));
|
||||||
|
|
||||||
if (self->state == CALLS_RING_STATE_REQUEST_PLAY ||
|
if (self->state == CALLS_RING_STATE_REQUEST_PLAY ||
|
||||||
self->state == CALLS_RING_STATE_PLAYING)
|
self->state == CALLS_RING_STATE_PLAYING)
|
||||||
g_warning ("Feedback ended although it should be playing");
|
g_warning ("Feedback ended although it should be playing");
|
||||||
|
@ -152,6 +176,7 @@ on_feedback_ended (LfbEvent *event,
|
||||||
CallsRinger *self)
|
CallsRinger *self)
|
||||||
{
|
{
|
||||||
g_debug ("Feedback ended");
|
g_debug ("Feedback ended");
|
||||||
|
g_debug ("%s: state: %s", __func__, ring_state_to_string (self->state));
|
||||||
change_ring_state (self, CALLS_RING_STATE_INACTIVE);
|
change_ring_state (self, CALLS_RING_STATE_INACTIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,18 +184,21 @@ on_feedback_ended (LfbEvent *event,
|
||||||
static void
|
static void
|
||||||
stop (CallsRinger *self)
|
stop (CallsRinger *self)
|
||||||
{
|
{
|
||||||
|
g_debug ("%s: state: %s", __func__, ring_state_to_string (self->state));
|
||||||
if (self->state == CALLS_RING_STATE_INACTIVE ||
|
if (self->state == CALLS_RING_STATE_INACTIVE ||
|
||||||
self->state == CALLS_RING_STATE_REQUEST_STOP)
|
self->state == CALLS_RING_STATE_REQUEST_STOP)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_debug ("Stopping ringtone");
|
g_debug ("Stopping ringtone");
|
||||||
if (self->state == CALLS_RING_STATE_PLAYING) {
|
if (self->state == CALLS_RING_STATE_PLAYING) {
|
||||||
|
g_debug ("ending event feedback");
|
||||||
lfb_event_end_feedback_async (self->event,
|
lfb_event_end_feedback_async (self->event,
|
||||||
NULL,
|
NULL,
|
||||||
(GAsyncReadyCallback) on_event_feedback_ended,
|
(GAsyncReadyCallback) on_event_feedback_ended,
|
||||||
self);
|
self);
|
||||||
change_ring_state (self, CALLS_RING_STATE_REQUEST_STOP);
|
change_ring_state (self, CALLS_RING_STATE_REQUEST_STOP);
|
||||||
} else if (self->state == CALLS_RING_STATE_REQUEST_PLAY) {
|
} else if (self->state == CALLS_RING_STATE_REQUEST_PLAY) {
|
||||||
|
g_debug ("cancelling event feedback");
|
||||||
g_cancellable_cancel (self->cancel_ring);
|
g_cancellable_cancel (self->cancel_ring);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue