Merge lp:~gordallott/unity/fix-missing-icons into lp:unity

Proposed by Gord Allott
Status: Merged
Approved by: Gord Allott
Approved revision: no longer in the source branch.
Merged at revision: 1558
Proposed branch: lp:~gordallott/unity/fix-missing-icons
Merge into: lp:unity
Diff against target: 50 lines (+14/-5)
2 files modified
plugins/unityshell/src/IconLoader.cpp (+1/-0)
plugins/unityshell/src/ResultRendererTile.cpp (+13/-5)
To merge this branch: bzr merge lp:~gordallott/unity/fix-missing-icons
Reviewer Review Type Date Requested Status
Mikkel Kamstrup Erlandsen (community) Approve
Review via email: mp+74973@code.launchpad.net

Description of the change

fix for lp:830887 hopefully

To post a comment you must log in.
Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

Gord, afaics this introduces an new stat() call *every time* we load an icon - even if we've already cached it in the icon loader.

review: Needs Fixing
Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

I'd propose fixing the icon loader - also taking into account that the icon loader can cache the fact that a file doesn't exist. I've done similarly with .desktop files in libunity's Unity.AppInfoManager.

Revision history for this message
Mikkel Kamstrup Erlandsen (kamstrup) wrote :

r1529 discussed on irc

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'plugins/unityshell/src/IconLoader.cpp'
--- plugins/unityshell/src/IconLoader.cpp 2011-09-05 00:46:13 +0000
+++ plugins/unityshell/src/IconLoader.cpp 2011-09-14 10:24:24 +0000
@@ -507,6 +507,7 @@
507 {507 {
508 LOG_WARNING(logger) << "Unable to load contents of "508 LOG_WARNING(logger) << "Unable to load contents of "
509 << task->data << ": " << error;509 << task->data << ": " << error;
510 task->slot(task->data, task->size, nullptr);
510 }511 }
511 task->self->task_map_.erase(task->handle);512 task->self->task_map_.erase(task->handle);
512 delete task;513 delete task;
513514
=== modified file 'plugins/unityshell/src/ResultRendererTile.cpp'
--- plugins/unityshell/src/ResultRendererTile.cpp 2011-09-13 22:35:13 +0000
+++ plugins/unityshell/src/ResultRendererTile.cpp 2011-09-14 10:24:24 +0000
@@ -262,12 +262,13 @@
262 }262 }
263 g_free(tmp5);263 g_free(tmp5);
264264
265
265 GIcon* icon = g_icon_new_for_string(icon_name.c_str(), NULL);266 GIcon* icon = g_icon_new_for_string(icon_name.c_str(), NULL);
266 TextureContainer* container = row.renderer<TextureContainer*>();267 TextureContainer* container = row.renderer<TextureContainer*>();
267268
268 IconLoader::IconLoaderCallback slot = sigc::bind(sigc::mem_fun(this, &ResultRendererTile::IconLoaded), icon_hint, row);269 IconLoader::IconLoaderCallback slot = sigc::bind(sigc::mem_fun(this, &ResultRendererTile::IconLoaded), icon_hint, row);
269270
270 if (g_str_has_prefix(icon_name.c_str(), "http://"))271 if (g_strrstr(icon_name.c_str(), "://"))
271 {272 {
272 container->slot_handle = IconLoader::GetDefault().LoadFromURI(icon_name.c_str(), 48, slot);273 container->slot_handle = IconLoader::GetDefault().LoadFromURI(icon_name.c_str(), 48, slot);
273 }274 }
@@ -335,10 +336,17 @@
335 container->blurred_icon = texture_blurred;336 container->blurred_icon = texture_blurred;
336337
337 NeedsRedraw.emit();338 NeedsRedraw.emit();
338 }339
339 // Whether there is a pixbuf or not, we need to clear the slot_handle.340 if (container)
340 if (container)341 container->slot_handle = 0;
341 container->slot_handle = 0;342 }
343 else
344 {
345 // we need to load a missing icon
346 IconLoader::IconLoaderCallback slot = sigc::bind(sigc::mem_fun(this, &ResultRendererTile::IconLoaded), icon_name, row);
347 container->slot_handle = IconLoader::GetDefault().LoadFromGIconString(". GThemedIcon text-x-preview", 48, slot);
348 }
349
342}350}
343351
344352