Merge lp:~sil2100/unity/dash-legal-link-trunk into lp:unity

Proposed by Łukasz Zemczak
Status: Merged
Approved by: Francis Ginther
Approved revision: no longer in the source branch.
Merged at revision: 2965
Proposed branch: lp:~sil2100/unity/dash-legal-link-trunk
Merge into: lp:unity
Diff against target: 304 lines (+138/-8)
6 files modified
dash/LensBar.cpp (+94/-5)
dash/LensBar.h (+19/-2)
resources/information_icon.svg (+14/-0)
resources/searchingthedashlegalnotice.html (+1/-0)
unity-shared/DashStyle.cpp (+7/-0)
unity-shared/DashStyle.h (+3/-1)
To merge this branch: bzr merge lp:~sil2100/unity/dash-legal-link-trunk
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Needs Fixing
Francis Ginther Approve
Review via email: mp+139012@code.launchpad.net

Commit message

Re-merged gord's changes for legal link: adds a legal link to the dash.

Description of the change

Re-merged gord's branch: https://code.launchpad.net/~gordallott/unity/dash-legal-link/+merge/129235

Original description:

adds a legal link to the dash, also a new resource

To post a comment you must log in.
Revision history for this message
Francis Ginther (fginther) wrote :

Verified that this is identical to gord's original branch which was reviewed and approved, but never merged. Approving.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Francis Ginther (fginther) wrote :

