[gnome-contacts] ListPane: make an activate_selection_mode().



commit 33b71d8d97f85f5c756ab54dc7fa37c2c6df53bd
Author: Niels De Graef <nielsdegraef gmail com>
Date:   Fri Jan 12 16:59:15 2018 +0100

    ListPane: make an activate_selection_mode().
    
    Since it's basically the same thing as the method with the same name
    from Contacts.Window (which might be merged in the future).

 src/contacts-list-pane.vala |   13 ++++++-------
 src/contacts-window.vala    |    5 ++---
 2 files changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/src/contacts-list-pane.vala b/src/contacts-list-pane.vala
index 9e65fa4..4b48230 100644
--- a/src/contacts-list-pane.vala
+++ b/src/contacts-list-pane.vala
@@ -84,14 +84,13 @@ public class Contacts.ListPane : Frame {
     ignore_selection_change = false;
   }
 
-  public void show_selection () {
-    this.contacts_list.show_selectors ();
-    actions_bar.show ();
-  }
+  public void activate_selection_mode (bool active) {
+    if (active)
+      this.contacts_list.show_selectors ();
+    else
+      this.contacts_list.hide_selectors ();
 
-  public void hide_selection () {
-    this.contacts_list.hide_selectors ();
-    actions_bar.hide ();
+    this.actions_bar.visible = active;
   }
 
   [GtkCallback]
diff --git a/src/contacts-window.vala b/src/contacts-window.vala
index 9475633..a3a9143 100644
--- a/src/contacts-window.vala
+++ b/src/contacts-window.vala
@@ -129,21 +129,20 @@ public class Contacts.Window : Gtk.ApplicationWindow {
     this.edit_button.visible = !active;
     this.right_header.show_close_button = !active;
 
+    this.list_pane.activate_selection_mode (active);
+
     if (active) {
       left_header.get_style_context ().add_class ("selection-mode");
       right_header.get_style_context ().add_class ("selection-mode");
 
       left_header.set_title (_("Select"));
 
-      list_pane.show_selection ();
     } else {
       left_header.get_style_context ().remove_class ("selection-mode");
       right_header.get_style_context ().remove_class ("selection-mode");
 
       left_header.set_title (_("All Contacts"));
 
-      list_pane.hide_selection ();
-
       /* could be no contact selected whatsoever */
       if (this.contact_pane.contact == null)
         edit_button.hide ();


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