Commit 8fdc46e3 authored by Evangelos Ribeiro Tzaras's avatar Evangelos Ribeiro Tzaras
Browse files

Merge branch 'backport_hanging_up_calls_fix_into_amber' into 'pureos/amber-phone'

Backport hanging up calls fix into amber

See merge request !4
parents 68832c9f 94815a12
Pipeline #66366 passed with stages
in 11 minutes and 15 seconds
gnome-calls (0.2.0-2pureos1~amber2) amber-phone; urgency=medium
* Upload to amber-phone
* d/patches: Hang up call on window close
-- Evangelos Ribeiro Tzaras <evangelos.tzaras@puri.sm> Thu, 11 Mar 2021 23:23:35 +0100
gnome-calls (0.2.0-2pureos1~amber1) amber-phone; urgency=medium
* Upload to amber-phone
......
From f69c597387cf5eee3c60e0b5947ce511298f0254 Mon Sep 17 00:00:00 2001
From: Evangelos Ribeiro Tzaras <evangelos.tzaras@puri.sm>
Date: Tue, 12 Jan 2021 00:50:28 +0100
Subject: [PATCH 1/2] manager: add has_active_call() and hang_up_all_calls()
---
src/calls-manager.c | 56 +++++++++++++++++++++++++++++++++++++++++++++
src/calls-manager.h | 2 ++
2 files changed, 58 insertions(+)
diff --git a/src/calls-manager.c b/src/calls-manager.c
index 1c4cf93..61a4f69 100644
--- a/src/calls-manager.c
+++ b/src/calls-manager.c
@@ -564,6 +564,62 @@ calls_manager_get_calls (CallsManager *self)
return g_steal_pointer (&calls);
}
+/**
+ * calls_manager_hang_up_all_calls:
+ * @self: a #CallsManager
+ *
+ * Hangs up on every call known to @self.
+ */
+void
+calls_manager_hang_up_all_calls (CallsManager *self)
+{
+ g_autoptr (GList) calls = NULL;
+ GList *node;
+ CallsCall *call;
+
+ g_return_if_fail (CALLS_IS_MANAGER (self));
+
+ calls = calls_manager_get_calls (self);
+
+ for (node = calls; node; node = node->next)
+ {
+ call = node->data;
+ g_debug ("Hanging up on call %s", calls_call_get_name (call));
+ calls_call_hang_up (call);
+ }
+
+ g_debug ("Hanged up on all calls");
+}
+
+/**
+ * calls_manager_has_active_call
+ * @self: a #CallsManager
+ *
+ * Checks if @self has any active call
+ *
+ * Returns: %TRUE if there are active calls, %FALSE otherwise
+ */
+gboolean
+calls_manager_has_active_call (CallsManager *self)
+{
+ g_autoptr (GList) calls = NULL;
+ GList *node;
+ CallsCall *call;
+
+ g_return_val_if_fail (CALLS_IS_MANAGER (self), FALSE);
+
+ calls = calls_manager_get_calls (self);
+
+ for (node = calls; node; node = node->next)
+ {
+ call = node->data;
+ if (calls_call_get_state (call) != CALLS_CALL_STATE_DISCONNECTED)
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
CallsOrigin *
calls_manager_get_default_origin (CallsManager *self)
{
diff --git a/src/calls-manager.h b/src/calls-manager.h
index 377aa45..63ad473 100644
--- a/src/calls-manager.h
+++ b/src/calls-manager.h
@@ -61,5 +61,7 @@ CallsOrigin *calls_manager_get_default_origin (CallsManager *self);
void calls_manager_set_default_origin (CallsManager *self,
CallsOrigin *origin);
const gchar *calls_manager_get_contact_name (CallsCall *call);
+gboolean calls_manager_has_active_call (CallsManager *self);
+void calls_manager_hang_up_all_calls (CallsManager *self);
G_END_DECLS
--
2.30.1
From 5bdfb0e2232b2f127c49ebb79f835e23560838e7 Mon Sep 17 00:00:00 2001
From: Evangelos Ribeiro Tzaras <evangelos.tzaras@puri.sm>
Date: Tue, 12 Jan 2021 01:27:45 +0100
Subject: [PATCH 2/2] application: Hang up calls when closing the UI
---
src/calls-application.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/src/calls-application.c b/src/calls-application.c
index 716b767..25bb960 100644
--- a/src/calls-application.c
+++ b/src/calls-application.c
@@ -328,6 +328,22 @@ startup (GApplication *application)
}
+static void
+notify_window_visible_cb (GtkWidget *window,
+ GParamSpec *pspec,
+ CallsApplication *application)
+{
+ CallsManager *manager = calls_manager_get_default ();
+
+ g_return_if_fail (CALLS_IS_APPLICATION (application));
+ g_return_if_fail (CALLS_IS_CALL_WINDOW (window));
+
+ /* The UI is being closed, hang up active calls */
+ if (!gtk_widget_is_visible (window))
+ calls_manager_hang_up_all_calls (manager);
+}
+
+
static gboolean
start_proper (CallsApplication *self)
{
@@ -360,6 +376,11 @@ start_proper (CallsApplication *self)
self->call_window = calls_call_window_new (gtk_app);
g_assert (self->call_window != NULL);
+ g_signal_connect (self->call_window,
+ "notify::visible",
+ G_CALLBACK (notify_window_visible_cb),
+ self);
+
return TRUE;
}
--
2.30.1
0000-fix-missing-main-category-from-desktop-file.patch
0001-rename-binary.patch
0002-callaudio-api.patch
0003-manager-add-has_active_call-and-hang_up_all_calls.patch
0004-application-Hang-up-calls-when-closing-the-UI.patch
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment