~hansvschoot/unity/7.4

« back to all changes in this revision

Viewing changes to lockscreen/KylinUserPromptView.cpp

  • Committer: CI Train Bot
  • Author(s): Marco Trevisan (Treviño)
  • Date: 2016-04-01 23:11:21 UTC
  • mfrom: (4093.2.30 themed-texture-cache)
  • Revision ID: ci-train-bot@canonical.com-20160401231121-or6ge8fgw25y4m41
TextureCache: add support for loading themed textures

When a themed texture is requested, we add it to a list so that we can invalidate
it on theme changes.

Use themed textures in any case we load local files, falling back to the default path if
theme doesn't provide any customized asset. Fixes: #903179, #1208790
Approved by: Andrea Azzarone

Show diffs side-by-side

added added

removed removed

Lines of Context:
56
56
const RawPixel TEXT_INPUT_WIDTH     = 320_em;
57
57
const int PROMPT_FONT_SIZE = 14;
58
58
 
59
 
const std::string ACTIVATOR_ICON = "login.svg";
 
59
const std::string ACTIVATOR_ICON = "kylin_login_activate";
60
60
 
61
61
std::string SanitizeMessage(std::string const& message)
62
62
{
120
120
    UpdateSize();
121
121
    ResetLayout();
122
122
 
 
123
    TextureCache::GetDefault().themed_invalidated.connect(sigc::mem_fun(this, &KylinUserPromptView::ResetLayout));
123
124
    user_authenticator_.AuthenticateStart(session_manager_->UserName(),
124
125
                                          sigc::mem_fun(this, &KylinUserPromptView::AuthenticationCb));
125
126
}
137
138
    nux::Layout* switch_layout = new nux::HLayout();
138
139
 
139
140
    TextureCache& cache = TextureCache::GetDefault();
140
 
    switch_icon_ = new IconTexture(cache.FindTexture("switch_user.svg", SWITCH_ICON_SIZE.CP(scale), SWITCH_ICON_SIZE.CP(scale)));
 
141
    switch_icon_ = new IconTexture(cache.FindTexture("switch_user", SWITCH_ICON_SIZE.CP(scale), SWITCH_ICON_SIZE.CP(scale)));
141
142
    switch_layout->AddView(switch_icon_);
142
143
    switch_icon_->mouse_click.connect([this](int x, int y, unsigned long button_flags, unsigned long key_flags) {
143
144
      session_manager_->SwitchToGreeter();