Merge lp:~3v1n0/unity/neko-reloaded into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Marco Trevisan (Treviño)
Approved revision: no longer in the source branch.
Merged at revision: 4227
Proposed branch: lp:~3v1n0/unity/neko-reloaded
Merge into: lp:unity
Diff against target: 170 lines (+50/-6)
6 files modified
dash/DashView.cpp (+24/-0)
dash/DashView.h (+1/-0)
dash/ResultRendererTile.cpp (+17/-4)
dash/ResultRendererTile.h (+3/-1)
dash/ScopeView.cpp (+4/-1)
dash/ScopeView.h (+1/-0)
To merge this branch: bzr merge lp:~3v1n0/unity/neko-reloaded
Reviewer Review Type Date Requested Status
Michal Hruby (community) Approve
Ted Gould (community) Approve
Charles Kerr (community) Approve
Brandon Schaefer (community) Approve
Omer Akram (community) qa Approve
Neil J. Patel (community) Approve
Gord Allott (community) best review Approve
Iain Lane Approve
Review via email: mp+322219@code.launchpad.net

Commit message

Dash: fix the neko regression we have since a couple of cycles

To post a comment you must log in.
Revision history for this message
Iain Lane (laney) wrote :

Yep!

review: Approve
Revision history for this message
Gord Allott (gordallott) wrote :

you star

review: Approve (best review)
Revision history for this message
Neil J. Patel (njpatel) wrote :

Excellent work!

review: Approve
Revision history for this message
Marco Trevisan (Treviño) (3v1n0) wrote :

Thanks "fathers", it means a lot! :-D

PS: Yeah, launcher is missing, too bad it was FF coming.

Revision history for this message
Omer Akram (om26er) wrote :

Works as expected, I must add.

review: Approve (qa)
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Im sorry we had to remove this from U7, must approve

review: Approve
Revision history for this message
Alejandro J. Cura (alecu) wrote :

You guys rock, thanks for all the hard work you've put into this.

Revision history for this message
Charles Kerr (charlesk) wrote :

This is the only remaining feature we needed. Guys, we can all go home now

review: Approve
Revision history for this message
Ted Gould (ted) :
review: Approve
Revision history for this message
Michal Hruby (mhr3) wrote :

