1
0
Fork 0
mirror of https://gitlab.gnome.org/GNOME/calls.git synced 2024-06-02 10:29:25 +00:00

Merge branch 'call-display-overhaul' into 'master'

Call display overhaul

See merge request Librem5/calls!9
This commit is contained in:
Bob Ham 2018-08-01 13:38:41 +00:00
commit 700966ccfe
9 changed files with 351 additions and 42 deletions

View file

@ -42,12 +42,13 @@ struct _CallsCallDisplay
guint timeout;
GtkBox *party_box;
GtkLabel *name;
GtkLabel *primary_contact_info;
GtkLabel *secondary_contact_info;
GtkLabel *status;
GtkLabel *time;
GtkButton *answer;
GtkToggleButton *hold;
GtkToggleButton *mute;
GtkButton *hang_up;
GtkToggleButton *speaker;
};
@ -86,7 +87,7 @@ hang_up_clicked_cb (GtkButton *button,
}
static void
hold_toggled_cb (GtkToggleButton *togglebutton,
mute_toggled_cb (GtkToggleButton *togglebutton,
CallsCallDisplay *self)
{
}
@ -135,7 +136,7 @@ timeout_cb (CallsCallDisplay *self)
}
minutes = (guint)(elapsed / MINUTE);
g_string_append_printf (str, "%u:", minutes);
g_string_append_printf (str, "%02u:", minutes);
elapsed -= (minutes * MINUTE);
g_string_append_printf (str, "%02u", (guint)elapsed);
@ -166,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:
@ -175,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:
@ -209,13 +210,18 @@ static void
set_party (CallsCallDisplay *self, CallsParty *party)
{
GtkWidget *image;
const gchar *name, *number;
image = calls_party_create_image (party);
gtk_box_pack_start (self->party_box, image, TRUE, TRUE, 0);
gtk_image_set_pixel_size (GTK_IMAGE (image), 100);
gtk_widget_show (image);
gtk_label_set_text (self->name, calls_party_get_label (party));
name = calls_party_get_name (party);
number = calls_party_get_number (party);
gtk_label_set_text (self->primary_contact_info, name != NULL ? name : number);
gtk_label_set_text (self->secondary_contact_info, name != NULL ? number : NULL);
}
@ -313,15 +319,16 @@ calls_call_display_class_init (CallsCallDisplayClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/sm/puri/calls/ui/call-display.ui");
gtk_widget_class_bind_template_child (widget_class, CallsCallDisplay, party_box);
gtk_widget_class_bind_template_child (widget_class, CallsCallDisplay, name);
gtk_widget_class_bind_template_child (widget_class, CallsCallDisplay, primary_contact_info);
gtk_widget_class_bind_template_child (widget_class, CallsCallDisplay, secondary_contact_info);
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);
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*
* Author: Adrien Plazas <adrien.plazas@puri.sm>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
*/
#include "calls-encryption-indicator.h"
#include <glib/gi18n.h>
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);
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*
* Author: Adrien Plazas <adrien.plazas@puri.sm>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
*/
#ifndef CALLS_ENCRYPTION_INDICATOR_H__
#define CALLS_ENCRYPTION_INDICATOR_H__
#include <gtk/gtk.h>
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__ */

View file

@ -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);
}

View file

@ -4,5 +4,6 @@
<file preprocess="xml-stripblanks">main-window.ui</file>
<file preprocess="xml-stripblanks">call-display.ui</file>
<file preprocess="xml-stripblanks">call-selector-item.ui</file>
<file preprocess="xml-stripblanks">encryption-indicator.ui</file>
</gresource>
</gresources>

View file

@ -27,6 +27,7 @@
#define HANDY_USE_UNSTABLE_API
#include <handy.h>
#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);

View file

@ -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',
]

View file

