Merge lp:~nick-dedekind/unity/Dash.remove-legal-link into lp:unity

Proposed by Nick Dedekind
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 3415
Proposed branch: lp:~nick-dedekind/unity/Dash.remove-legal-link
Merge into: lp:unity
Diff against target: 187 lines (+10/-102)
2 files modified
dash/ScopeBar.cpp (+10/-90)
dash/ScopeBar.h (+0/-12)
To merge this branch: bzr merge lp:~nick-dedekind/unity/Dash.remove-legal-link
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Marco Trevisan (Treviño) Approve
Review via email: mp+173722@code.launchpad.net

Commit message

Removed the legal link and icon from the dash.

Description of the change

Change
======
Removed the legal link and icon from the dash.

Reason
======
Not needed - approved by Thomas Strehl

Tests
======
None - removal of an untested UI element.

To post a comment you must log in.
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

for (auto icon: icons_) -> auto const&, could save few copies, but it's good enough.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'dash/ScopeBar.cpp'
2--- dash/ScopeBar.cpp 2013-04-17 15:10:39 +0000
3+++ dash/ScopeBar.cpp 2013-07-09 13:53:24 +0000
4@@ -46,12 +46,7 @@
5
6 ScopeBar::ScopeBar()
7 : nux::View(NUX_TRACKER_LOCATION)
8- , info_previously_shown_(false)
9 {
10- glib::String cachedir(g_strdup(g_get_user_cache_dir()));
11- legal_seen_file_path_ = cachedir.Str() + "/unitydashlegalseen";
12- info_previously_shown_ = (g_file_test(legal_seen_file_path_.c_str(), G_FILE_TEST_EXISTS)) ? true : false;
13-
14 SetupBackground();
15 SetupLayout();
16 }
17@@ -67,71 +62,14 @@
18
19 void ScopeBar::SetupLayout()
20 {
21- legal_layout_ = new nux::HLayout(NUX_TRACKER_LOCATION);
22- std::string legal_text("<span underline='single'>");
23- legal_text.append(g_dgettext("credentials-control-center", "Legal notice"));
24- legal_text.append("</span>");
25- legal_ = new StaticCairoText(legal_text);
26- legal_->SetFont("Ubuntu 14px");
27- legal_layout_->AddSpace(1, 1);
28- legal_layout_->SetLeftAndRightPadding(0, 10);
29- info_icon_ = new IconTexture(Style::Instance().GetInformationTexture(), 22, 22);
30- legal_layout_->AddView(info_icon_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
31- legal_layout_->AddView(legal_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
32-
33- info_icon_->SetVisible(info_previously_shown_);
34- legal_->SetVisible(!info_previously_shown_);
35-
36- info_icon_->mouse_click.connect([&] (int a, int b, unsigned long c, unsigned long d)
37- {
38- DoOpenLegalise();
39- });
40-
41- legal_->mouse_click.connect([&] (int a, int b, unsigned long c, unsigned long d)
42- {
43- info_previously_shown_ = true;
44-
45- info_icon_->SetVisible(info_previously_shown_);
46- legal_->SetVisible(!info_previously_shown_);
47-
48- DoOpenLegalise();
49- QueueRelayout();
50- QueueDraw();
51- });
52-
53-
54 layout_ = new nux::HLayout(NUX_TRACKER_LOCATION);
55 layout_->SetContentDistribution(nux::MAJOR_POSITION_CENTER);
56-
57- layered_layout_ = new nux::LayeredLayout();
58- layered_layout_->AddLayer(layout_);
59- layered_layout_->AddLayout(legal_layout_);
60- layered_layout_->SetPaintAll(true);
61- layered_layout_->SetInputMode(nux::LayeredLayout::InputMode::INPUT_MODE_COMPOSITE);
62+ SetLayout(layout_);
63
64- SetLayout(layered_layout_);
65-
66 SetMinimumHeight(SCOPEBAR_HEIGHT);
67 SetMaximumHeight(SCOPEBAR_HEIGHT);
68 }
69
70-void ScopeBar::DoOpenLegalise()
71-{
72- glib::Error error;
73- std::string legal_file_path = "file://";
74- legal_file_path.append(PKGDATADIR);
75- legal_file_path.append("/searchingthedashlegalnotice.html");
76- g_app_info_launch_default_for_uri(legal_file_path.c_str(), NULL, &error);
77- if (error)
78- {
79- LOG_ERROR(logger) << "Could not open legal uri: " << error.Message();
80- }
81-
82- g_creat(legal_seen_file_path_.c_str(), S_IRWXU);
83-
84- ubus_.SendMessage(UBUS_OVERLAY_CLOSE_REQUEST);
85-}
86-
87 void ScopeBar::AddScope(Scope::Ptr const& scope)
88 {
89 ScopeBarIcon* icon = new ScopeBarIcon(scope->id, scope->icon_hint);
90@@ -186,9 +124,12 @@
91 if (!IsFullRedraw())
92 {
93 if (RedirectedAncestor())
94- {
95- // Whole Scope bar needs to be cleared because the PaintAll forces redraw.
96- graphics::ClearGeometry(base);
97+ {
98+ for (auto icon: icons_)
99+ {
100+ if (icon->IsVisible() && icon->IsRedrawNeeded())
101+ graphics::ClearGeometry(icon->GetGeometry());
102+ }
103 }
104
105 if (bg_layer_)
106@@ -199,14 +140,14 @@
107 }
108 else
109 {
110- nux::GetPainter().PushPaintLayerStack();
111+ nux::GetPainter().PushPaintLayerStack();
112 }
113
114- GetLayout()->ProcessDraw(graphics_engine, true);
115+ GetLayout()->ProcessDraw(graphics_engine, force_draw);
116
117 if (IsFullRedraw())
118 {
119- nux::GetPainter().PopPaintLayerStack();
120+ nux::GetPainter().PopPaintLayerStack();
121 }
122 else if (pushed_paint_layers > 0)
123 {
124@@ -237,27 +178,6 @@
125 graphics_engine.PopClippingRectangle();
126 }
127
128-nux::Area* ScopeBar::FindAreaUnderMouse(const nux::Point& mouse_position, nux::NuxEventType event_type)
129-{
130- //LayeredLayout is acting a little screwy, events are not passing past the first layout like instructed,
131- //so we manually override if the cursor is on the right hand side of the scopebar
132- auto geo = GetAbsoluteGeometry();
133- int info_width = (info_previously_shown_) ? info_icon_->GetGeometry().width : legal_->GetGeometry().width;
134-
135- if (mouse_position.x - geo.x < geo.width - info_width - 10)
136- {
137- return nux::View::FindAreaUnderMouse(mouse_position, event_type);
138- }
139- else
140- {
141- if (info_previously_shown_)
142- return dynamic_cast<nux::Area*>(info_icon_);
143- else
144- return dynamic_cast<nux::Area*>(legal_);
145- }
146-
147-}
148-
149 void ScopeBar::SetActive(ScopeBarIcon* activated)
150 {
151 bool state_changed = false;
152
153=== modified file 'dash/ScopeBar.h'
154--- dash/ScopeBar.h 2013-04-17 15:10:39 +0000
155+++ dash/ScopeBar.h 2013-07-09 13:53:24 +0000
156@@ -69,13 +69,10 @@
157 private:
158 void SetupBackground();
159 void SetupLayout();
160- void DoOpenLegalise();
161
162 void Draw(nux::GraphicsEngine& gfx_context, bool force_draw);
163 void DrawContent(nux::GraphicsEngine& gfx_context, bool force_draw);
164
165- nux::Area* FindAreaUnderMouse(const nux::Point& mouse_position, nux::NuxEventType event_type);
166-
167 void SetActive(ScopeBarIcon* icon);
168
169 bool AcceptKeyNavFocus();
170@@ -86,17 +83,8 @@
171
172 ScopeIcons icons_;
173
174- UBusManager ubus_;
175-
176- nux::LayeredLayout* layered_layout_;
177- nux::HLayout *legal_layout_;
178- unity::StaticCairoText *legal_;
179 nux::HLayout* layout_;
180 LayerPtr bg_layer_;
181- IconTexture* info_icon_;
182-
183- bool info_previously_shown_;
184- std::string legal_seen_file_path_;
185
186 friend class TestScopeBar;
187 };