😱 oh dear, how did I miss this? Definitely 👍

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'dash/DashView.cpp'
2--- dash/DashView.cpp 2016-07-04 16:53:41 +0000
3+++ dash/DashView.cpp 2017-04-07 18:30:29 +0000
4@@ -122,6 +122,7 @@
5 , last_activated_timestamp_(0)
6 , activate_on_finish_(false)
7 , visible_(false)
8+ , neko_mode_(false)
9 , opening_column_x_(-1)
10 , opening_row_y_(-1)
11 , opening_column_width_(0)
12@@ -138,6 +139,10 @@
13 QueueDraw();
14 });
15
16+ gsize tmp_sz;
17+ glib::String neko((gchar*)g_base64_decode("VU5JVFlfTkVLTw==", &tmp_sz));
18+ neko_mode_ = g_getenv(neko) != nullptr;
19+
20 SetupViews();
21 SetupUBusConnections();
22 AddChild(overlay_window_buttons_.GetPointer());
23@@ -1290,6 +1295,7 @@
24 nux::ObjectPtr<ScopeView> view(new ScopeView(scope, search_bar_->show_filters()));
25 AddChild(view.GetPointer());
26 view->scale = scale();
27+ view->neko_mode = neko_mode_;
28 view->SetVisible(false);
29 view->result_activated.connect(sigc::mem_fun(this, &DashView::OnResultActivated));
30
31@@ -1427,6 +1433,24 @@
32 {
33 if (active_scope_view_.IsValid())
34 {
35+ const std::array<const gchar*, 2> nekos = {
36+ "d2VsY29tZSBiYWNrIHVuaXR5=",
37+ "ZmFyZXdlbGwgdW5pdHk=",
38+ };
39+
40+ for (unsigned i = 0; i < nekos.size(); ++i)
41+ {
42+ gsize tmp_sz;
43+ glib::String neko((gchar*)g_base64_decode(nekos[i], &tmp_sz));
44+ if (search_bar_->search_string() == neko.Str())
45+ {
46+ for (auto const& view : scope_views_)
47+ view.second->neko_mode = (i != 0);
48+
49+ return;
50+ }
51+ }
52+
53 if (!activate_delay_ && !search_bar_->in_live_search())
54 active_scope_view_->ActivateFirst();
55 else
56
57=== modified file 'dash/DashView.h'
58--- dash/DashView.h 2016-03-17 07:36:44 +0000
59+++ dash/DashView.h 2017-04-07 18:30:29 +0000
60@@ -175,6 +175,7 @@
61 bool activate_on_finish_;
62 glib::Source::UniquePtr activate_delay_;
63 bool visible_;
64+ bool neko_mode_;
65
66 nux::ObjectPtr<nux::IOpenGLBaseTexture> dash_view_copy_;
67 nux::ObjectPtr<nux::IOpenGLBaseTexture> search_view_copy_;
68
69=== modified file 'dash/ResultRendererTile.cpp'
70--- dash/ResultRendererTile.cpp 2016-02-09 18:16:51 +0000
71+++ dash/ResultRendererTile.cpp 2017-04-07 18:30:29 +0000
72@@ -90,8 +90,9 @@
73
74 NUX_IMPLEMENT_OBJECT_TYPE(ResultRendererTile);
75
76-ResultRendererTile::ResultRendererTile(NUX_FILE_LINE_DECL)
77+ResultRendererTile::ResultRendererTile(NUX_FILE_LINE_DECL, bool neko_mode)
78 : ResultRenderer(NUX_FILE_LINE_PARAM)
79+ , neko_mode_(neko_mode)
80 {
81 UpdateWidthHeight();
82 scale.changed.connect([this] (double) { UpdateWidthHeight(); });
83@@ -271,9 +272,21 @@
84 int tile_gsize = style.GetTileGIconSize().CP(scale);
85
86 std::string const& icon_hint = row.icon_hint;
87- std::string const& icon_name = !icon_hint.empty() ? icon_hint : DEFAULT_GICON;
88-
89- glib::Object<GIcon> icon(g_icon_new_for_string(icon_name.c_str(), NULL));
90+ std::string icon_name = !icon_hint.empty() ? icon_hint : DEFAULT_GICON;
91+
92+ if (neko_mode_)
93+ {
94+ const std::array<const gchar*, 2> pool = {
95+ "aHR0cDovL3BsYWNla2l0dGVuLmNvbS9nLyVpLyVpLw==",
96+ "aHR0cDovL3BsYWNla2l0dGVuLmNvbS8laS8laS8=",
97+ };
98+ gsize tmp0;
99+ int tmp1 = tile_size - (rand() % RawPixel(16).CP(scale));
100+ glib::String tmp2((gchar*)g_base64_decode(pool[rand() % pool.size()], &tmp0));
101+ icon_name = glib::String(g_strdup_printf(tmp2, tmp1, tmp1)).Str();
102+ }
103+
104+ glib::Object<GIcon> icon(g_icon_new_for_string(icon_name.c_str(), nullptr));
105 TextureContainer* container = row.renderer<TextureContainer*>();
106
107 if (container)
108
109=== modified file 'dash/ResultRendererTile.h'
110--- dash/ResultRendererTile.h 2015-10-03 01:08:12 +0000
111+++ dash/ResultRendererTile.h 2017-04-07 18:30:29 +0000
112@@ -59,7 +59,7 @@
113 public:
114 NUX_DECLARE_OBJECT_TYPE(ResultRendererTile, ResultRenderer);
115
116- ResultRendererTile(NUX_FILE_LINE_PROTO);
117+ ResultRendererTile(NUX_FILE_LINE_PROTO, bool neko_mode = false);
118 virtual ~ResultRendererTile() {}
119
120 virtual void Render(nux::GraphicsEngine& GfxContext,
121@@ -95,6 +95,8 @@
122 int width, int height);
123
124 void UpdateWidthHeight();
125+
126+ bool neko_mode_;
127 };
128
129 }
130
131=== modified file 'dash/ScopeView.cpp'
132--- dash/ScopeView.cpp 2015-12-09 12:46:58 +0000
133+++ dash/ScopeView.cpp 2017-04-07 18:30:29 +0000
134@@ -143,6 +143,7 @@
135 , filters_expanded(false)
136 , can_refine_search(false)
137 , scale(DEFAULT_SCALE)
138+, neko_mode(false)
139 , scope_(scope)
140 , no_results_active_(false)
141 , last_good_filter_model_(-1)
142@@ -172,6 +173,8 @@
143 conn_manager_.Add(scope_->filters.changed.connect(sigc::mem_fun(this, &ScopeView::SetupFilters)));
144 SetupFilters(scope->filters);
145
146+ neko_mode.changed.connect([this] (bool) { SetupCategories(scope_->categories); });
147+
148 scope_->connected.changed.connect([this](bool is_connected)
149 {
150 // We need to search again if we were reconnected after being connected before.
151@@ -485,7 +488,7 @@
152 }
153 else
154 {
155- results_view->SetModelRenderer(new ResultRendererTile(NUX_TRACKER_LOCATION));
156+ results_view->SetModelRenderer(new ResultRendererTile(NUX_TRACKER_LOCATION, neko_mode()));
157 }
158
159 if (scope_)
160
161=== modified file 'dash/ScopeView.h'
162--- dash/ScopeView.h 2015-11-06 18:11:30 +0000
163+++ dash/ScopeView.h 2017-04-07 18:30:29 +0000
164@@ -72,6 +72,7 @@
165 nux::Property<ScopeViewType> view_type;
166 nux::Property<bool> can_refine_search;
167 nux::Property<double> scale;
168+ nux::Property<bool> neko_mode;
169
170 sigc::signal<void, ResultView::ActivateType, LocalResult const&, GVariant*, std::string const&> result_activated;
171