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
=== modified file 'dash/ScopeBar.cpp'
--- dash/ScopeBar.cpp 2013-04-17 15:10:39 +0000
+++ dash/ScopeBar.cpp 2013-07-09 13:53:24 +0000
@@ -46,12 +46,7 @@
4646
47ScopeBar::ScopeBar()47ScopeBar::ScopeBar()
48 : nux::View(NUX_TRACKER_LOCATION)48 : nux::View(NUX_TRACKER_LOCATION)
49 , info_previously_shown_(false)
50{49{
51 glib::String cachedir(g_strdup(g_get_user_cache_dir()));
52 legal_seen_file_path_ = cachedir.Str() + "/unitydashlegalseen";
53 info_previously_shown_ = (g_file_test(legal_seen_file_path_.c_str(), G_FILE_TEST_EXISTS)) ? true : false;
54
55 SetupBackground();50 SetupBackground();
56 SetupLayout();51 SetupLayout();
57}52}
@@ -67,71 +62,14 @@
6762
68void ScopeBar::SetupLayout()63void ScopeBar::SetupLayout()
69{64{
70 legal_layout_ = new nux::HLayout(NUX_TRACKER_LOCATION);
71 std::string legal_text("<span underline='single'>");
72 legal_text.append(g_dgettext("credentials-control-center", "Legal notice"));
73 legal_text.append("</span>");
74 legal_ = new StaticCairoText(legal_text);
75 legal_->SetFont("Ubuntu 14px");
76 legal_layout_->AddSpace(1, 1);
77 legal_layout_->SetLeftAndRightPadding(0, 10);
78 info_icon_ = new IconTexture(Style::Instance().GetInformationTexture(), 22, 22);
79 legal_layout_->AddView(info_icon_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
80 legal_layout_->AddView(legal_, 0, nux::MINOR_POSITION_CENTER, nux::MINOR_SIZE_MATCHCONTENT);
81
82 info_icon_->SetVisible(info_previously_shown_);
83 legal_->SetVisible(!info_previously_shown_);
84
85 info_icon_->mouse_click.connect([&] (int a, int b, unsigned long c, unsigned long d)
86 {
87 DoOpenLegalise();
88 });
89
90 legal_->mouse_click.connect([&] (int a, int b, unsigned long c, unsigned long d)
91 {
92 info_previously_shown_ = true;
93
94 info_icon_->SetVisible(info_previously_shown_);
95 legal_->SetVisible(!info_previously_shown_);
96
97 DoOpenLegalise();
98 QueueRelayout();
99 QueueDraw();
100 });
101
102
103 layout_ = new nux::HLayout(NUX_TRACKER_LOCATION);65 layout_ = new nux::HLayout(NUX_TRACKER_LOCATION);
104 layout_->SetContentDistribution(nux::MAJOR_POSITION_CENTER);66 layout_->SetContentDistribution(nux::MAJOR_POSITION_CENTER);
105 67 SetLayout(layout_);
106 layered_layout_ = new nux::LayeredLayout();
107 layered_layout_->AddLayer(layout_);
108 layered_layout_->AddLayout(legal_layout_);
109 layered_layout_->SetPaintAll(true);
110 layered_layout_->SetInputMode(nux::LayeredLayout::InputMode::INPUT_MODE_COMPOSITE);
11168
112 SetLayout(layered_layout_);
113
114 SetMinimumHeight(SCOPEBAR_HEIGHT);69 SetMinimumHeight(SCOPEBAR_HEIGHT);
115 SetMaximumHeight(SCOPEBAR_HEIGHT);70 SetMaximumHeight(SCOPEBAR_HEIGHT);
116}71}
11772
118void ScopeBar::DoOpenLegalise()
119{
120 glib::Error error;
121 std::string legal_file_path = "file://";
122 legal_file_path.append(PKGDATADIR);
123 legal_file_path.append("/searchingthedashlegalnotice.html");
124 g_app_info_launch_default_for_uri(legal_file_path.c_str(), NULL, &error);
125 if (error)
126 {
127 LOG_ERROR(logger) << "Could not open legal uri: " << error.Message();
128 }
129
130 g_creat(legal_seen_file_path_.c_str(), S_IRWXU);
131
132 ubus_.SendMessage(UBUS_OVERLAY_CLOSE_REQUEST);
133}
134
135void ScopeBar::AddScope(Scope::Ptr const& scope)73void ScopeBar::AddScope(Scope::Ptr const& scope)
136{74{
137 ScopeBarIcon* icon = new ScopeBarIcon(scope->id, scope->icon_hint);75 ScopeBarIcon* icon = new ScopeBarIcon(scope->id, scope->icon_hint);
@@ -186,9 +124,12 @@
186 if (!IsFullRedraw())124 if (!IsFullRedraw())
187 {125 {
188 if (RedirectedAncestor())126 if (RedirectedAncestor())
189 { 127 {
190 // Whole Scope bar needs to be cleared because the PaintAll forces redraw.128 for (auto icon: icons_)
191 graphics::ClearGeometry(base);129 {
130 if (icon->IsVisible() && icon->IsRedrawNeeded())
131 graphics::ClearGeometry(icon->GetGeometry());
132 }
192 }133 }
193134
194 if (bg_layer_)135 if (bg_layer_)
@@ -199,14 +140,14 @@
199 }140 }
200 else141 else
201 {142 {
202 nux::GetPainter().PushPaintLayerStack(); 143 nux::GetPainter().PushPaintLayerStack();
203 }144 }
204145
205 GetLayout()->ProcessDraw(graphics_engine, true);146 GetLayout()->ProcessDraw(graphics_engine, force_draw);
206147
207 if (IsFullRedraw())148 if (IsFullRedraw())
208 {149 {
209 nux::GetPainter().PopPaintLayerStack(); 150 nux::GetPainter().PopPaintLayerStack();
210 }151 }
211 else if (pushed_paint_layers > 0)152 else if (pushed_paint_layers > 0)
212 {153 {
@@ -237,27 +178,6 @@
237 graphics_engine.PopClippingRectangle();178 graphics_engine.PopClippingRectangle();
238}179}
239180
240nux::Area* ScopeBar::FindAreaUnderMouse(const nux::Point& mouse_position, nux::NuxEventType event_type)
241{
242 //LayeredLayout is acting a little screwy, events are not passing past the first layout like instructed,
243 //so we manually override if the cursor is on the right hand side of the scopebar
244 auto geo = GetAbsoluteGeometry();
245 int info_width = (info_previously_shown_) ? info_icon_->GetGeometry().width : legal_->GetGeometry().width;
246
247 if (mouse_position.x - geo.x < geo.width - info_width - 10)
248 {
249 return nux::View::FindAreaUnderMouse(mouse_position, event_type);
250 }
251 else
252 {
253 if (info_previously_shown_)
254 return dynamic_cast<nux::Area*>(info_icon_);
255 else
256 return dynamic_cast<nux::Area*>(legal_);
257 }
258
259}
260
261void ScopeBar::SetActive(ScopeBarIcon* activated)181void ScopeBar::SetActive(ScopeBarIcon* activated)
262{182{
263 bool state_changed = false;183 bool state_changed = false;
264184
=== modified file 'dash/ScopeBar.h'
--- dash/ScopeBar.h 2013-04-17 15:10:39 +0000
+++ dash/ScopeBar.h 2013-07-09 13:53:24 +0000
@@ -69,13 +69,10 @@
69private:69private:
70 void SetupBackground();70 void SetupBackground();
71 void SetupLayout();71 void SetupLayout();
72 void DoOpenLegalise();
7372
74 void Draw(nux::GraphicsEngine& gfx_context, bool force_draw);73 void Draw(nux::GraphicsEngine& gfx_context, bool force_draw);
75 void DrawContent(nux::GraphicsEngine& gfx_context, bool force_draw);74 void DrawContent(nux::GraphicsEngine& gfx_context, bool force_draw);
7675
77 nux::Area* FindAreaUnderMouse(const nux::Point& mouse_position, nux::NuxEventType event_type);
78
79 void SetActive(ScopeBarIcon* icon);76 void SetActive(ScopeBarIcon* icon);
8077
81 bool AcceptKeyNavFocus();78 bool AcceptKeyNavFocus();
@@ -86,17 +83,8 @@
8683
87 ScopeIcons icons_;84 ScopeIcons icons_;
8885
89 UBusManager ubus_;
90
91 nux::LayeredLayout* layered_layout_;
92 nux::HLayout *legal_layout_;
93 unity::StaticCairoText *legal_;
94 nux::HLayout* layout_;86 nux::HLayout* layout_;
95 LayerPtr bg_layer_;87 LayerPtr bg_layer_;
96 IconTexture* info_icon_;
97
98 bool info_previously_shown_;
99 std::string legal_seen_file_path_;
10088
101 friend class TestScopeBar;89 friend class TestScopeBar;
102};90};