[gnome-contacts] Added selection-mode skel.



commit 472eb599028328ea0c2fc162657ebca179d24c16
Author: Erick PÃrez Castellanos <erick red gmail com>
Date:   Tue Feb 5 11:20:37 2013 -0500

    Added selection-mode skel.
    
    Added select button to the toolbar.
    Added selection-toolbar.
    Added some mechanics.

 src/contacts-app.vala       |   10 +++++++++-
 src/contacts-list-pane.vala |   23 ++++++++++++++++++++++-
 2 files changed, 31 insertions(+), 2 deletions(-)
---
diff --git a/src/contacts-app.vala b/src/contacts-app.vala
index e85b23c..0ec71ec 100644
--- a/src/contacts-app.vala
+++ b/src/contacts-app.vala
@@ -28,6 +28,7 @@ public class Contacts.App : Gtk.Application {
   private Gtk.Overlay overlay;
 
   private Gd.MainToolbar left_toolbar;
+  private ToggleButton select_button;
   private ListPane list_pane;
 
   private Toolbar right_toolbar;
@@ -288,7 +289,7 @@ public class Contacts.App : Gtk.Application {
     add_button.set_size_request (70, -1);
     add_button.clicked.connect (app.new_contact);
 
-    var select_button = left_toolbar.add_button ("object-select-symbolic", null, false) as Gtk.Button;
+    select_button = left_toolbar.add_toggle ("object-select-symbolic", null, false) as ToggleButton;
 
     right_toolbar = new Toolbar ();
     right_toolbar.get_style_context ().add_class (STYLE_CLASS_MENUBAR);
@@ -353,6 +354,13 @@ public class Contacts.App : Gtk.Application {
 
     grid.show_all ();
 
+    select_button.toggled.connect (() => {
+	if (select_button.active)
+	  list_pane.show_selection ();
+	else
+	  list_pane.hide_selection ();
+      });
+
     edit_button.clicked.connect (() => {
 	var name = _("Editing");
 	if (contacts_pane.contact != null) {
diff --git a/src/contacts-list-pane.vala b/src/contacts-list-pane.vala
index cf2d222..f560c57 100644
--- a/src/contacts-list-pane.vala
+++ b/src/contacts-list-pane.vala
@@ -21,8 +21,11 @@ using Folks;
 
 public class Contacts.ListPane : Frame {
   private Store contacts_store;
-  private View contacts_view;
+
   public Entry filter_entry;
+  private View contacts_view;
+  private Gd.MainToolbar selection_toolbar;
+
   private uint filter_entry_changed_id;
   private bool ignore_selection_change;
   private bool search_visible;
@@ -117,9 +120,25 @@ public class Contacts.ListPane : Frame {
     grid.add (toolbar);
     grid.add (scrolled);
 
+    selection_toolbar = new Gd.MainToolbar ();
+    selection_toolbar.get_style_context ().add_class (STYLE_CLASS_MENUBAR);
+    selection_toolbar.get_style_context ().add_class ("contacts-selection-toolbar");
+    selection_toolbar.set_vexpand (false);
+
+    var link_selected_button = selection_toolbar.add_button (null, _("Link"), true) as Gtk.Button;
+    link_selected_button.set_size_request (70, -1);
+    link_selected_button.set_sensitive (false);
+    var delete_selected_button = selection_toolbar.add_button (null, _("Delete"), false) as Gtk.Button;
+    delete_selected_button.set_size_request (70, -1);
+    delete_selected_button.set_sensitive (false);
+
+    grid.add (selection_toolbar);
+
     this.show_all ();
+    this.set_no_show_all (true);
 
     scrolled.show ();
+    selection_toolbar.hide ();
   }
 
   public void select_contact (Contact contact, bool ignore_change = false) {
@@ -131,9 +150,11 @@ public class Contacts.ListPane : Frame {
 
   public void show_selection () {
     contacts_view.show_selectors ();
+    selection_toolbar.show ();
   }
 
   public void hide_selection () {
     contacts_view.hide_selectors ();
+    selection_toolbar.hide ();
   }
 }


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