Merge lp:~rodrigo-moya/ubuntuone-client/allow-new-contact-with-selection into lp:ubuntuone-client

Proposed by Rodrigo Moya
Status: Merged
Approved by: dobey
Approved revision: 500
Merged at revision: not available
Proposed branch: lp:~rodrigo-moya/ubuntuone-client/allow-new-contact-with-selection
Merge into: lp:ubuntuone-client
Diff against target: 74 lines (+13/-1)
3 files modified
nautilus/contacts-view.c (+9/-0)
nautilus/contacts-view.h (+3/-0)
nautilus/u1-contacts-picker.c (+1/-1)
To merge this branch: bzr merge lp:~rodrigo-moya/ubuntuone-client/allow-new-contact-with-selection
Reviewer Review Type Date Requested Status
dobey (community) Approve
John Lenton (community) Approve
Review via email: mp+23536@code.launchpad.net

Commit message

Check number of matched contacts, not number of displayed contacts, to determine if there were no matches

Description of the change

Check number of matched contacts, not number of displayed contacts, to determine if there were no matches

To post a comment you must log in.
Revision history for this message
dobey (dobey) wrote :

Not sure what to review this as. The bug is of 'undecided' importance. And we're already past final freeze.

review: Needs Information
Revision history for this message
John Lenton (chipaca) wrote :

A nice, simple fix that improves the usability of the picker.

review: Approve
Revision history for this message
dobey (dobey) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'nautilus/contacts-view.c'
2--- nautilus/contacts-view.c 2010-04-14 12:21:23 +0000
3+++ nautilus/contacts-view.c 2010-04-16 11:55:30 +0000
4@@ -335,6 +335,7 @@
5 e_contact_get_const (contact, E_CONTACT_FULL_NAME),
6 email,
7 contact);
8+ cv->matched_contacts += 1;
9 }
10
11 g_list_foreach (emails_list, (GFunc) e_vcard_attribute_free, NULL);
12@@ -396,6 +397,7 @@
13 GError *error = NULL;
14 GSList *gl;
15
16+ cv->matched_contacts = 0;
17 cv->selection = g_hash_table_new_full (g_str_hash, g_str_equal,
18 (GDestroyNotify) g_free,
19 (GDestroyNotify) free_selected_contact_info);
20@@ -549,6 +551,7 @@
21 /* Reset the icon views */
22 gtk_list_store_clear (GTK_LIST_STORE (gtk_icon_view_get_model (GTK_ICON_VIEW (cv->recently_used_view))));
23 gtk_list_store_clear (GTK_LIST_STORE (gtk_icon_view_get_model (GTK_ICON_VIEW (cv->alphabetical_view))));
24+ cv->matched_contacts = 0;
25
26 g_signal_emit_by_name (cv, "contacts-count-changed",
27 gtk_tree_model_iter_n_children (gtk_icon_view_get_model (GTK_ICON_VIEW (cv->alphabetical_view)),
28@@ -600,6 +603,12 @@
29 NULL);
30 }
31
32+guint
33+contacts_view_get_matched_contacts_count (ContactsView *cv)
34+{
35+ return cv->matched_contacts;
36+}
37+
38 void
39 contacts_view_add_contact (ContactsView *cv, const gchar *contact_name, const gchar *contact_email)
40 {
41
42=== modified file 'nautilus/contacts-view.h'
43--- nautilus/contacts-view.h 2010-03-12 13:17:57 +0000
44+++ nautilus/contacts-view.h 2010-04-16 11:55:30 +0000
45@@ -48,6 +48,8 @@
46 /* Widgets */
47 GtkWidget *recently_used_view;
48 GtkWidget *alphabetical_view;
49+
50+ guint matched_contacts;
51 } ContactsView;
52
53 typedef struct {
54@@ -64,6 +66,7 @@
55 void contacts_view_search (ContactsView *cv, const gchar *search_string);
56 GSList *contacts_view_get_selected_emails (ContactsView *cv);
57 guint contacts_view_get_contacts_count (ContactsView *cv);
58+guint contacts_view_get_matched_contacts_count (ContactsView *cv);
59 void contacts_view_add_contact (ContactsView *cv, const gchar *contact_name, const gchar *contact_email);
60
61 #endif
62
63=== modified file 'nautilus/u1-contacts-picker.c'
64--- nautilus/u1-contacts-picker.c 2010-03-25 18:09:05 +0000
65+++ nautilus/u1-contacts-picker.c 2010-04-16 11:55:30 +0000
66@@ -84,7 +84,7 @@
67 contacts_view_search (CONTACTS_VIEW (picker->priv->contacts_view), text);
68
69 /* If no contacts offer the user to add it to the contacts database */
70- if (contacts_view_get_contacts_count (CONTACTS_VIEW (picker->priv->contacts_view)) == 0)
71+ if (contacts_view_get_matched_contacts_count (CONTACTS_VIEW (picker->priv->contacts_view)) == 0)
72 gtk_widget_show (picker->priv->add_contact_button);
73 else
74 gtk_widget_hide (picker->priv->add_contact_button);

Subscribers

People subscribed via source and target branches