Commit 4613aa3a authored by Julian Sparber's avatar Julian Sparber

debian: add patches for add_call_chat_button

parent efde8361
Pipeline #62349 passed with stages
in 6 minutes and 48 seconds
From c50cbf8c718731ce04180c3069de4722f2ec4ec2 Mon Sep 17 00:00:00 2001
From: Julian Sparber <julian@sparber.net>
Date: Fri, 2 Aug 2019 18:32:31 +0200
Subject: [PATCH] ContactSheet: Add make call and send sms button
This adds a button to make calls via the default handler for tel:
and a button to send sms via the default handler for sms:
The buttons are hidden when no handler is available
---
src/contacts-contact-sheet.vala | 20 ++++++++++++++++++--
src/contacts-utils.vala | 18 ++++++++++++++++++
2 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/src/contacts-contact-sheet.vala b/src/contacts-contact-sheet.vala
index 813d26cd..f2a8111a 100644
--- a/src/contacts-contact-sheet.vala
+++ b/src/contacts-contact-sheet.vala
@@ -217,7 +217,7 @@ public class Contacts.ContactSheet : Gtk.Grid {
if (this.store.caller_account != null) {
var call_button = create_button ("call-start-symbolic");
call_button.clicked.connect (() => {
- Utils.start_call (phone.value, this.store.caller_account);
+ Utils.start_call (phone.get_normalised (), this.store.caller_account);
});
add_row_with_label (TypeSet.phone.format_type (phone), phone.value, call_button);
@@ -225,7 +225,23 @@ public class Contacts.ContactSheet : Gtk.Grid {
add_row_with_label (TypeSet.phone.format_type (phone), phone.value);
}
#else
- add_row_with_label (TypeSet.phone.format_type (phone), phone.value);
+ // Show a call button when we have a hanlder for it
+ Gtk.Button call_button = null;
+ Gtk.Button sms_button = null;
+ if (AppInfo.get_all_for_type ("x-scheme-handler/tel").length () > 0) {
+ call_button = create_button ("call-start-symbolic");
+ call_button.clicked.connect (() => {
+ Utils.start_call (phone.get_normalised ());
+ });
+ }
+ if (AppInfo.get_all_for_type ("x-scheme-handler/sms").length () > 0) {
+ sms_button = create_button ("user-available-symbolic");
+ sms_button.clicked.connect (() => {
+ Utils.send_sms (phone.get_normalised ());
+ });
+ }
+
+ add_row_with_label (TypeSet.phone.format_type (phone), phone.value, call_button, sms_button);
#endif
}
}
diff --git a/src/contacts-utils.vala b/src/contacts-utils.vala
index 48388765..367efbfc 100644
--- a/src/contacts-utils.vala
+++ b/src/contacts-utils.vala
@@ -107,6 +107,24 @@ namespace Contacts.Utils {
var request = new TelepathyGLib.AccountChannelRequest(account, request_dict, int64.MAX);
request.ensure_channel_async.begin ("org.freedesktop.Telepathy.Client.Empathy.Call", null);
}
+#else
+ public void start_call (string number) {
+ var uri = "tel:" + Uri.escape_string (number, "+" , false);
+ try {
+ Gtk.show_uri_on_window (null, uri, 0);
+ } catch (Error e) {
+ debug ("Couldn't launch URI \"%s\": %s", uri, e.message);
+ }
+ }
+
+ public void send_sms (string number) {
+ var uri = "sms:" + Uri.escape_string (number, "+" , false);
+ try {
+ Gtk.show_uri_on_window (null, uri, 0);
+ } catch (Error e) {
+ debug ("Couldn't launch URI \"%s\": %s", uri, e.message);
+ }
+ }
#endif
public T? get_first<T> (Gee.Collection<T> collection) {
--
2.29.2
......@@ -31,3 +31,6 @@ downgrade_deps.patch
# https://gitlab.gnome.org/GNOME/gnome-contacts/-/merge_requests/139
0001-contact-list-Add-longpress-gesture-for-selecting-con.patch
0002-contact-list-Don-t-highlight-contacts-while-selectin.patch
# WIP RFC: ContactSheet: Add make call and send sms button
# https://gitlab.gnome.org/GNOME/gnome-contacts/-/merge_requests/140
0001-ContactSheet-Add-make-call-and-send-sms-button.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