[gnome-contacts] ContactsWindow: no need for a selection_mode-property.



commit 67852bafefc36f47f0c90df3b0e3c16e275dda77
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Fri Jan 12 15:24:11 2018 +0100

    ContactsWindow: no need for a selection_mode-property.
    
    Since it's only set using `activate_selection_mode()` we don't need
    to have an explcit property.
    
    Also merges the "constraints" (i.e. what should be visible when
    selecting) at the same place.

 src/contacts-window.vala |   25 ++++++++-----------------
 1 files changed, 8 insertions(+), 17 deletions(-)
---
diff --git a/src/contacts-window.vala b/src/contacts-window.vala
index 99eeeab..6f94542 100644
--- a/src/contacts-window.vala
+++ b/src/contacts-window.vala
@@ -61,9 +61,7 @@ public class Contacts.Window : Gtk.ApplicationWindow {
     get; construct set;
   }
 
-  public bool selection_mode {
-    get; set;
-  }
+  private bool selection_mode = false;
 
   public bool edit_mode {
     get; set;
@@ -78,19 +76,6 @@ public class Contacts.Window : Gtk.ApplicationWindow {
     debug ("everyone creation: finalized already!!!");
 
     /* stablishing constraints */
-    this.bind_property ("selection-mode",
-                       right_header, "show-close-button",
-                       BindingFlags.DEFAULT |
-                       BindingFlags.INVERT_BOOLEAN);
-    this.bind_property ("selection-mode",
-                       add_button, "visible",
-                       BindingFlags.DEFAULT |
-                       BindingFlags.INVERT_BOOLEAN);
-    this.bind_property ("selection-mode",
-                       edit_button, "visible",
-                       BindingFlags.DEFAULT |
-                       BindingFlags.INVERT_BOOLEAN);
-
     this.bind_property ("edit-mode",
                        edit_button, "visible",
                        BindingFlags.DEFAULT |
@@ -164,8 +149,14 @@ public class Contacts.Window : Gtk.ApplicationWindow {
 
   public void activate_selection_mode (bool active) {
     this.selection_mode = active;
-    this.select_button.visible = !active;
+
+    // Show some buttons when selecting (and vice versa)
     this.select_cancel_button.visible = active;
+    // and hide some
+    this.select_button.visible = !active;
+    this.add_button.visible = !active;
+    this.edit_button.visible = !active;
+    this.right_header.show_close_button = !active;
 
     if (active) {
       left_header.get_style_context ().add_class ("selection-mode");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]