summaryrefslogtreecommitdiff
path: root/unity-shared
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2016-03-31 05:30:03 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2016-03-31 05:30:03 +0200
commit6b8d6f20162f0456386a0a4e5b02b2206629d9e4 (patch)
tree2375fb08fba7a89b187bd0305ccd621ac52cceaf /unity-shared
parentf0e0a0fe7b4f344200cd41a370b820513e2473e3 (diff)
IconTexture: load icon at its default size when passing the maximum size value
(bzr r4093.2.18)
Diffstat (limited to 'unity-shared')
-rw-r--r--unity-shared/IconTexture.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/unity-shared/IconTexture.cpp b/unity-shared/IconTexture.cpp
index 4b3cfa9eb..2cb573046 100644
--- a/unity-shared/IconTexture.cpp
+++ b/unity-shared/IconTexture.cpp
@@ -45,7 +45,7 @@ using namespace unity;
IconTexture::IconTexture(BaseTexturePtr const& texture, unsigned width, unsigned height)
: TextureArea(NUX_TRACKER_LOCATION),
_accept_key_nav_focus(false),
- _size(height),
+ _size(std::max(width, height)),
_texture_cached(texture),
_texture_size(width, height),
_loading(false),
@@ -133,24 +133,25 @@ void IconTexture::LoadIcon()
return;
_loading = true;
+ int size = (_size == std::numeric_limits<unsigned>::max()) ? -1 : _size;
glib::Object<GIcon> icon(g_icon_new_for_string(_icon_name.empty() ? DEFAULT_GICON : _icon_name.c_str(), NULL));
if (icon.IsType(G_TYPE_ICON))
{
_handle = IconLoader::GetDefault().LoadFromGIconString(_icon_name.empty() ? DEFAULT_GICON : _icon_name.c_str(),
- -1, _size,
+ -1, size,
sigc::mem_fun(this, &IconTexture::IconLoaded));
}
else if (_icon_name.find("://") != std::string::npos)
{
_handle = IconLoader::GetDefault().LoadFromURI(_icon_name,
- -1, _size, sigc::mem_fun(this, &IconTexture::IconLoaded));
+ -1, size, sigc::mem_fun(this, &IconTexture::IconLoaded));
}
else
{
_handle = IconLoader::GetDefault().LoadFromIconName(_icon_name,
- -1, _size,
+ -1, size,
sigc::mem_fun(this, &IconTexture::IconLoaded));
}
}
@@ -299,7 +300,6 @@ void IconTexture::SetTexture(BaseTexturePtr const& texture)
{
_texture_size.width = texture->GetWidth();
_texture_size.height = texture->GetHeight();
- _size = _texture_size.height;
SetMinMaxSize(_texture_size.width, _texture_size.height);
}