[gnome-contacts] Window: allow simultaneously selecting & displaying a contact.
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-contacts] Window: allow simultaneously selecting & displaying a contact.
- Date: Sat, 20 Jan 2018 22:44:14 +0000 (UTC)
commit 3bfd250e8d1a75d6e21f8e3d4e6fcc531a6b060b
Author: Niels De Graef <nielsdegraef gmail com>
Date: Sat Jan 20 23:42:31 2018 +0100
Window: allow simultaneously selecting & displaying a contact.
src/contacts-ui-state.vala | 4 ++--
src/contacts-window.vala | 22 ++++++++++++----------
2 files changed, 14 insertions(+), 12 deletions(-)
---
diff --git a/src/contacts-ui-state.vala b/src/contacts-ui-state.vala
index ad7230b..5dcfd9e 100644
--- a/src/contacts-ui-state.vala
+++ b/src/contacts-ui-state.vala
@@ -30,13 +30,13 @@ public enum Contacts.UiState {
NORMAL,
/**
- * A contact has been selected and is displayed.
+ * A single contact is selected and displayed.
*/
SHOWING,
/**
* Zero or more contacts are selected (but this can be changed).
- * No contact should be displayed.
+ * One contact might be displayed.
*/
SELECTING,
diff --git a/src/contacts-window.vala b/src/contacts-window.vala
index 4e006fd..c4ad76d 100644
--- a/src/contacts-window.vala
+++ b/src/contacts-window.vala
@@ -210,8 +210,6 @@ public class Contacts.Window : Gtk.ApplicationWindow {
if (this.contact_pane.on_edit_mode)
stop_editing ();
- this.state = (c != null)? UiState.SHOWING : UiState.NORMAL;
-
this.contact_pane.show_contact (c, false);
if (list_pane != null)
list_pane.select_contact (c);
@@ -290,11 +288,13 @@ public class Contacts.Window : Gtk.ApplicationWindow {
void list_pane_selection_changed_cb (Contact? new_selection) {
set_shown_contact (new_selection);
+ if (this.state != UiState.SELECTING)
+ this.state = UiState.SHOWING;
}
void list_pane_link_contacts_cb (LinkedList<Contact> contact_list) {
- /* getting out of selection mode */
set_shown_contact (null);
+ this.state = UiState.NORMAL;
LinkOperation2 operation = null;
link_contacts_list.begin (contact_list, this.store, (obj, result) => {
@@ -321,7 +321,7 @@ public class Contacts.Window : Gtk.ApplicationWindow {
void list_pane_delete_contacts_cb (LinkedList<Contact> contact_list) {
/* getting out of selection mode */
set_shown_contact (null);
- this.state == UiState.NORMAL;
+ this.state = UiState.NORMAL;
string msg = ngettext ("%d contact deleted",
"%d contacts deleted",
@@ -336,6 +336,12 @@ public class Contacts.Window : Gtk.ApplicationWindow {
b.clicked.connect ( () => {
really_delete = false;
notification.dismiss ();
+
+ foreach (var c in contact_list)
+ c.show ();
+
+ set_shown_contact (contact_list.last ());
+ this.state = UiState.SHOWING;
});
notification.dismissed.connect ( () => {
if (really_delete)
@@ -344,16 +350,11 @@ public class Contacts.Window : Gtk.ApplicationWindow {
});
add_notification (notification);
-
- foreach (var c in contact_list) {
- c.show ();
- }
- set_shown_contact (contact_list.last ());
}
private void contact_pane_delete_contact_cb (Contact contact) {
- /* unsetting edit-mode */
set_shown_contact (null);
+ this.state = UiState.NORMAL;
var msg = _("Contact deleted: ā%sā").printf (contact.display_name);
var b = new Button.with_mnemonic (_("_Undo"));
@@ -377,6 +378,7 @@ public class Contacts.Window : Gtk.ApplicationWindow {
notification.dismiss ();
contact.show ();
set_shown_contact (contact);
+ this.state = UiState.SHOWING;
});
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]