Merge lp:~jbicha/activity-log-manager/add-search-tab into lp:activity-log-manager

Proposed by Jeremy Bícha
Status: Merged
Merged at revision: 73
Proposed branch: lp:~jbicha/activity-log-manager/add-search-tab
Merge into: lp:activity-log-manager
Diff against target: 161 lines (+107/-0)
5 files modified
po/POTFILES.in (+1/-0)
po/POTFILES.skip (+1/-0)
src/Makefile.am (+1/-0)
src/activity-log-manager.vala (+5/-0)
src/searchresults-widget.vala (+99/-0)
To merge this branch: bzr merge lp:~jbicha/activity-log-manager/add-search-tab
Reviewer Review Type Date Requested Status
Manish Sinha (मनीष सिन्हा) Approve
Review via email: mp+173393@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote :

I was thinking if instead of having a separate Search Results tab, why not have it under Security. That tab can contain Scopes enable/disable too.

review: Needs Information
Revision history for this message
Manish Sinha (मनीष सिन्हा) (manishsinha) wrote :

Clarified. Search Results will contain Online Search enable/disable as well as scopes enable/disable

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'po/POTFILES.in'
2--- po/POTFILES.in 2013-07-07 19:51:19 +0000
3+++ po/POTFILES.in 2013-07-08 01:40:35 +0000
4@@ -3,6 +3,7 @@
5 src/activity-log-manager.vala
6 src/alm.vala
7 src/alm-cc.c
8+src/searchresults-widget.vala
9 src/security-widget.vala
10 src/unified-privacy-files.vala
11 src/unified-privacy-applications.vala
12
13=== modified file 'po/POTFILES.skip'
14--- po/POTFILES.skip 2013-07-07 19:51:19 +0000
15+++ po/POTFILES.skip 2013-07-08 01:40:35 +0000
16@@ -1,5 +1,6 @@
17 src/activity-log-manager.c
18 src/alm.c
19+src/searchresults-widget.c
20 src/security-widget.c
21 src/unified-privacy-applications.c
22 src/unified-privacy-history.c
23
24=== modified file 'src/Makefile.am'
25--- src/Makefile.am 2013-07-07 22:55:28 +0000
26+++ src/Makefile.am 2013-07-08 01:40:35 +0000
27@@ -24,6 +24,7 @@
28 SHARED_SOURCES = \
29 blacklist-dbus.vala \
30 activity-log-manager.vala \
31+ searchresults-widget.vala \
32 security-widget.vala \
33 unified-privacy-files.vala \
34 unified-privacy-applications.vala \
35
36=== modified file 'src/activity-log-manager.vala'
37--- src/activity-log-manager.vala 2013-07-07 22:55:28 +0000
38+++ src/activity-log-manager.vala 2013-07-08 01:40:35 +0000
39@@ -29,6 +29,7 @@
40 public class ActivityLogManager : Gtk.Box {
41 private Gtk.Notebook notebook;
42 private SecurityWidget security_widget;
43+ private SearchResultsWidget searchresults_widget;
44 private PrivacyWidget privacy_widget;
45 private Gtk.Widget whoopsie;
46
47@@ -53,6 +54,10 @@
48 security_widget = new SecurityWidget();
49 var security_label = new Gtk.Label(_("Security"));
50 notebook.prepend_page(security_widget, security_label);
51+
52+ searchresults_widget = new SearchResultsWidget();
53+ var searchresults_label = new Gtk.Label(_("Search"));
54+ notebook.append_page(searchresults_widget, searchresults_label);
55 }
56
57 #if DIAGNOSTIC
58
59=== added file 'src/searchresults-widget.vala'
60--- src/searchresults-widget.vala 1970-01-01 00:00:00 +0000
61+++ src/searchresults-widget.vala 2013-07-08 01:40:35 +0000
62@@ -0,0 +1,99 @@
63+/* -*- Mode: vala; tab-width: 4; intend-tabs-mode: t -*- */
64+/* alm
65+ *
66+ * Copyright (C) 2012 Canonical
67+ * Authored by: Didier Roche <didrocks@ubuntu.com>
68+ *
69+ * alm is free software: you can redistribute it and/or modify it
70+ * under the terms of the GNU Lesser General Public License as published
71+ * by the Free Software Foundation, either version 2 of the License, or
72+ * (at your option) any later version.
73+ *
74+ * alm is distributed in the hope that it will be useful, but
75+ * WITHOUT ANY WARRANTY; without even the implied warranty of
76+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
77+ * See the GNU Lesser General Public License for more details.
78+ *
79+ * You should have received a copy of the GNU Lesser General Public License
80+ * along with this program. If not, see <http://www.gnu.org/licenses/>.";
81+ */
82+
83+using Gtk;
84+using Gee;
85+
86+namespace Alm {
87+
88+ public class SearchResultsWidget : Gtk.Box {
89+
90+ private GLib.Settings gp_settings;
91+ private const string REMOTE_CONTENT_KEY = "remote-content-search";
92+
93+ public enum RemoteContent
94+ {
95+ ALL,
96+ NONE,
97+ }
98+
99+ Switch commercial_suggestion;
100+
101+ public SearchResultsWidget () {
102+ Object (orientation: Orientation.VERTICAL);
103+ this.spacing = 0;
104+ this.set_border_width(12);
105+
106+ this.gp_settings = new GLib.Settings ("com.canonical.Unity.Lenses");
107+ this.gp_settings.bind (REMOTE_CONTENT_KEY, this, "remote-content-search", SettingsBindFlags.DEFAULT);
108+
109+ this.set_up_ui ();
110+ }
111+
112+ public RemoteContent remote_content_search { get; set; default = RemoteContent.ALL; }
113+
114+
115+ public void set_up_ui () {
116+ var top_box = new Box(Orientation.HORIZONTAL, 21);
117+ top_box.set_margin_top(9);
118+ this.pack_start(top_box, false, false);
119+
120+ var text_box = new Box(Orientation.VERTICAL, 0);
121+ var header = new Label("");
122+ header.set_markup("<b>%s</b>".printf(_("When searching in the Dash:")));
123+ header.set_alignment(0, (float)0.5);
124+ header.set_padding(0, 0);
125+
126+ text_box.pack_start(header, false, false);
127+
128+ var label = new Label(null);
129+ label.set_markup("%s".printf(_("Include online search results")));
130+ label.set_line_wrap(true);
131+ label.set_line_wrap_mode(Pango.WrapMode.WORD);
132+ label.set_alignment(0, 0.5f);
133+ text_box.pack_start(label, false, false, 6);
134+ top_box.pack_start(text_box, false, false);
135+
136+ commercial_suggestion = new Switch();
137+ if (this.remote_content_search == RemoteContent.ALL)
138+ commercial_suggestion.set_active(true);
139+ commercial_suggestion.notify["active"].connect(on_commercial_suggestion_activated);
140+
141+ var temp_box = new Box(Orientation.VERTICAL, 0);
142+ temp_box.pack_start(new Label(""), true, true);
143+ temp_box.pack_start(commercial_suggestion, false, false);
144+ temp_box.pack_start(new Label(""), true, true);
145+ top_box.pack_end(temp_box, false, false);
146+
147+ }
148+
149+ public void on_commercial_suggestion_activated() {
150+ if (this.commercial_suggestion.get_active())
151+ {
152+ this.remote_content_search = RemoteContent.ALL;
153+ }
154+ else
155+ {
156+ this.remote_content_search = RemoteContent.NONE;
157+ }
158+ }
159+
160+ }
161+}

Subscribers

People subscribed via source and target branches