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 745508 - Two fixes to the search provider
Two fixes to the search provider
Status: RESOLVED FIXED
Product: gnome-characters
Classification: Other
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: GNOME Characters maintainer(s)
GNOME Characters maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2015-03-03 09:47 UTC by Giovanni Campagna
Modified: 2015-10-09 21:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix the code point of characters outside the BMP (2.17 KB, patch)
2015-03-03 09:47 UTC, Giovanni Campagna
committed Details | Review
Default the search provider to enabled (974 bytes, patch)
2015-03-03 09:47 UTC, Giovanni Campagna
committed Details | Review
SearchProvider: use proper startup notification for launching search (1.85 KB, patch)
2015-03-03 10:04 UTC, Giovanni Campagna
committed Details | Review
SearchProvider: fix unbalanced hold() (915 bytes, patch)
2015-03-03 10:04 UTC, Giovanni Campagna
committed Details | Review
BackgroundService: don't unnecessarily override shutdown (882 bytes, patch)
2015-03-03 10:04 UTC, Giovanni Campagna
committed Details | Review
BackgroundService: reduce the inactivity timeout to 30s (1.30 KB, patch)
2015-03-03 10:04 UTC, Giovanni Campagna
committed Details | Review

Description Giovanni Campagna 2015-03-03 09:47:04 UTC
Neat app! I love it. But I found two small bugs in casual testing.
Comment 1 Giovanni Campagna 2015-03-03 09:47:06 UTC
Created attachment 298396 [details] [review]
Fix the code point of characters outside the BMP

Strings in JS are in UTF-16, so we need to resolve surrogate
pairs into full UTF-32 code points. We can't use glib functions
to do so because gunichar is translated back into a String by
gjs.
Comment 2 Giovanni Campagna 2015-03-03 09:47:09 UTC
Created attachment 298397 [details] [review]
Default the search provider to enabled

I would say this was copy-pasted from gnome-weather, where
default disabled is motivated by privacy concerns, but that
doesn't apply here.
Comment 3 Giovanni Campagna 2015-03-03 10:04:25 UTC
Created attachment 298400 [details] [review]
SearchProvider: use proper startup notification for launching search

This code was copied from gnome-weather, which explicitly tries to
avoid Gdk/Gtk+ in the background service (so that it could be
one day launched as a user service from systemd). But gnome-characters
initializes Gtk+ anyway to handle the clipboard, there is no
reason for degraded operation.
In particular, this gives a nice spinner while gnome-characters
starts up (which is almost invisible, but it can become visible
on a slow disk and cold cache)
Comment 4 Giovanni Campagna 2015-03-03 10:04:27 UTC
Created attachment 298401 [details] [review]
SearchProvider: fix unbalanced hold()

Each query call holds the app alive until the query done, so make
sure that is matched with a release(), otherwise the app never
dies.
Comment 5 Giovanni Campagna 2015-03-03 10:04:30 UTC
Created attachment 298402 [details] [review]
BackgroundService: don't unnecessarily override shutdown

GApplication complains if shutdown does not chain up. But since
we're doing nothing, we can just as well avoid the chain up.
Comment 6 Giovanni Campagna 2015-03-03 10:04:33 UTC
Created attachment 298403 [details] [review]
BackgroundService: reduce the inactivity timeout to 30s

gnome-characters does pretty much nothing during initialization:
its startup code is paging in the Unicode tables, so the tradeoff
is purely between disk access and memory usage.
By reducing the inactivity timeout we release memory more often
and let the kernel manage disk cache more effectively.
There should be no measurable CPU impact by this patch, because
the service should be sleeping most of the time anyway.
Comment 7 Daiki Ueno 2015-03-04 02:09:55 UTC
Review of attachment 298396 [details] [review]:

Oops - good point, thanks.
Comment 8 Daiki Ueno 2015-03-04 02:17:10 UTC
Review of attachment 298397 [details] [review]:

I left it disabled by default because the character search might not be very useful for normal users, but if there is no harm, it's fine to enable it.
Comment 9 Daiki Ueno 2015-03-04 02:17:59 UTC
Review of attachment 298400 [details] [review]:

Sure, nice.
Comment 10 Daiki Ueno 2015-03-04 02:19:44 UTC
Review of attachment 298401 [details] [review]:

Oops, good catch.
Comment 11 Daiki Ueno 2015-03-04 02:20:26 UTC
Review of attachment 298402 [details] [review]:

Sure.
Comment 12 Daiki Ueno 2015-03-04 02:23:19 UTC
Review of attachment 298403 [details] [review]:

Sure, thanks for the detailed explanation that sounds reasonable.
Comment 13 Giovanni Campagna 2015-03-04 02:55:07 UTC
Attachment 298396 [details] pushed as edd7c95 - Fix the code point of characters outside the BMP
Attachment 298397 [details] pushed as 9b1f2bc - Default the search provider to enabled
Attachment 298400 [details] pushed as 2d2752b - SearchProvider: use proper startup notification for launching search
Attachment 298401 [details] pushed as 032721b - SearchProvider: fix unbalanced hold()
Attachment 298402 [details] pushed as b034bd0 - BackgroundService: don't unnecessarily override shutdown
Attachment 298403 [details] pushed as ed45449 - BackgroundService: reduce the inactivity timeout to 30s
Comment 14 Michael Catanzaro 2015-10-09 21:09:50 UTC
(In reply to Daiki Ueno from comment #8)
> Review of attachment 298397 [details] [review] [review]:
> 
> I left it disabled by default because the character search might not be very
> useful for normal users, but if there is no harm, it's fine to enable it.

Note -- I've reverted this due to complaints from Fedora beta testers. I agree with Daiki, this is not really as generally useful as other search providers.
Comment 15 Giovanni Campagna 2015-10-09 21:28:44 UTC
Too bad, I find that Characters is the search provider I use the second most (after nautilus), to insert emojis, symbols or other characters.
Well, I can enable it, not a big deal :)
Comment 16 Michael Catanzaro 2015-10-09 21:34:38 UTC
I would also say: if it sorted at the bottom of the list, instead of the top (requires a bit of work in gnome-shell and gsettings-desktop-schemas), and matched only prefixes of words in the character name rather than any substring (currently it gives marginally-relevant results), then I think it would be fine to enable it again.