1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2025-01-08 12:55:32 +00:00

display: codestyle

This commit is contained in:
Evangelos Ribeiro Tzaras 2021-06-02 19:58:05 +02:00
parent 6f93b48ef4
commit 588955b59e

View file

@ -76,9 +76,7 @@ answer_clicked_cb (GtkButton *button,
g_return_if_fail (CALLS_IS_CALL_DISPLAY (self)); g_return_if_fail (CALLS_IS_CALL_DISPLAY (self));
if (self->call) if (self->call)
{
calls_call_answer (self->call); calls_call_answer (self->call);
}
} }
static void static void
@ -88,9 +86,7 @@ hang_up_clicked_cb (GtkButton *button,
g_return_if_fail (CALLS_IS_CALL_DISPLAY (self)); g_return_if_fail (CALLS_IS_CALL_DISPLAY (self));
if (self->call) if (self->call)
{
calls_call_hang_up (self->call); calls_call_hang_up (self->call);
}
} }
static void static void
@ -109,10 +105,9 @@ mute_toggled_cb (GtkToggleButton *togglebutton,
want_mute = gtk_toggle_button_get_active (togglebutton); want_mute = gtk_toggle_button_get_active (togglebutton);
ret = call_audio_mute_mic (want_mute, &error); ret = call_audio_mute_mic (want_mute, &error);
if (!ret && error) if (!ret && error)
{ g_warning ("Failed to %smute microphone: %s",
g_warning ("Failed to %smute microphone: %s", want_mute ? "" : "un", want_mute ? "" : "un",
error->message); error->message);
}
} }
@ -126,10 +121,9 @@ speaker_toggled_cb (GtkToggleButton *togglebutton,
want_speaker = gtk_toggle_button_get_active (togglebutton); want_speaker = gtk_toggle_button_get_active (togglebutton);
ret = call_audio_enable_speaker (want_speaker, &error); ret = call_audio_enable_speaker (want_speaker, &error);
if (!ret && error) if (!ret && error)
{ g_warning ("Failed to %sable speaker: %s",
g_warning ("Failed to %sable speaker: %s", want_speaker ? "en" : "dis", want_speaker ? "en" : "dis",
error->message); error->message);
}
} }
@ -160,23 +154,19 @@ timeout_cb (CallsCallDisplay *self)
g_return_val_if_fail (CALLS_IS_CALL_DISPLAY (self), FALSE); g_return_val_if_fail (CALLS_IS_CALL_DISPLAY (self), FALSE);
if (!self->call) if (!self->call)
{
return FALSE; return FALSE;
}
elapsed = g_timer_elapsed (self->timer, NULL); elapsed = g_timer_elapsed (self->timer, NULL);
str = g_string_new (""); str = g_string_new ("");
if ( (printing = (elapsed > DAY)) ) if ( (printing = (elapsed > DAY)) ) {
{
guint days = (guint)(elapsed / DAY); guint days = (guint)(elapsed / DAY);
g_string_append_printf (str, "%ud ", days); g_string_append_printf (str, "%ud ", days);
elapsed -= (days * DAY); elapsed -= (days * DAY);
} }
if (printing || elapsed > HOUR) if (printing || elapsed > HOUR) {
{
guint hours = (guint)(elapsed / HOUR); guint hours = (guint)(elapsed / HOUR);
g_string_append_printf (str, "%u:", hours); g_string_append_printf (str, "%u:", hours);
elapsed -= (hours * HOUR); elapsed -= (hours * HOUR);
@ -203,9 +193,7 @@ static void
stop_timeout (CallsCallDisplay *self) stop_timeout (CallsCallDisplay *self)
{ {
if (self->timeout == 0) if (self->timeout == 0)
{
return; return;
}
g_source_remove (self->timeout); g_source_remove (self->timeout);
self->timeout = 0; self->timeout = 0;
@ -215,8 +203,7 @@ stop_timeout (CallsCallDisplay *self)
static void static void
select_mode_complete (gboolean success, GError *error, gpointer data) select_mode_complete (gboolean success, GError *error, gpointer data)
{ {
if (error) if (error) {
{
g_warning ("Failed to select audio mode: %s", error->message); g_warning ("Failed to select audio mode: %s", error->message);
g_error_free (error); g_error_free (error);
} }
@ -236,8 +223,7 @@ call_state_changed_cb (CallsCallDisplay *self,
(GTK_WIDGET (self->hang_up)); (GTK_WIDGET (self->hang_up));
/* Widgets */ /* Widgets */
switch (state) switch (state) {
{
case CALLS_CALL_STATE_INCOMING: case CALLS_CALL_STATE_INCOMING:
gtk_widget_hide (GTK_WIDGET (self->status)); gtk_widget_hide (GTK_WIDGET (self->status));
gtk_widget_hide (GTK_WIDGET (self->controls)); gtk_widget_hide (GTK_WIDGET (self->controls));
@ -273,17 +259,14 @@ call_state_changed_cb (CallsCallDisplay *self,
calls_list = calls_manager_get_calls (calls_manager_get_default ()); calls_list = calls_manager_get_calls (calls_manager_get_default ());
/* Switch to default mode only if there's no other ongoing call */ /* Switch to default mode only if there's no other ongoing call */
if (!calls_list || (calls_list->data == self->call && !calls_list->next)) if (!calls_list || (calls_list->data == self->call && !calls_list->next))
{
call_audio_select_mode_async (CALL_AUDIO_MODE_DEFAULT, call_audio_select_mode_async (CALL_AUDIO_MODE_DEFAULT,
select_mode_complete, select_mode_complete,
NULL); NULL);
}
break; break;
} }
/* Status text */ /* Status text */
switch (state) switch (state) {
{
case CALLS_CALL_STATE_INCOMING: case CALLS_CALL_STATE_INCOMING:
break; break;
@ -295,8 +278,7 @@ call_state_changed_cb (CallsCallDisplay *self,
case CALLS_CALL_STATE_ACTIVE: case CALLS_CALL_STATE_ACTIVE:
case CALLS_CALL_STATE_HELD: case CALLS_CALL_STATE_HELD:
case CALLS_CALL_STATE_WAITING: case CALLS_CALL_STATE_WAITING:
if (self->timeout == 0) if (self->timeout == 0) {
{
self->timeout = g_timeout_add self->timeout = g_timeout_add
(500, (GSourceFunc)timeout_cb, self); (500, (GSourceFunc)timeout_cb, self);
timeout_cb (self); timeout_cb (self);
@ -446,8 +428,7 @@ calls_call_display_init (CallsCallDisplay *self)
{ {
gtk_widget_init_template (GTK_WIDGET (self)); gtk_widget_init_template (GTK_WIDGET (self));
if (!call_audio_is_inited ()) if (!call_audio_is_inited ()) {
{
g_critical ("libcallaudio not initialized"); g_critical ("libcallaudio not initialized");
gtk_widget_set_sensitive (GTK_WIDGET (self->speaker), FALSE); gtk_widget_set_sensitive (GTK_WIDGET (self->speaker), FALSE);
gtk_widget_set_sensitive (GTK_WIDGET (self->mute), FALSE); gtk_widget_set_sensitive (GTK_WIDGET (self->mute), FALSE);