~brandontschaefer/unity/move-pointer-barrier-to-xi-1.6.99.1

« back to all changes in this revision

Viewing changes to shutdown/SessionView.cpp

  • Committer: Brandon Schaefer
  • Date: 2013-03-19 17:25:33 UTC
  • mfrom: (3164.1.66 trunk)
  • Revision ID: brandon.schaefer@canonical.com-20130319172533-470rokizjv90yd18
* Merge Trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
145
145
 
146
146
    if (have_inhibitors())
147
147
    {
148
 
      message = _("Hi %s, you have open files that you might want to save " \
149
 
                  "before shutting down.\nWould you like to…");
 
148
      if (buttons_layout_->GetChildren().size() > 3)
 
149
      {
 
150
        // We have enough buttons to show the message without a new line.
 
151
        message = _("Hi %s, you have open files you might want to save. " \
 
152
                    "Would you like to…");
 
153
      }
 
154
      else
 
155
      {
 
156
        message = _("Hi %s, you have open files you might want to save.\n" \
 
157
                    "Would you like to…");
 
158
      }
150
159
    }
151
160
    else
152
161
    {
164
173
 
165
174
  if (mode() == Mode::LOGOUT)
166
175
  {
167
 
    auto* button = new Button(_("Lock"), "lockscreen", NUX_TRACKER_LOCATION);
 
176
    auto* button = new Button(Button::Action::LOCK, NUX_TRACKER_LOCATION);
168
177
    button->activated.connect(sigc::mem_fun(manager_.get(), &Manager::LockScreen));
169
178
    AddButton(button);
170
179
 
171
 
    button = new Button(_("Logout"), "logout", NUX_TRACKER_LOCATION);
 
180
    button = new Button(Button::Action::LOGOUT, NUX_TRACKER_LOCATION);
172
181
    button->activated.connect(sigc::mem_fun(manager_.get(), &Manager::Logout));
173
182
    AddButton(button);
174
183
  }
176
185
  {
177
186
    if (mode() == Mode::FULL)
178
187
    {
179
 
      auto* button = new Button(_("Lock"), "lockscreen", NUX_TRACKER_LOCATION);
 
188
      auto* button = new Button(Button::Action::LOCK, NUX_TRACKER_LOCATION);
180
189
      button->activated.connect(sigc::mem_fun(manager_.get(), &Manager::LockScreen));
181
190
      AddButton(button);
182
191
 
183
192
      if (manager_->CanSuspend())
184
193
      {
185
 
        button = new Button(_("Suspend"), "suspend", NUX_TRACKER_LOCATION);
 
194
        button = new Button(Button::Action::SUSPEND, NUX_TRACKER_LOCATION);
186
195
        button->activated.connect(sigc::mem_fun(manager_.get(), &Manager::Suspend));
187
196
        AddButton(button);
188
197
      }
189
198
 
190
199
      if (manager_->CanHibernate())
191
200
      {
192
 
        button = new Button(_("Hibernate"), "hibernate", NUX_TRACKER_LOCATION);
 
201
        button = new Button(Button::Action::HIBERNATE, NUX_TRACKER_LOCATION);
193
202
        button->activated.connect(sigc::mem_fun(manager_.get(), &Manager::Hibernate));
194
203
        AddButton(button);
195
204
      }
197
206
 
198
207
    if (manager_->CanShutdown())
199
208
    {
200
 
      auto* button = new Button(_("Shutdown"), "shutdown", NUX_TRACKER_LOCATION);
 
209
      auto* button = new Button(Button::Action::SHUTDOWN, NUX_TRACKER_LOCATION);
201
210
      button->activated.connect(sigc::mem_fun(manager_.get(), &Manager::Shutdown));
202
211
      AddButton(button);
203
212
 
204
 
      button = new Button(_("Restart"), "restart", NUX_TRACKER_LOCATION);
 
213
      button = new Button(Button::Action::REBOOT, NUX_TRACKER_LOCATION);
205
214
      button->activated.connect(sigc::mem_fun(manager_.get(), &Manager::Reboot));
206
215
      AddButton(button);
207
216
    }
208
217
    else if (mode() == Mode::FULL)
209
218
    {
210
 
      auto* button = new Button(_("Logout"), "logout", NUX_TRACKER_LOCATION);
 
219
      auto* button = new Button(Button::Action::LOGOUT, NUX_TRACKER_LOCATION);
211
220
      button->activated.connect(sigc::mem_fun(manager_.get(), &Manager::Logout));
212
221
      AddButton(button);
213
222
    }
287
296
  {
288
297
    nux::InputArea* focused = nux::GetWindowCompositor().GetKeyFocusArea();
289
298
 
290
 
    if (!focused || !focused->IsMouseInside())
 
299
    // Let's reset the focused area if we're in keyboard-navigation mode.
 
300
    if (focused && focused->IsChildOf(buttons_layout_) && !focused->IsMouseInside())
291
301
      return this;
292
302
  }
293
303