~tatokis/unity/gcc-72-errors

« back to all changes in this revision

Viewing changes to lockscreen/KylinUserPromptView.cpp

  • Committer: Bileto Bot
  • Author(s): Andrea Azzarone
  • Date: 2017-09-25 16:03:52 UTC
  • mfrom: (4253.3.3 fix-missing-entry-lockscreen)
  • Revision ID: ci-train-bot@canonical.com-20170925160352-kqd3v7i3wdwhixjn
Refactor the way UserAuthenticator is created and passed around. Handle failures to create new threads and fallback to a "Switch to greeter..." button in case of failure. (LP: #1311316)

Approved by: Marco Trevisan (Treviño)

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
 
80
80
}
81
81
 
82
 
KylinUserPromptView::KylinUserPromptView(session::Manager::Ptr const& session_manager)
83
 
  : AbstractUserPromptView(session_manager)
84
 
  , session_manager_(session_manager)
 
82
KylinUserPromptView::KylinUserPromptView(session::Manager::Ptr const& session_manager,
 
83
                                         UserAuthenticator::Ptr const& user_authenticator)
 
84
  : AbstractUserPromptView(session_manager, user_authenticator)
85
85
  , username_(nullptr)
86
86
  , msg_layout_(nullptr)
87
87
  , prompt_layout_(nullptr)
90
90
  , avatar_(nullptr)
91
91
  , avatar_icon_file("")
92
92
{
93
 
    user_authenticator_.echo_on_requested.connect([this](std::string const& message, PromiseAuthCodePtr const& promise){
 
93
    user_authenticator_->echo_on_requested.connect(sigc::track_obj([this](std::string const& message, PromiseAuthCodePtr const& promise){
94
94
        AddPrompt(message, true, promise);
95
 
    });
 
95
    }, *this));
96
96
 
97
 
    user_authenticator_.echo_off_requested.connect([this](std::string const& message, PromiseAuthCodePtr const& promise){
 
97
    user_authenticator_->echo_off_requested.connect(sigc::track_obj([this](std::string const& message, PromiseAuthCodePtr const& promise){
98
98
        AddPrompt(message, false, promise);
99
 
    });
 
99
    }, *this));
100
100
 
101
 
    user_authenticator_.message_requested.connect([this](std::string const& message){
 
101
    user_authenticator_->message_requested.connect(sigc::track_obj([this](std::string const& message){
102
102
        AddMessage(message, nux::color::White);
103
 
    });
 
103
    }, *this));
104
104
 
105
 
    user_authenticator_.error_requested.connect([this](std::string const& message){
 
105
    user_authenticator_->error_requested.connect(sigc::track_obj([this](std::string const& message){
106
106
        AddMessage(message, nux::color::Red);
107
 
    });
 
107
    }, *this));
108
108
 
109
 
    user_authenticator_.clear_prompts.connect([this](){
 
109
    user_authenticator_->clear_prompts.connect(sigc::track_obj([this](){
110
110
        ResetLayout();
111
 
    });
 
111
    }, *this));
112
112
 
113
113
    scale.changed.connect(sigc::hide(sigc::mem_fun(this, &KylinUserPromptView::UpdateSize)));
114
114
 
121
121
    ResetLayout();
122
122
 
123
123
    TextureCache::GetDefault().themed_invalidated.connect(sigc::mem_fun(this, &KylinUserPromptView::ResetLayout));
124
 
    user_authenticator_.AuthenticateStart(session_manager_->UserName(),
 
124
    user_authenticator_->AuthenticateStart(session_manager_->UserName(),
125
125
                                          sigc::mem_fun(this, &KylinUserPromptView::AuthenticationCb));
126
126
}
127
127
 
244
244
  {
245
245
    AddMessage(_("Invalid password, please try again"), nux::color::Red);
246
246
 
247
 
    user_authenticator_.AuthenticateStart(session_manager_->UserName(),
 
247
    user_authenticator_->AuthenticateStart(session_manager_->UserName(),
248
248
                                          sigc::mem_fun(this, &KylinUserPromptView::AuthenticationCb));
249
249
  }
250
250
}