[gnome-contacts] main-windows: Add selection mode button
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] main-windows: Add selection mode button
- Date: Fri, 20 Aug 2021 11:41:06 +0000 (UTC)
commit 5fb15863bb407c5768da51f0341a13f53b5f5307
Author: Lorenz Wildberg <lorenz wild-fisch de>
Date: Mon Jul 19 12:25:51 2021 +0200
main-windows: Add selection mode button
On touchscreen devices you must press your finger for some seconds
and with a mouse you must right-click on an item
to activate selection mode.
If you don't know these operations it is impossible
to activate selection mode.
Now there is a selection mode button like in all other gnome apps.
If you click it, you go into selection mode
and can select items with just one click.
data/ui/contacts-main-window.ui | 25 +++++++++++++++++++++++++
src/contacts-main-window.vala | 8 ++++++++
2 files changed, 33 insertions(+)
---
diff --git a/data/ui/contacts-main-window.ui b/data/ui/contacts-main-window.ui
index b5842380..ee0cfd1f 100644
--- a/data/ui/contacts-main-window.ui
+++ b/data/ui/contacts-main-window.ui
@@ -188,6 +188,30 @@
<property name="pack_type">start</property>
</packing>
</child>
+
+ <child>
+ <object class="GtkButton" id="selection_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="halign">center</property>
+ <property name="valign">center</property>
+ <property name="tooltip_text" translatable="yes">Select Items</property>
+ <signal name="clicked" handler="on_selection_button_clicked"/>
+ <child>
+ <object class="GtkImage">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">object-select-symbolic</property>
+ <property name="icon_size">1</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="pack_type">end</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+
<child>
<object class="GtkMenuButton" id="hamburger_menu_button">
<property name="visible">True</property>
@@ -206,6 +230,7 @@
</object>
<packing>
<property name="pack_type">end</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
diff --git a/src/contacts-main-window.vala b/src/contacts-main-window.vala
index 486c16aa..0fac6017 100644
--- a/src/contacts-main-window.vala
+++ b/src/contacts-main-window.vala
@@ -66,6 +66,8 @@ public class Contacts.MainWindow : Hdy.ApplicationWindow {
private unowned Gtk.Button cancel_button;
[GtkChild]
private unowned Gtk.Button done_button;
+ [GtkChild]
+ private unowned Gtk.Button selection_button;
// The 2 panes the window consists of
private ListPane list_pane;
@@ -223,6 +225,7 @@ public class Contacts.MainWindow : Hdy.ApplicationWindow {
// Selecting UI
this.select_cancel_button.visible = (this.state == UiState.SELECTING);
+ this.selection_button.visible = !(this.state == UiState.SELECTING || this.state.editing ());
if (this.state != UiState.SELECTING)
this.left_header.title = _("Contacts");
@@ -294,6 +297,11 @@ public class Contacts.MainWindow : Hdy.ApplicationWindow {
this.contact_pane.individual.is_favourite = !is_fav;
}
+ [GtkCallback]
+ private void on_selection_button_clicked () {
+ this.state = UiState.SELECTING;
+ }
+
private void unlink_contact () {
var individual = this.contact_pane.individual;
if (individual == null)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]