@ -5,31 +5,40 @@
<template class="CallsCallDisplay" parent="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">center</property>
<property name="margin_bottom">8</property>
<property name="margin_left">12</property>
<property name="margin_right">12</property>
<property name="margin_top">8</property>
<property name="orientation">vertical</property>
<property name="valign">center</property>
<property name="width_request">300</property>
<child>
<object class="GtkBox" id="party_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="homogeneous">True</property>
<child>
<object class="GtkLabel" id="name">
<object class="GtkLabel" id="primary_contact_info">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">John</property>
<property name="margin_top">6</property>
<property name="margin_bottom">6</property>
<attributes>
<attribute name="scale" value="3"/>
<attribute name="weight" value="bold"/>
<attribute name="scale" value="1.6"/>
</attributes>
</object>
<packing>
<property name="expand">True</property>
<property name="pack_type">end</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="secondary_contact_info">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_top">4</property>
<property name="margin_bottom">4</property>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
</packing>
</child>
<child>
<object class="GtkBox">
@ -47,7 +56,12 @@
<object class="GtkLabel" id="time">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">0:00</property>
<property name="label" translatable="yes">00:00</property>
<property name="margin_top">30</property>
<property name="margin_bottom">40</property>
<attributes>
<attribute name="scale" value="1.6"/>
</attributes>
</object>
</child>
<child>
@ -64,50 +78,99 @@
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">12</property>
<property name="homogeneous">True</property>
<property name="height_request">65</property>
<property name="margin_bottom">65</property>
<child>
<object class="GtkToggleButton" id="hold">
<property name="label" translatable="yes">Hold</property>
<object class="GtkToggleButton" id="mute">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="no_show_all">True</property>
<signal name="toggled" handler="hold_toggled_cb" swapped="no"/>
<signal name="toggled" handler="mute_toggled_cb" swapped="no"/>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">microphone-sensitivity-muted-symbolic</property>
<property name="icon_size">3</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkButton" id="hang_up">
<property name="label" translatable="yes">Hang up</property>
<object class="GtkToggleButton" id="dial_pad">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<signal name="clicked" handler="hang_up_clicked_cb" swapped="no"/>
<property name="no_show_all">True</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">input-dialpad-symbolic</property>
<property name="icon_size">3</property>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="speaker">
<property name="label" translatable="yes">Speaker</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="no_show_all">True</property>
<signal name="toggled" handler="speaker_toggled_cb" swapped="no"/>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">audio-volume-high-symbolic</property>
<property name="icon_size">3</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="CallsEncryptionIndicator" id="encryption_indicator">
<property name="can_focus">False</property>
<property name="margin_bottom">30</property>
<property name="visible">True</property>
</object>
</child>
<child>
<object class="GtkButton" id="hang_up">
<property name="always_show_image">True</property>
<property name="can_focus">True</property>
<property name="halign">center</property>
<property name="height_request">65</property>
<property name="receives_default">False</property>
<property name="valign">start</property>
<property name="visible">True</property>
<property name="width_request">150</property>
<signal name="clicked" handler="hang_up_clicked_cb" swapped="no"/>
<style>
<class name="destructive-action"/>
<class name="image-button"/>
</style>
<child internal-child="accessible">
<object class="AtkObject" id="a11y-hang-up">
<property name="accessible-name" translatable="yes">Hang up</property>
</object>
</child>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="icon-name">call-stop-symbolic</property>
<property name="icon-size">5</property>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
</packing>
</child>
</object>
</child>
</template>
<object class="GtkSizeGroup" id="action_buttons">
<widgets>
<widget name="hold"/>
<widget name="speaker"/>
</widgets>
</object>
</interface>

View file

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.0 -->
<interface>
<requires lib="gtk+" version="3.22"/>
<template class="CallsEncryptionIndicator" parent="GtkStack">
<property name="can_focus">False</property>
<child>
<object class="GtkBox" id="is_not_encrypted">
<property name="can_focus">False</property>
<property name="spacing">6</property>
<property name="halign">center</property>
<property name="visible">True</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="icon-name">changes-allow-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="can_focus">False</property>
<property name="label" translatable="yes">This call is not encrypted</property>
<property name="visible">True</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox" id="is_encrypted">
<property name="can_focus">False</property>
<property name="spacing">6</property>
<property name="halign">center</property>
<property name="visible">True</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="icon-name">changes-prevent-symbolic</property>
<property name="icon-size">1</property>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="can_focus">False</property>
<property name="label" translatable="yes">This call is encrypted</property>
<property name="visible">True</property>
</object>
</child>
</object>
</child>
</template>
</interface>