Commit efde8361 authored by Julian Sparber's avatar Julian Sparber
Browse files

debian: add patches for long_press_gesture

parent 4ff7c39c
From 97fd696d41aa4fd66b2aeeb741a79b9557ab7160 Mon Sep 17 00:00:00 2001
From: Julian Sparber <julian@sparber.net>
Date: Wed, 24 Jul 2019 11:25:31 +0200
Subject: [PATCH 1/2] contact-list: Add longpress gesture for selecting
contacts
---
src/contacts-contact-list.vala | 36 ++++++++++++++++++++++++++++------
1 file changed, 30 insertions(+), 6 deletions(-)
diff --git a/src/contacts-contact-list.vala b/src/contacts-contact-list.vala
index 07103af2..86b355d4 100644
--- a/src/contacts-contact-list.vala
+++ b/src/contacts-contact-list.vala
@@ -103,6 +103,9 @@ public class Contacts.ContactList : Gtk.ListBox {
private bool sort_on_surname = false; // keep in sync with the setting
+ private Gtk.GestureLongPress long_press;
+ private bool got_long_press = false;
+
public UiState state { get; set; }
public ContactList (Settings settings, Store store, Query query) {
@@ -114,6 +117,16 @@ public class Contacts.ContactList : Gtk.ListBox {
this.notify["state"].connect (on_ui_state_changed);
+ // Connect long press gesture
+ this.long_press = new Gtk.GestureLongPress (this);
+ this.long_press.pressed.connect ((g, x, y) => {
+ this.got_long_press = true;
+ var row = (ContactDataRow) get_row_at_y ((int) Math.round (y));
+ if (row != null) {
+ row.selector_button.active = this.state != UiState.SELECTING || !row.selector_button.active;
+ }
+ });
+
this.sort_on_surname = settings.sort_on_surname;
settings.changed["sort-on-surname"].connect(() => {
this.sort_on_surname = settings.sort_on_surname;
@@ -235,14 +248,26 @@ public class Contacts.ContactList : Gtk.ListBox {
row.destroy ();
}
+ public override void row_activated (Gtk.ListBoxRow row) {
+ if (!this.got_long_press) {
+ var data = (ContactDataRow?) row as ContactDataRow;
+ if (data != null && this.state == UiState.SELECTING)
+ data.selector_button.active = !data.selector_button.active;
+ } else {
+ this.got_long_press = false;
+ }
+ }
+
public override void row_selected (Gtk.ListBoxRow? row) {
- var data = (ContactDataRow?) row as ContactDataRow;
- var individual = data != null ? data.individual : null;
- selection_changed (individual);
+ if (this.state != UiState.SELECTING) {
+ var data = (ContactDataRow?) row as ContactDataRow;
+ var individual = data != null ? data.individual : null;
+ selection_changed (individual);
#if HAVE_TELEPATHY
- if (individual != null)
- Utils.fetch_contact_info (individual);
+ if (individual != null)
+ Contact.fetch_contact_info (individual);
#endif
+ }
}
private bool filter_row (Gtk.ListBoxRow row) {
@@ -306,7 +331,6 @@ public class Contacts.ContactList : Gtk.ListBox {
if (event.button == Gdk.BUTTON_SECONDARY) {
unowned var row = (ContactDataRow) get_row_at_y ((int) Math.round (event.y));
if (row != null) {
- select_row (row);
row.selector_button.active = this.state != UiState.SELECTING || !row.selector_button.active;
}
}
--
2.29.2
From 809db6134a9ef05cacdbedf3f6e009bd3ab7c087 Mon Sep 17 00:00:00 2001
From: Julian Sparber <julian@sparber.net>
Date: Wed, 16 Dec 2020 16:08:24 +0100
Subject: [PATCH 2/2] contact-list: Don't highlight contacts while selecting
---
src/contacts-contact-list.vala | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/contacts-contact-list.vala b/src/contacts-contact-list.vala
index 86b355d4..89a0848d 100644
--- a/src/contacts-contact-list.vala
+++ b/src/contacts-contact-list.vala
@@ -154,8 +154,12 @@ public class Contacts.ContactList : Gtk.ListBox {
row.selector_button.active = false;
}
- if (this.state != UiState.SELECTING)
+ if (this.state == UiState.SELECTING) {
+ this.selection_mode = Gtk.SelectionMode.NONE;
+ } else {
+ this.selection_mode = Gtk.SelectionMode.BROWSE;
this.nr_contacts_marked = 0;
+ }
}
private int compare_rows (Gtk.ListBoxRow row_a, Gtk.ListBoxRow row_b) {
--
2.29.2
......@@ -27,3 +27,7 @@ downgrade_deps.patch
0039-data-Update-manpage.patch
0040-Update-Norwegian-Bokm-l-translation.patch
0042-Correct-some-spelling-mistakes.patch
# contact-list: Add longpress gesture for selecting contacts
# 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
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