Merge lp:~desrt/indicator-appmenu/no-search-tokens into lp:indicator-appmenu/0.4

Proposed by Allison Lortie on 2012-04-04
Status: Merged
Approved by: Ted Gould on 2012-04-04
Approved revision: 199
Merged at revision: 200
Proposed branch: lp:~desrt/indicator-appmenu/no-search-tokens
Merge into: lp:indicator-appmenu/0.4
Diff against target: 38 lines (+8/-1)
3 files modified
src/hudquery.c (+1/-1)
src/hudtoken.c (+6/-0)
src/hudtoken.h (+1/-0)
To merge this branch: bzr merge lp:~desrt/indicator-appmenu/no-search-tokens
Reviewer Review Type Date Requested Status
Ted Gould (community) 2012-04-04 Approve on 2012-04-04
Review via email: mp+100801@code.launchpad.net

Description of the Change

hud-service: check for search with no tokens before searching

The search algorithm assumes that there will be at least one search
token, so be sure not to submit any searches with zero tokens. This can
happen if the user searches for " ", for example.

To post a comment you must log in.
Ted Gould (ted) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/hudquery.c'
2--- src/hudquery.c 2012-03-30 13:32:40 +0000
3+++ src/hudquery.c 2012-04-04 14:22:19 +0000
4@@ -107,7 +107,7 @@
5
6 g_ptr_array_set_size (query->results, 0);
7
8- if (query->search_string[0] != '\0')
9+ if (hud_token_list_get_length (query->token_list) != 0)
10 hud_source_search (query->source, query->results, query->token_list);
11
12 g_ptr_array_foreach (query->results, hud_query_find_max_usage, &max_usage);
13
14=== modified file 'src/hudtoken.c'
15--- src/hudtoken.c 2012-04-03 00:29:19 +0000
16+++ src/hudtoken.c 2012-04-04 14:22:19 +0000
17@@ -392,3 +392,9 @@
18
19 return d[needle->length - 1][haystack->length - 1];
20 }
21+
22+guint
23+hud_token_list_get_length (HudTokenList *list)
24+{
25+ return list->length;
26+}
27
28=== modified file 'src/hudtoken.h'
29--- src/hudtoken.h 2012-03-31 03:54:13 +0000
30+++ src/hudtoken.h 2012-04-04 14:22:19 +0000
31@@ -32,6 +32,7 @@
32
33 HudTokenList * hud_token_list_new_from_string (const gchar *string);
34 HudTokenList * hud_token_list_new_from_string_list (HudStringList *string_list);
35+guint hud_token_list_get_length (HudTokenList *list);
36 void hud_token_list_free (HudTokenList *list);
37 guint hud_token_list_distance (HudTokenList *haystack,
38 HudTokenList *needle,

Subscribers

People subscribed via source and target branches