After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 660580 - Move shell contacts search closer to gnome-contacts
Move shell contacts search closer to gnome-contacts
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
: 660446 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2011-09-30 17:12 UTC by Matthias Clasen
Modified: 2011-10-05 19:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Move shell contacts search closer to gnome-contacts (3.67 KB, patch)
2011-09-30 17:12 UTC, Matthias Clasen
reviewed Details | Review
improve contacts display (1.09 KB, patch)
2011-09-30 22:54 UTC, Matthias Clasen
needs-work Details | Review
Move shell contacts search closer to gnome-contacts (4.95 KB, patch)
2011-10-04 17:39 UTC, Matthias Clasen
reviewed Details | Review
Move shell contacts search closer to gnome-contacts (5.00 KB, patch)
2011-10-05 15:37 UTC, Florian Müllner
committed Details | Review
contact-system: Add helper method to get a (display) email (3.53 KB, patch)
2011-10-05 18:24 UTC, Florian Müllner
committed Details | Review
contact-display: Try harder to display a meaningful name (1.85 KB, patch)
2011-10-05 18:26 UTC, Florian Müllner
committed Details | Review

Description Matthias Clasen 2011-09-30 17:12:40 UTC
This is more in line with what gnome-contacts does. I do get
more results with this, but unfortunately, the display side
is lacking, most contacts show up as 'Unknown / offline / X',
even though gnome-contacts manages to display meaningful information
for the same contacts.
Comment 1 Matthias Clasen 2011-09-30 17:12:42 UTC
Created attachment 197893 [details] [review]
Move shell contacts search closer to gnome-contacts
Comment 2 Julien Olivier 2011-09-30 17:22:08 UTC
*** Bug 660446 has been marked as a duplicate of this bug. ***
Comment 3 Matthias Clasen 2011-09-30 22:54:28 UTC
Created attachment 197925 [details] [review]
improve contacts display

The second patch is by Florian, and makes the visual appearance of eds contacts in the shell a lot nicer.
Comment 4 drago01 2011-10-01 09:13:05 UTC
Review of attachment 197893 [details] [review]:

::: src/shell-contact-system.c
@@ +132,3 @@
   gboolean have_im_substring = FALSE;
 
+

Useless whitespace.

@@ +151,3 @@
+	  p = strstr (name, term);
+	  if (p == name)
+	    have_alias_prefix = TRUE;

The "alias" in there does no longer match what it is used for (nick and name) ... can't think of a better name though.
Comment 5 drago01 2011-10-01 09:13:36 UTC
Review of attachment 197925 [details] [review]:

Looks good.
Comment 6 Matthias Clasen 2011-10-04 17:39:27 UTC
Created attachment 198235 [details] [review]
Move shell contacts search closer to gnome-contacts

Match folks' name and nick fields, in addition to alias,
and look at email addresses in addition to im addresses.
This is more in line with what gnome-contacts does.

To match this new usage, rename the ALIAS_..._WEIGHT and
IM_..._WEIGHT constants to NAME_ and ADDR_, respectively.
Comment 7 Florian Müllner 2011-10-04 21:15:22 UTC
Review of attachment 198235 [details] [review]:

Looks mostly good. I *think* folks_email_details_get_email_addresses() doesn't ref the return value, so the code should be fine - I have trouble to get my head around folks/gee memory management though, so take this with a grain of salt :-)

::: src/shell-contact-system.c
@@ +119,3 @@
   char *alias = shell_util_normalize_and_casefold (folks_alias_details_get_alias (FOLKS_ALIAS_DETAILS (individual)));
+  char *name = shell_util_normalize_and_casefold (folks_name_details_get_full_name (FOLKS_NAME_DETAILS (individual)));
+  char *nick = shell_util_normalize_and_casefold (folks_name_details_get_nickname (FOLKS_NAME_DETAILS (individual)));

Leaking name and nick
Comment 8 Florian Müllner 2011-10-05 01:08:21 UTC
Comment on attachment 197925 [details] [review]
improve contacts display

The contacts-display patch needs improving - when we only match an email address, it still shows up as "Unknown" (and folks/gee is awesome enough to not allow us to get that from JS :/)
Comment 9 Florian Müllner 2011-10-05 15:37:33 UTC
Created attachment 198348 [details] [review]
Move shell contacts search closer to gnome-contacts

Fixed leaking name/nick. I've confirmed with some folks hackers that memory is handled correctly for get_im_addresses()/get_email_addresses().
Comment 10 Florian Müllner 2011-10-05 18:24:55 UTC
Created attachment 198361 [details] [review]
contact-system: Add helper method to get a (display) email

Folks uses collection/set objects from libgee to store email addresses
associated with an individual. Unfortunately to extract addresses, parts
of libgee which are unusable from (introspected) bindings have to be
used[0], so add a helper method.

Note that no effort is made to ensure that the returned mail actually corresponds to the one we matched - neat as this would be, it'd require much more intrusive changes than just making sure that we display something better than "Unknown" in search results ...

[0] in particular gee_iterator_get(), which is annotated as
    "return: (transfer full): gpointer"
Comment 11 Florian Müllner 2011-10-05 18:26:15 UTC
Created attachment 198362 [details] [review]
contact-display: Try harder to display a meaningful name

We now match individuals on other properties than alias, so take
this into account when representing a contact in search results
to avoid having them show up as "Unknown".

Updated the previous patch to also try an email before falling back to "Unknown".
Comment 12 drago01 2011-10-05 18:52:23 UTC
Review of attachment 198348 [details] [review]:

Looks good.
Comment 13 drago01 2011-10-05 18:56:43 UTC
Review of attachment 198361 [details] [review]:

Overall looks good, one leak needs to be fixed though.

::: src/shell-contact-system.c
@@ +362,3 @@
+    }
+
+  g_object_unref (addrs_iter);

Should unref email_addrs as well.
Comment 14 drago01 2011-10-05 18:57:38 UTC
Review of attachment 198362 [details] [review]:

Looks good.
Comment 15 Florian Müllner 2011-10-05 19:08:09 UTC
Attachment 198348 [details] pushed as 4ec5e55 - Move shell contacts search closer to gnome-contacts
Attachment 198361 [details] pushed as 503508a - contact-system: Add helper method to get a (display) email
Attachment 198362 [details] pushed as 0d5618f - contact-display: Try harder to display a meaningful name

(In reply to comment #13)
> Overall looks good, one leak needs to be fixed though.
> 
> ::: src/shell-contact-system.c
> @@ +362,3 @@
> +    }
> +
> +  g_object_unref (addrs_iter);
> 
> Should unref email_addrs as well.

Actually, no. folks_email_detail_get_email_addresses() returns a (transfer none) GeeSet, which is email_addrs. folks_im_detail_get_im_addresses() returns a (transfer none) GeeMultiMap, from which we get a (transfer full) GeeCollection, which is im_addrs. Yay for API consistency \o/