Merge lp:~junrrein/synapse-project/indicator-non-instant-search into lp:~elementary-apps/synapse-project/indicator-search

Proposed by Julián Unrrein
Status: Work in progress
Proposed branch: lp:~junrrein/synapse-project/indicator-non-instant-search
Merge into: lp:~elementary-apps/synapse-project/indicator-search
Diff against target: 39 lines (+12/-4)
1 file modified
src/indicator/menu.vala (+12/-4)
To merge this branch: bzr merge lp:~junrrein/synapse-project/indicator-non-instant-search
Reviewer Review Type Date Requested Status
elementary Apps team Pending
Review via email: mp+182796@code.launchpad.net

Commit message

Use Granite.Widgets.SeachBar instead of Gtk.Entry.

Description of the change

Use Granite.Widgets.SeachBar instead of Gtk.Entry.

This is how the indicator behaves in trunk -> http://videobin.org/+6ue/8bv.html.

Every time I press a letter key, the indicator starts searching, regardless of additional input. This makes it function slowly, and look wonky.

Also, notice that after clearing the entry, there are still search results being displayed.

This is how the indicator behaves in this branch -> http://videobin.org/+6ud/8bu.html

Granite's SearchBar triggers searching only when some time has passed since the last user input (300 milliseconds, in this case).

The indicator performs faster this way, and the results view is correctly cleared when the entry is empty.

To post a comment you must log in.
527. By Julián Unrrein

Replace spaces with tabs.

Revision history for this message
Tom Beckmann (tombeckmann) wrote :

The branch is set to "work in progress" for now, I hope we can get a different solution than delaying the search going to make the indicator more stable. If not, we'll merge this branch instead.

Unmerged revisions

527. By Julián Unrrein

Replace spaces with tabs.

526. By Julián Unrrein

Use Granite.Widgets.SeachBar instead of Gtk.Entry.
This makes the indicator search after a certain time has passed since user input.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/indicator/menu.vala'
2--- src/indicator/menu.vala 2013-08-21 08:54:19 +0000
3+++ src/indicator/menu.vala 2013-08-29 03:44:22 +0000
4@@ -11,9 +11,10 @@
5 reserve_toggle_size = false;
6 take_focus = true;
7
8- entry = new Gtk.Entry ();
9+ entry = new Granite.Widgets.SearchBar ("");
10+ (entry as Granite.Widgets.SearchBar).pause_delay = 300;
11
12- entry.primary_icon_name = "edit-find-symbolic";
13+ //entry.primary_icon_name = "edit-find-symbolic";
14 entry_item = new MatchItem ("Search:", entry, true);
15 append (entry_item);
16
17@@ -46,13 +47,20 @@
18 return true;
19 default:
20 entry.key_press_event (e);
21- if (entry.text == "")
22+ /*if (entry.text == "")
23 clear ();
24 else
25- search (entry.text);
26+ search (entry.text);*/
27 return true;
28 }
29 });
30+
31+ (entry as Granite.Widgets.SearchBar).text_changed_pause.connect (() => {
32+ if (entry.text == "")
33+ clear ();
34+ else
35+ search (entry.text);
36+ });
37
38 move_current.connect ((dir) => {
39 // see if the next item will be the search entry

Subscribers

People subscribed via source and target branches