[gnome-contacts] Add menu style toolbar



commit 511c4c80a7b4b0f6e39b464ef0f3b2c3ecff8c81
Author: Alexander Larsson <alexl redhat com>
Date:   Tue Jan 17 10:46:28 2012 +0100

    Add menu style toolbar

 src/contacts-app.vala       |   51 +++++++++++++++++++++++++++++++++++++-----
 src/contacts-list-pane.vala |   13 -----------
 2 files changed, 45 insertions(+), 19 deletions(-)
---
diff --git a/src/contacts-app.vala b/src/contacts-app.vala
index f60c8d5..659cd22 100644
--- a/src/contacts-app.vala
+++ b/src/contacts-app.vala
@@ -247,12 +247,55 @@ public class Contacts.App : Gtk.Application {
     window.set_application (this);
     window.set_title (_("Contacts"));
     window.set_size_request (745, 510);
+    window.hide_titlebar_when_maximized = true;
     window.delete_event.connect (window_delete_event);
     window.map_event.connect (window_map_event);
     window.key_press_event.connect (window_key_press_event);
 
     var grid = new Grid();
 
+    var toolbar = new Toolbar ();
+    toolbar.set_icon_size (IconSize.MENU);
+    toolbar.get_style_context ().add_class (STYLE_CLASS_MENUBAR);
+    toolbar.set_vexpand (false);
+    toolbar.set_hexpand (true);
+    grid.attach (toolbar, 0, 0, 1, 1);
+
+    var add_button = new ToolButton (null, _("Add..."));
+    add_button.margin_left = 4;
+    add_button.is_important = true;
+    toolbar.add (add_button);
+    add_button.clicked.connect ( (button) => {
+	var dialog = new NewContactDialog (contacts_store, window);
+	dialog.show_all ();
+      });
+
+    var select_button = new ToolButton (null, null);
+    select_button.set_icon_name ("object-select-symbolic");
+    select_button.is_important = false;
+    select_button.set_halign (Align.END);
+    select_button.set_expand (true);
+    toolbar.add (select_button);
+    select_button.clicked.connect ( (button) => {
+      });
+
+    toolbar = new Toolbar ();
+    toolbar.set_icon_size (IconSize.MENU);
+    toolbar.get_style_context ().add_class (STYLE_CLASS_MENUBAR);
+    toolbar.set_vexpand (false);
+    toolbar.set_hexpand (true);
+    grid.attach (toolbar, 1, 0, 1, 1);
+
+    var share_button = new ToolButton (null, null);
+    share_button.margin_right = 4;
+    share_button.set_icon_name ("send-to-symbolic");
+    share_button.is_important = false;
+    share_button.set_halign (Align.END);
+    share_button.set_expand (true);
+    toolbar.add (share_button);
+    share_button.clicked.connect ( (button) => {
+      });
+
     var overlay = new Gtk.Overlay ();
     overlay.add (grid);
     Gdk.RGBA transparent = { 0, 0, 0, 0 };
@@ -261,12 +304,8 @@ public class Contacts.App : Gtk.Application {
 
     list_pane = new ListPane (contacts_store);
     list_pane.selection_changed.connect (selection_changed);
-    list_pane.create_new.connect ( () => {
-	var dialog = new NewContactDialog (contacts_store, window);
-	dialog.show_all ();
-      });
 
-    grid.attach (list_pane, 0, 0, 1, 2);
+    grid.attach (list_pane, 0, 1, 1, 1);
 
     contacts_pane = new ContactPane (contacts_store);
     contacts_pane.set_hexpand (true);
@@ -295,7 +334,7 @@ public class Contacts.App : Gtk.Application {
       });
       overlay.add_overlay (notification);
     });
-    grid.attach (contacts_pane, 1, 0, 1, 2);
+    grid.attach (contacts_pane, 1, 1, 1, 1);
 
     overlay.show_all ();
   }
diff --git a/src/contacts-list-pane.vala b/src/contacts-list-pane.vala
index fa06b41..4f0ec43 100644
--- a/src/contacts-list-pane.vala
+++ b/src/contacts-list-pane.vala
@@ -30,7 +30,6 @@ public class Contacts.ListPane : Frame {
   private bool ignore_selection_change;
 
   public signal void selection_changed (Contact? contact);
-  public signal void create_new ();
 
   private void refilter () {
     string []? values;
@@ -98,18 +97,6 @@ public class Contacts.ListPane : Frame {
     separator.set_draw (false);
     toolbar.add (separator);
 
-    var add_button = new ToolButton (null, null);
-    add_button.set_icon_name ("list-add-symbolic");
-    add_button.get_style_context ().add_class (STYLE_CLASS_RAISED);
-    add_button.is_important = false;
-    // We make the button slightly wider to look better since it
-    // becomes taller when added to the toolbar
-    add_button.set_size_request (34, -1);
-    toolbar.add (add_button);
-    add_button.clicked.connect ( (button) => {
-	create_new ();
-      });
-
     this.set_size_request (315, -1);
     this.set_hexpand (false);
 



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