From 509f4227d96faa51079438a27009379a4a754603 Mon Sep 17 00:00:00 2001 From: Adrien Plazas Date: Fri, 27 Jul 2018 12:55:18 +0200 Subject: [PATCH 01/10] call-display: Center and set the desired size This will make the call display look closer to the final designs. --- src/ui/call-display.ui | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ui/call-display.ui b/src/ui/call-display.ui index b025f48..e008991 100644 --- a/src/ui/call-display.ui +++ b/src/ui/call-display.ui @@ -5,7 +5,14 @@ From 7c974d38ede65428fbe2662bb23530767ebb9840 Mon Sep 17 00:00:00 2001 From: Adrien Plazas Date: Fri, 27 Jul 2018 13:06:17 +0200 Subject: [PATCH 06/10] call-display: Make the buttons match the new design Add 'mute' and 'dial pad' buttons, drop the 'hold' button, change the size of the central buttons, make them use icons and drop the now useless group size. --- src/calls-call-display.c | 12 +++++----- src/ui/call-display.ui | 49 +++++++++++++++++++++++++++++----------- 2 files changed, 42 insertions(+), 19 deletions(-) diff --git a/src/calls-call-display.c b/src/calls-call-display.c index 2c8b146..737a882 100644 --- a/src/calls-call-display.c +++ b/src/calls-call-display.c @@ -48,7 +48,7 @@ struct _CallsCallDisplay GtkLabel *time; GtkButton *answer; - GtkToggleButton *hold; + GtkToggleButton *mute; GtkButton *hang_up; GtkToggleButton *speaker; }; @@ -87,7 +87,7 @@ hang_up_clicked_cb (GtkButton *button, } static void -hold_toggled_cb (GtkToggleButton *togglebutton, +mute_toggled_cb (GtkToggleButton *togglebutton, CallsCallDisplay *self) { } @@ -167,7 +167,7 @@ call_state_changed_cb (CallsCallDisplay *self, { case CALLS_CALL_STATE_INCOMING: gtk_widget_show (GTK_WIDGET (self->answer)); - gtk_widget_hide (GTK_WIDGET (self->hold)); + gtk_widget_hide (GTK_WIDGET (self->mute)); gtk_widget_hide (GTK_WIDGET (self->speaker)); break; case CALLS_CALL_STATE_ACTIVE: @@ -176,7 +176,7 @@ call_state_changed_cb (CallsCallDisplay *self, case CALLS_CALL_STATE_ALERTING: case CALLS_CALL_STATE_WAITING: gtk_widget_hide (GTK_WIDGET (self->answer)); - gtk_widget_show (GTK_WIDGET (self->hold)); + gtk_widget_show (GTK_WIDGET (self->mute)); gtk_widget_show (GTK_WIDGET (self->speaker)); break; case CALLS_CALL_STATE_DISCONNECTED: @@ -324,11 +324,11 @@ calls_call_display_class_init (CallsCallDisplayClass *klass) gtk_widget_class_bind_template_child (widget_class, CallsCallDisplay, status); gtk_widget_class_bind_template_child (widget_class, CallsCallDisplay, time); gtk_widget_class_bind_template_child (widget_class, CallsCallDisplay, answer); - gtk_widget_class_bind_template_child (widget_class, CallsCallDisplay, hold); + gtk_widget_class_bind_template_child (widget_class, CallsCallDisplay, mute); gtk_widget_class_bind_template_child (widget_class, CallsCallDisplay, hang_up); gtk_widget_class_bind_template_child (widget_class, CallsCallDisplay, speaker); gtk_widget_class_bind_template_callback (widget_class, answer_clicked_cb); gtk_widget_class_bind_template_callback (widget_class, hang_up_clicked_cb); - gtk_widget_class_bind_template_callback (widget_class, hold_toggled_cb); + gtk_widget_class_bind_template_callback (widget_class, mute_toggled_cb); gtk_widget_class_bind_template_callback (widget_class, speaker_toggled_cb); } diff --git a/src/ui/call-display.ui b/src/ui/call-display.ui index 4dd31ba..8dae8e0 100644 --- a/src/ui/call-display.ui +++ b/src/ui/call-display.ui @@ -78,32 +78,61 @@ True False + 12 True + 65 65 - - Hold + True True True True - + + + + True + False + microphone-sensitivity-muted-symbolic + 3 + + + + + + + True + True + True + True + + + True + False + input-dialpad-symbolic + 3 + + - Speaker True True True True + + + True + False + audio-volume-high-symbolic + 3 + + - - True - @@ -137,10 +166,4 @@ - - - - - - From 1dca8d34fb3e3e693f7b62a952bb1aeb41749090 Mon Sep 17 00:00:00 2001 From: Adrien Plazas Date: Fri, 27 Jul 2018 13:47:45 +0200 Subject: [PATCH 07/10] Add CallsEncryptionIndicator This will be used in the next commit to let a call display indicate whether the call is encrypted or not. --- src/calls-encryption-indicator.c | 138 +++++++++++++++++++++++++++++++ src/calls-encryption-indicator.h | 45 ++++++++++ src/calls.gresources.xml | 1 + src/meson.build | 1 + src/ui/encryption-indicator.ui | 52 ++++++++++++ 5 files changed, 237 insertions(+) create mode 100644 src/calls-encryption-indicator.c create mode 100644 src/calls-encryption-indicator.h create mode 100644 src/ui/encryption-indicator.ui diff --git a/src/calls-encryption-indicator.c b/src/calls-encryption-indicator.c new file mode 100644 index 0000000..63aca8a --- /dev/null +++ b/src/calls-encryption-indicator.c @@ -0,0 +1,138 @@ +/* + * Copyright (C) 2018 Purism SPC + * + * This file is part of Calls. + * + * Calls is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Calls is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Calls. If not, see . + * + * Author: Adrien Plazas + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +#include "calls-encryption-indicator.h" + +#include + +struct _CallsEncryptionIndicator +{ + GtkStack parent_instance; + + GtkBox *is_not_encrypted; + GtkBox *is_encrypted; +}; + +G_DEFINE_TYPE (CallsEncryptionIndicator, calls_encryption_indicator, GTK_TYPE_STACK); + +enum { + PROP_0, + PROP_ENCRYPTED, + PROP_LAST_PROP, +}; +static GParamSpec *props[PROP_LAST_PROP]; + + +void +calls_encryption_indicator_set_encrypted (CallsEncryptionIndicator *self, + gboolean encrypted) +{ + g_return_if_fail (CALLS_IS_ENCRYPTION_INDICATOR (self)); + + encrypted = !!encrypted; + + gtk_stack_set_visible_child ( + GTK_STACK (self), + GTK_WIDGET (encrypted ? self->is_encrypted : self->is_not_encrypted)); +} + + +gboolean +calls_encryption_indicator_get_encrypted (CallsEncryptionIndicator *self) +{ + g_return_val_if_fail (CALLS_IS_ENCRYPTION_INDICATOR (self), FALSE); + + return gtk_stack_get_visible_child (GTK_STACK (self)) == GTK_WIDGET (self->is_encrypted); +} + + +static void +calls_encryption_indicator_init (CallsEncryptionIndicator *self) +{ + gtk_widget_init_template (GTK_WIDGET (self)); +} + + +static void +set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + CallsEncryptionIndicator *self = CALLS_ENCRYPTION_INDICATOR (object); + + switch (property_id) { + case PROP_ENCRYPTED: + calls_encryption_indicator_set_encrypted (self, g_value_get_boolean (value)); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void +get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + CallsEncryptionIndicator *self = CALLS_ENCRYPTION_INDICATOR (object); + + switch (property_id) { + case PROP_ENCRYPTED: + g_value_set_boolean (value, calls_encryption_indicator_get_encrypted (self)); + break; + + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + + +static void +calls_encryption_indicator_class_init (CallsEncryptionIndicatorClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); + + object_class->set_property = set_property; + object_class->get_property = get_property; + + props[PROP_ENCRYPTED] = + g_param_spec_boolean ("encrypted", + _("Encrypted"), + _("The party participating in the call"), + FALSE, + G_PARAM_READWRITE); + + g_object_class_install_properties (object_class, PROP_LAST_PROP, props); + gtk_widget_class_set_template_from_resource (widget_class, "/sm/puri/calls/ui/encryption-indicator.ui"); + gtk_widget_class_bind_template_child (widget_class, CallsEncryptionIndicator, is_not_encrypted); + gtk_widget_class_bind_template_child (widget_class, CallsEncryptionIndicator, is_encrypted); +} + diff --git a/src/calls-encryption-indicator.h b/src/calls-encryption-indicator.h new file mode 100644 index 0000000..2e891fa --- /dev/null +++ b/src/calls-encryption-indicator.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2018 Purism SPC + * + * This file is part of Calls. + * + * Calls is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Calls is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Calls. If not, see . + * + * Author: Adrien Plazas + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +#ifndef CALLS_ENCRYPTION_INDICATOR_H__ +#define CALLS_ENCRYPTION_INDICATOR_H__ + +#include + +G_BEGIN_DECLS + +#define CALLS_TYPE_ENCRYPTION_INDICATOR (calls_encryption_indicator_get_type ()) + +G_DECLARE_FINAL_TYPE (CallsEncryptionIndicator, calls_encryption_indicator, CALLS, ENCRYPTION_INDICATOR, GtkStack); + + +void calls_encryption_indicator_set_encrypted (CallsEncryptionIndicator *self, + gboolean encrypted); +gboolean calls_encryption_indicator_get_encrypted (CallsEncryptionIndicator *self); + + +G_END_DECLS + +#endif /* CALLS_ENCRYPTION_INDICATOR_H__ */ + diff --git a/src/calls.gresources.xml b/src/calls.gresources.xml index 6912186..cbaa257 100644 --- a/src/calls.gresources.xml +++ b/src/calls.gresources.xml @@ -4,5 +4,6 @@ main-window.ui call-display.ui call-selector-item.ui + encryption-indicator.ui diff --git a/src/meson.build b/src/meson.build index 204f8fe..7d987ef 100644 --- a/src/meson.build +++ b/src/meson.build @@ -40,6 +40,7 @@ calls_sources = ['calls-message-source.c', 'calls-message-source.h', 'calls-call-holder.c', 'calls-call-holder.h', 'calls-call-display.c', 'calls-call-display.h', 'calls-call-selector-item.c', 'calls-call-selector-item.h', + 'calls-encryption-indicator.c', 'calls-encryption-indicator.h', 'calls-main-window.c', 'calls-main-window.h', 'util.c', 'util.h', ] diff --git a/src/ui/encryption-indicator.ui b/src/ui/encryption-indicator.ui new file mode 100644 index 0000000..32adc20 --- /dev/null +++ b/src/ui/encryption-indicator.ui @@ -0,0 +1,52 @@ + + + + + + From 4616d6cafa46387cdc9e29058da7503b26cd966b Mon Sep 17 00:00:00 2001 From: Adrien Plazas Date: Fri, 27 Jul 2018 16:19:12 +0200 Subject: [PATCH 08/10] Initialize CallsEncryptionIndicator This is needed for that type to be used in the next commit. --- src/main.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main.c b/src/main.c index 1c2dc55..f240cd9 100644 --- a/src/main.c +++ b/src/main.c @@ -27,6 +27,7 @@ #define HANDY_USE_UNSTABLE_API #include +#include "calls-encryption-indicator.h" #include "calls-main-window.h" #include "calls-ofono-provider.h" @@ -38,6 +39,7 @@ show_window (GtkApplication *app) CallsProvider *provider; CallsMainWindow *main_window; + CALLS_TYPE_ENCRYPTION_INDICATOR; HDY_TYPE_DIALER; connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error); From c68b76fa638081f29e92f1fd92dc4589130bf958 Mon Sep 17 00:00:00 2001 From: Adrien Plazas Date: Fri, 27 Jul 2018 13:48:45 +0200 Subject: [PATCH 09/10] call-display: Add an encryption indicator This matches the final design. --- src/ui/call-display.ui | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ui/call-display.ui b/src/ui/call-display.ui index 8dae8e0..c07f4c5 100644 --- a/src/ui/call-display.ui +++ b/src/ui/call-display.ui @@ -134,6 +134,13 @@ + + + False + 30 + True + + True From e70789492392b95fbdc6121eb68dd6f8d1ccf185 Mon Sep 17 00:00:00 2001 From: Adrien Plazas Date: Tue, 31 Jul 2018 10:20:38 +0200 Subject: [PATCH 10/10] party: Replace the default party avatar Replace the 'face-smile' icon by the better fitting 'avatar-default-symbolic' icon. --- src/calls-party.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calls-party.c b/src/calls-party.c index 8c70b66..cc45fbc 100644 --- a/src/calls-party.c +++ b/src/calls-party.c @@ -73,7 +73,7 @@ calls_party_new (const gchar *name, const gchar *number) GtkWidget * calls_party_create_image (CallsParty *party) { - return gtk_image_new_from_icon_name ("face-smile", GTK_ICON_SIZE_DIALOG); + return gtk_image_new_from_icon_name ("avatar-default-symbolic", GTK_ICON_SIZE_DIALOG); }