[gnome-contacts] Address Book dialog: updated UI



commit a8235c4646fd7e5085ea140abce728a5a68f536a
Author: Erick Pérez Castellanos <erick red gmail com>
Date:   Thu Apr 10 15:00:53 2014 -0400

    Address Book dialog: updated UI
    
    Fixed: https://bugzilla.gnome.org/show_bug.cgi?id=727804

 src/contacts-accounts-list.vala |   27 +++++++++++++---------
 src/contacts-app.vala           |   45 +++++++++++++++++---------------------
 2 files changed, 36 insertions(+), 36 deletions(-)
---
diff --git a/src/contacts-accounts-list.vala b/src/contacts-accounts-list.vala
index 1e3d501..ec0295e 100644
--- a/src/contacts-accounts-list.vala
+++ b/src/contacts-accounts-list.vala
@@ -30,17 +30,17 @@ public class Contacts.AccountsList : Grid {
 
   public AccountsList () {
     set_orientation (Orientation.VERTICAL);
-    set_row_spacing (22);
+    set_row_spacing (12);
 
     selected_store = null;
 
     accounts_view = new ListBox ();
     accounts_view.set_selection_mode (SelectionMode.NONE);
-    accounts_view.set_size_request (400, -1);
+    accounts_view.set_size_request (372, -1);
     accounts_view.set_header_func (update_header_func);
 
     var scrolled = new ScrolledWindow(null, null);
-    scrolled.set_min_content_height (260);
+    scrolled.set_min_content_height (210);
     scrolled.set_policy (PolicyType.NEVER, PolicyType.AUTOMATIC);
     scrolled.set_shadow_type (ShadowType.IN);
     scrolled.add (accounts_view);
@@ -73,13 +73,18 @@ public class Contacts.AccountsList : Grid {
     if (row == null)
       return;
 
+    if (last_selected_row != null &&
+        last_selected_row == row) {
+      return;
+    }
+
     var row_data = (row as Bin).get_child () as Grid;
     var checkmark = new Image.from_icon_name ("object-select-symbolic", IconSize.MENU);
-    checkmark.margin_end = 12;
-    checkmark.set_valign (Align.CENTER);
-    checkmark.set_halign (Align.END);
-    checkmark.set_vexpand (true);
-    checkmark.set_hexpand (true);
+    checkmark.set ("margin-end", 12,
+                   "valign", Align.CENTER,
+                   "halign", Align.END,
+                   "vexpand", true,
+                   "hexpand", true);
     checkmark.show ();
     row_data.attach (checkmark, 2, 0, 1, 2);
 
@@ -129,14 +134,14 @@ public class Contacts.AccountsList : Grid {
       row_data.set_data ("store", persona_store);
       row_data.margin = 6;
       row_data.margin_start = 5;
-      row_data.set_row_spacing (2);
+      row_data.set_row_spacing (1);
       row_data.set_column_spacing (10);
 
       if (source_account_id != "") {
         var provider_image = Contacts.get_icon_for_goa_account (source_account_id);
         row_data.attach (provider_image, 0, 0, 1, 2);
       } else {
-        var provider_image = new Image.from_icon_name ("drive-harddisk-system-symbolic",
+        var provider_image = new Image.from_icon_name ("x-office-address-book",
                                                        IconSize.DIALOG);
         row_data.attach (provider_image, 0, 0, 1, 2);
       }
@@ -169,7 +174,7 @@ public class Contacts.AccountsList : Grid {
     local_data.margin_start = 5;
     local_data.set_column_spacing (10);
     local_data.set_data ("store", local_store);
-    var provider_image = new Image.from_icon_name ("drive-harddisk-system-symbolic",
+    var provider_image = new Image.from_icon_name ("x-office-address-book",
                                                    IconSize.DIALOG);
     local_data.add (provider_image);
     var local_label = new Label (_("Local Address Book"));
diff --git a/src/contacts-app.vala b/src/contacts-app.vala
index 9c0e816..21d7da2 100644
--- a/src/contacts-app.vala
+++ b/src/contacts-app.vala
@@ -107,39 +107,34 @@ public class Contacts.App : Gtk.Application {
   }
 
   public void change_address_book () {
-    var dialog = new Dialog.with_buttons ("",
+    var dialog = new Dialog.with_buttons (_("Change Address Book"),
                                          (Window) window,
-                                         DialogFlags.MODAL | DialogFlags.DESTROY_WITH_PARENT,
+                                         DialogFlags.MODAL |
+                                         DialogFlags.DESTROY_WITH_PARENT |
+                                         DialogFlags.USE_HEADER_BAR,
+                                         _("Done"), ResponseType.OK,
+                                         _("Cancel"), ResponseType.CANCEL,
                                          null);
-    dialog.set_resizable (false);
-    dialog.set_border_width (36);
-
-    var header = new HeaderBar ();
-    header.set_title (_("Primary Contacts Account"));
-    header.get_style_context ().add_class ("titlebar");
 
-    var cancel_button = new Button.with_label (_("Cancel"));
-    cancel_button.valign = Gtk.Align.CENTER;
-    cancel_button.get_style_context ().add_class ("text-button");
-    cancel_button.clicked.connect (() => {
-       dialog.response (ResponseType.CANCEL);
-      });
-    header.pack_start (cancel_button);
-
-    var done_button = new Button.with_label (_("Done"));
-    done_button.valign = Gtk.Align.CENTER;
-    done_button.get_style_context ().add_class ("suggested-action");
-    done_button.get_style_context ().add_class ("text-button");
-    done_button.clicked.connect (() => {
-       dialog.response (ResponseType.OK);
-      });
-    header.pack_end (done_button);
+    var ok_button = dialog.get_widget_for_response (ResponseType.OK);
+    ok_button.sensitive = false;
+    ok_button.get_style_context ().add_class ("suggested-action");
+    dialog.set_resizable (false);
+    dialog.set_border_width (12);
 
-    dialog.set_titlebar (header);
+    var explanation_label = new Label (_("New contacts will be added to the selected address book.\nYou are 
able to view and edit contacts from other address books."));
+    (dialog.get_content_area () as Box).add (explanation_label);
+    (dialog.get_content_area () as Box).set_spacing (12);
 
     var acc = new AccountsList ();
     acc.update_contents (true);
 
+    ulong active_button_once = 0;
+    active_button_once = acc.account_selected.connect (() => {
+       ok_button.sensitive = true;
+       acc.disconnect (active_button_once);
+      });
+
     ulong stores_changed_id = contacts_store.eds_persona_store_changed.connect  ( () => {
        acc.update_contents (true);
       });


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