Merge lp:~didrocks/gwibber/disable-online-search-support into lp:gwibber

Proposed by Didier Roche-Tolomelli
Status: Merged
Merged at revision: 1390
Proposed branch: lp:~didrocks/gwibber/disable-online-search-support
Merge into: lp:gwibber
Diff against target: 72 lines (+29/-1)
2 files modified
configure.ac (+1/-1)
lens/src/daemon.vala (+28/-0)
To merge this branch: bzr merge lp:~didrocks/gwibber/disable-online-search-support
Reviewer Review Type Date Requested Status
Ken VanDine Approve
Review via email: mp+126613@code.launchpad.net

Description of the change

Add disabling online search support (LP: #1054746)

To post a comment you must log in.
Revision history for this message
Ken VanDine (ken-vandine) wrote :

Looks good, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'configure.ac'
2--- configure.ac 2012-09-20 04:55:42 +0000
3+++ configure.ac 2012-09-27 07:14:33 +0000
4@@ -130,7 +130,7 @@
5 DBUSMENU_REQUIRED=0.4
6 INDICATE_REQUIRED=0.5
7 LIBNOTIFY_REQUIRED=0.7
8-UNITY_REQUIRED=6.5.1
9+UNITY_REQUIRED=6.7
10 PKG_CHECK_MODULES(BASE,
11 glib-2.0 >= $GLIB_REQUIRED
12 gobject-2.0 >= $GLIB_REQUIRED
13
14=== modified file 'lens/src/daemon.vala'
15--- lens/src/daemon.vala 2012-09-18 23:38:24 +0000
16+++ lens/src/daemon.vala 2012-09-27 07:14:33 +0000
17@@ -36,6 +36,7 @@
18 {
19 private Unity.Lens lens;
20 private Unity.Scope scope;
21+ private Unity.PreferencesManager preferences = Unity.PreferencesManager.get_default ();
22 private Gwibber.Streams streams_service;
23 private Gwibber.Service service;
24 private Gwibber.Accounts accounts;
25@@ -110,6 +111,11 @@
26 scope.queue_search_changed (SearchType.DEFAULT);
27 });
28
29+ preferences.notify["remote-content-search"].connect ((obj, pspec) =>
30+ {
31+ scope.queue_search_changed (SearchType.DEFAULT);
32+ });
33+
34 try
35 {
36 lens.export ();
37@@ -248,6 +254,17 @@
38
39 private async void update_global_search (LensSearch search, Cancellable cancellable)
40 {
41+ /**
42+ * only perform the request if the user has not disabled
43+ * online/commercial suggestions. That will hide the category as well.
44+ */
45+ if (preferences.remote_content_search != Unity.PreferencesManager.RemoteContent.ALL)
46+ {
47+ search.results_model.clear ();
48+ search.finished ();
49+ return;
50+ }
51+
52 var results_model = scope.global_results_model;
53
54 // FIXME: no results for home screen of the dash?
55@@ -264,6 +281,17 @@
56
57 private async void update_scope_search (LensSearch search, Cancellable cancellable)
58 {
59+ /**
60+ * only perform the request if the user has not disabled
61+ * online/commercial suggestions. That will hide the category as well.
62+ */
63+ if (preferences.remote_content_search != Unity.PreferencesManager.RemoteContent.ALL)
64+ {
65+ search.results_model.clear ();
66+ search.finished ();
67+ return;
68+ }
69+
70 var results_model = search.results_model;
71
72 update_results_model (results_model, search.search_string, null);