Re-approving. Autolanding failed due to a API change with compiz that was not yet reflected in unity. The API change has been resolved.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'dash/LensBar.cpp'
2--- dash/LensBar.cpp 2012-11-19 18:54:19 +0000
3+++ dash/LensBar.cpp 2012-12-10 15:45:17 +0000
4@@ -16,11 +16,17 @@
5 * Authored by: Neil Jagdish Patel <neil.patel@canonical.com>
6 */
7
8+#include <glib/gstdio.h>
9+#include "LensBar.h"
10 #include <NuxCore/Logger.h>
11 #include "config.h"
12+#include <Nux/HLayout.h>
13+#include <Nux/LayeredLayout.h>
14
15+#include "unity-shared/DashStyle.h"
16+#include "unity-shared/StaticCairoText.h"
17 #include "unity-shared/CairoTexture.h"
18-#include "LensBar.h"
19+#include "unity-shared/UBusMessages.h"
20
21 namespace unity
22 {
23@@ -39,7 +45,12 @@
24
25 LensBar::LensBar()
26 : nux::View(NUX_TRACKER_LOCATION)
27+ , info_previously_shown_(false)
28 {
29+ glib::String cachedir(g_strdup(g_get_user_cache_dir()));
30+ legal_seen_file_path_ = cachedir.Str() + "/unitydashlegalseen";
31+ info_previously_shown_ = (g_file_test(legal_seen_file_path_.c_str(), G_FILE_TEST_EXISTS)) ? true : false;
32+
33 SetupBackground();
34 SetupLayout();
35 SetupHomeLens();
36@@ -56,10 +67,50 @@
37
38 void LensBar::SetupLayout()
39 {
40+ legal_layout_ = new nux::HLayout(NUX_TRACKER_LOCATION);
41+ std::string legal_text("<span underline='single'>");
42+ legal_text.append(g_dgettext("credentials-control-center", "Legal notice"));
43+ legal_text.append("</span>");
44+ legal_ = new nux::StaticCairoText(legal_text);
45+ legal_->SetFont("Ubuntu 14px");
46+ legal_layout_->AddSpace(1, 1);
47+ legal_layout_->SetLeftAndRightPadding(0, 10);
48+ info_icon_ = new IconTexture(Style::Instance().GetInformationTexture(), 22, 22);
49+ legal_layout_->AddView(info_icon_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
50+ legal_layout_->AddView(legal_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
51+
52+ info_icon_->SetVisible(info_previously_shown_);
53+ legal_->SetVisible(!info_previously_shown_);
54+
55+ info_icon_->mouse_click.connect([&] (int a, int b, unsigned long c, unsigned long d)
56+ {
57+ DoOpenLegalise();
58+ });
59+
60+ legal_->mouse_click.connect([&] (int a, int b, unsigned long c, unsigned long d)
61+ {
62+ info_previously_shown_ = true;
63+
64+ info_icon_->SetVisible(info_previously_shown_);
65+ legal_->SetVisible(!info_previously_shown_);
66+
67+ DoOpenLegalise();
68+ QueueRelayout();
69+ QueueDraw();
70+ });
71+
72+
73 layout_ = new nux::HLayout(NUX_TRACKER_LOCATION);
74 layout_->SetContentDistribution(nux::MAJOR_POSITION_CENTER);
75- SetLayout(layout_);
76+
77+ layered_layout_ = new nux::LayeredLayout();
78+ layered_layout_->AddLayer(layout_);
79+ layered_layout_->AddLayout(legal_layout_);
80+ layered_layout_->SetPaintAll(true);
81+ layered_layout_->SetInputMode(nux::LayeredLayout::InputMode::INPUT_MODE_COMPOSITE);
82
83+ SetLayout(layered_layout_);
84+
85 SetMinimumHeight(LENSBAR_HEIGHT);
86 SetMaximumHeight(LENSBAR_HEIGHT);
87 }
88@@ -77,6 +128,23 @@
89 icon->key_nav_focus_activate.connect([&, icon](nux::Area*){ SetActive(icon); });
90 }
91
92+void LensBar::DoOpenLegalise()
93+{
94+ glib::Error error;
95+ std::string legal_file_path = "file://";
96+ legal_file_path.append(PKGDATADIR);
97+ legal_file_path.append("/searchingthedashlegalnotice.html");
98+ g_app_info_launch_default_for_uri(legal_file_path.c_str(), NULL, &error);
99+ if (error)
100+ {
101+ LOG_ERROR(logger) << "Could not open legal uri: " << error.Message();
102+ }
103+
104+ g_creat(legal_seen_file_path_.c_str(), S_IRWXU);
105+
106+ ubus_.SendMessage(UBUS_PLACE_VIEW_CLOSE_REQUEST);
107+}
108+
109 void LensBar::AddLens(Lens::Ptr& lens)
110 {
111 LensBarIcon* icon = new LensBarIcon(lens->id, lens->icon_hint);
112@@ -110,7 +178,7 @@
113
114 bg_layer_->SetGeometry(base);
115 nux::GetPainter().RenderSinglePaintLayer(graphics_engine, base, bg_layer_.get());
116-
117+
118 graphics_engine.PopClippingRectangle();
119 }
120
121@@ -137,11 +205,11 @@
122 }
123 else if (!IsFullRedraw())
124 {
125- ++pushed_paint_layers;
126+ pushed_paint_layers += 2;
127 nux::GetPainter().PushLayer(graphics_engine, bg_layer_->GetGeometry(), bg_layer_.get());
128 }
129
130- layout_->ProcessDraw(graphics_engine, true);
131+ GetLayout()->ProcessDraw(graphics_engine, true);
132
133 if (pushed_paint_layers)
134 nux::GetPainter().PopBackground(pushed_paint_layers);
135@@ -170,6 +238,27 @@
136 graphics_engine.PopClippingRectangle();
137 }
138
139+nux::Area* LensBar::FindAreaUnderMouse(const nux::Point& mouse_position, nux::NuxEventType event_type)
140+{
141+ //LayeredLayout is acting a little screwy, events are not passing past the first layout like instructed,
142+ //so we manually override if the cursor is on the right hand side of the lensbar
143+ auto geo = GetAbsoluteGeometry();
144+ int info_width = (info_previously_shown_) ? info_icon_->GetGeometry().width : legal_->GetGeometry().width;
145+
146+ if (mouse_position.x - geo.x < geo.width - info_width - 10)
147+ {
148+ return nux::View::FindAreaUnderMouse(mouse_position, event_type);
149+ }
150+ else
151+ {
152+ if (info_previously_shown_)
153+ return dynamic_cast<nux::Area*>(info_icon_);
154+ else
155+ return dynamic_cast<nux::Area*>(legal_);
156+ }
157+
158+}
159+
160 void LensBar::SetActive(LensBarIcon* activated)
161 {
162 bool state_changed = false;
163
164=== modified file 'dash/LensBar.h'
165--- dash/LensBar.h 2012-11-06 18:19:09 +0000
166+++ dash/LensBar.h 2012-12-10 15:45:17 +0000
167@@ -25,21 +25,27 @@
168
169 #include <NuxGraphics/GraphicsEngine.h>
170 #include <Nux/Nux.h>
171-#include <Nux/HLayout.h>
172+#include <Nux/PaintLayer.h>
173 #include <Nux/View.h>
174 #include <UnityCore/Lens.h>
175
176 #include "unity-shared/IconTexture.h"
177 #include "unity-shared/Introspectable.h"
178+#include "unity-shared/UBusWrapper.h"
179 #include "LensBarIcon.h"
180
181 namespace nux
182 {
183 class AbstractPaintLayer;
184+class HLayout;
185+class LayeredLayout;
186+class StaticCairoText;
187 }
188
189 namespace unity
190 {
191+class IconTexture;
192+
193 namespace dash
194 {
195
196@@ -62,24 +68,35 @@
197 void SetupBackground();
198 void SetupLayout();
199 void SetupHomeLens();
200+ void DoOpenLegalise();
201
202 void Draw(nux::GraphicsEngine& gfx_context, bool force_draw);
203 void DrawContent(nux::GraphicsEngine& gfx_context, bool force_draw);
204
205+ nux::Area* FindAreaUnderMouse(const nux::Point& mouse_position, nux::NuxEventType event_type);
206+
207 void SetActive(LensBarIcon* icon);
208
209 bool AcceptKeyNavFocus();
210 std::string GetName() const;
211 void AddProperties(GVariantBuilder* builder);
212
213-private:
214 std::string GetActiveLensId() const;
215 typedef std::unique_ptr<nux::AbstractPaintLayer> LayerPtr;
216
217 LensIcons icons_;
218
219+ UBusManager ubus_;
220+
221+ nux::LayeredLayout* layered_layout_;
222+ nux::HLayout *legal_layout_;
223+ nux::StaticCairoText *legal_;
224 nux::HLayout* layout_;
225 LayerPtr bg_layer_;
226+ IconTexture* info_icon_;
227+
228+ bool info_previously_shown_;
229+ std::string legal_seen_file_path_;
230 };
231
232 } // namespace dash
233
234=== added file 'resources/information_icon.svg'
235--- resources/information_icon.svg 1970-01-01 00:00:00 +0000
236+++ resources/information_icon.svg 2012-12-10 15:45:17 +0000
237@@ -0,0 +1,14 @@
238+<?xml version="1.0" encoding="utf-8"?>
239+<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
240+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
241+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
242+ width="22px" height="22px" viewBox="0 0 22 22" enable-background="new 0 0 22 22" xml:space="preserve">
243+<g>
244+ <g>
245+ <path fill="#FFFFFF" d="M11,2c-4.971,0-9,4.03-9,9s4.029,9,9,9s9-4.03,9-9S15.971,2,11,2z M12.007,17.01h-2.004V9.001h2.004V17.01
246+ z M11.877,6.903c-0.245,0.224-0.534,0.336-0.868,0.336c-0.346,0-0.64-0.112-0.885-0.336C9.88,6.68,9.757,6.378,9.757,5.998
247+ c0-0.392,0.123-0.699,0.367-0.924c0.245-0.223,0.539-0.335,0.885-0.335c0.334,0,0.623,0.112,0.868,0.335
248+ c0.244,0.225,0.366,0.532,0.366,0.924C12.243,6.378,12.121,6.68,11.877,6.903z"/>
249+ </g>
250+</g>
251+</svg>
252
253=== added file 'resources/searchingthedashlegalnotice.html'
254--- resources/searchingthedashlegalnotice.html 1970-01-01 00:00:00 +0000
255+++ resources/searchingthedashlegalnotice.html 2012-12-10 15:45:17 +0000
256@@ -0,0 +1,1 @@
257+<html><head><title>searching the dash legal notice</title><style type="text/css">ol{margin:0;padding:0}.c0{color:#000080;font-family:"Ubuntu";text-decoration:underline}.c8{list-style-type:disc;margin:0;padding:0}.c4{color:#1155cc;font-family:"Ubuntu";text-decoration:underline}.c10{max-width:499.5pt;background-color:#ffffff;padding:72pt 58.5pt 72pt 54pt}.c1{color:inherit;text-decoration:inherit}.c7{padding-left:0pt;margin-left:36pt}.c6{font-weight:bold}.c9{text-align:center}.c2{direction:ltr}.c5{font-family:"Ubuntu"}.c3{height:11pt}.title{padding-top:24pt;line-height:1.15;text-align:left;color:#000000;font-size:36pt;font-family:"Arial";font-weight:bold;padding-bottom:6pt}.subtitle{padding-top:18pt;line-height:1.15;text-align:left;color:#666666;font-style:italic;font-size:24pt;font-family:"Georgia";padding-bottom:4pt}li{color:#000000;font-size:11pt;font-family:"Arial"}p{color:#000000;font-size:11pt;margin:0;font-family:"Arial"}h1{padding-top:24pt;line-height:1.15;text-align:left;color:#000000;font-size:18pt;font-family:"Arial";font-weight:bold;padding-bottom:6pt}h2{padding-top:18pt;line-height:1.15;text-align:left;color:#000000;font-size:14pt;font-family:"Arial";font-weight:bold;padding-bottom:4pt}h3{padding-top:14pt;line-height:1.15;text-align:left;color:#666666;font-size:12pt;font-family:"Arial";font-weight:bold;padding-bottom:4pt}h4{padding-top:12pt;line-height:1.15;text-align:left;color:#666666;font-style:italic;font-size:11pt;font-family:"Arial";padding-bottom:2pt}h5{padding-top:11pt;line-height:1.15;text-align:left;color:#666666;font-size:10pt;font-family:"Arial";font-weight:bold;padding-bottom:2pt}h6{padding-top:10pt;line-height:1.15;text-align:left;color:#666666;font-style:italic;font-size:10pt;font-family:"Arial";padding-bottom:2pt}</style></head><body class="c10"><p class="c2 c9"><span class="c5">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="c6 c5">Searching in the dash - Legal notice</span></p><p class="c2 c3"><span class="c6 c5"></span></p><p class="c2"><span class="c5">This search function is provided to you by Canonical Group Limited (Canonical). This legal notice applies to searching in the dash and incorporates the terms of Canonical&#39;s</span><span class="c0">&nbsp;</span><span class="c4"><a class="c1" href="http://www.canonical.com/legal">legal notice</a></span><span class="c0">&nbsp;</span><span class="c5">(and privacy policy). </span></p><p class="c2 c3"><span class="c5"></span></p><p class="c2"><span class="c6 c5">Collection and use of data</span></p><p class="c2"><span class="c5">When you enter a search term into the dash Ubuntu will search your Ubuntu computer and will record the search terms locally. </span></p><p class="c2 c3"><span class="c5"></span></p><p class="c2"><span class="c5">Unless you have opted out (see the &ldquo;Online Search&rdquo; section below), we will also send your keystrokes as a search term to productsearch.ubuntu.com and selected third parties so that we may complement your search results with online search results from such third parties including: Facebook, Twitter, BBC and Amazon. Canonical and these selected third parties will collect your search terms and use them to provide you with search results while using Ubuntu. </span></p><p class="c2 c3"><span class="c5"></span></p><p class="c2"><span class="c5">By searching in the dash you consent to:</span></p><p class="c2 c3"><span class="c5"></span></p><ol class="c8" start="1"><li class="c7 c2"><span class="c5">the collection and use of your search terms and IP address in this way; and</span></li><li class="c2 c7"><span class="c5">the storage of your search terms and IP address by Canonical and such selected third parties (if applicable).</span></li></ol><p class="c2 c3"><span class="c5"></span></p><p class="c2"><span class="c5">Canonical will only use your search terms and IP address in accordance with this legal notice and </span><span class="c4"><a class="c1" href="http://www.ubuntu.com/aboutus/privacypolicy">our privacy</a></span><span class="c4"><a class="c1" href="http://www.ubuntu.com/aboutus/privacypolicy">&nbsp;policy</a></span><span class="c5">.</span><span class="c5">&nbsp;Please see </span><span class="c4"><a class="c1" href="http://www.ubuntu.com/aboutus/privacypolicy">our privacy</a></span><span class="c4"><a class="c1" href="http://www.ubuntu.com/aboutus/privacypolicy">&nbsp;policy</a></span><span class="c5">&nbsp;</span><span class="c5">for further information about how Canonical protects your personal information. For information on how our selected third parties may use your information, please see their privacy policies.</span></p><p class="c2 c3"><span class="c5"></span></p><p class="c2"><span class="c6 c5">Online Search</span></p><p class="c2"><span class="c5">You may restrict your dash so that we don&rsquo;t send searches to third parties and you don&#39;t receive online search results. To do this go to the Privacy panel and toggle the &lsquo;Include online search results&rsquo; option to off. The Privacy panel can be found in your System Settings or via a dash search. For a current list of our selected third parties, please see </span><span class="c4"><a class="c1" href="http://www.ubuntu.com/privacypolicy/thirdparties">www.ubuntu.com/privacypolicy/thirdparties</a></span><span class="c5">.</span></p><p class="c2 c3"><span class="c5"></span></p><p class="c2"><span class="c5 c6">Changes</span></p><p class="c2"><span class="c5">Although most changes are likely to be minor, Canonical may change this legal notice from time to time, and at Canonical&#39;s sole discretion. Please check this page from time to time for any changes to this legal notice as we will not be able to notify you directly.</span></p><p class="c2 c3"><span class="c5"></span></p><p class="c2"><span class="c6 c5">How to contact us</span></p><p class="c2"><span class="c5">Please submit any questions or comments about searching in the dash or this legal notice by contacting us at the following address: Canonical Group Ltd, 5th Floor, Blue Fin Building, 110 Southwark Street, London, England, SE1 0SU.</span></p></body></html>
258
259=== modified file 'unity-shared/DashStyle.cpp'
260--- unity-shared/DashStyle.cpp 2012-11-06 18:19:09 +0000
261+++ unity-shared/DashStyle.cpp 2012-12-10 15:45:17 +0000
262@@ -220,6 +220,7 @@
263 LazyLoadTexture search_close_texture_;
264 LazyLoadTexture search_spin_texture_;
265
266+ LazyLoadTexture information_texture_;
267
268 LazyLoadTexture refine_gradient_corner_;
269 LazyLoadTexture refine_gradient_dash_;
270@@ -267,6 +268,7 @@
271 , search_circle_texture_("/search_circle.svg", 32)
272 , search_close_texture_("/search_close.svg", 32)
273 , search_spin_texture_("/search_spin.svg", 32)
274+ , information_texture_("/information_icon.svg")
275 , refine_gradient_corner_("/refine_gradient_corner.png")
276 , refine_gradient_dash_("/refine_gradient_dash.png")
277 , refine_gradient_no_refine_dash_("/refine_gradient_dash_no_refine.png")
278@@ -2210,6 +2212,11 @@
279 return pimpl->search_spin_texture_.texture();
280 }
281
282+nux::BaseTexture* Style::GetInformationTexture()
283+{
284+ return pimpl->information_texture_.texture();
285+}
286+
287 nux::BaseTexture* Style::GetRefineTextureCorner()
288 {
289 return pimpl->refine_gradient_corner_.texture();
290
291=== modified file 'unity-shared/DashStyle.h'
292--- unity-shared/DashStyle.h 2012-11-06 18:19:09 +0000
293+++ unity-shared/DashStyle.h 2012-12-10 15:45:17 +0000
294@@ -203,7 +203,9 @@
295 nux::BaseTexture* GetStarDeselectedIcon();
296 nux::BaseTexture* GetStarSelectedIcon();
297 nux::BaseTexture* GetStarHighlightIcon();
298-
299+
300+ nux::BaseTexture* GetInformationTexture();
301+
302 nux::BaseTexture* GetRefineTextureCorner();
303 nux::BaseTexture* GetRefineTextureDash();
304 nux::BaseTexture* GetRefineNoRefineTextureDash();