summaryrefslogtreecommitdiff
path: root/shutdown
diff options
authorBrandon Schaefer <brandontschaefer@gmail.com>2014-05-05 11:42:45 -0700
committerBrandon Schaefer <brandontschaefer@gmail.com>2014-05-05 11:42:45 -0700
commit0268d0258d953ae8273ca1fa04a0b169e66b16bd (patch)
treef0554b2e78ea88cb6a18731c7d89e66156b1fc11 /shutdown
parent98befcd2a0aec85df071b741657510a9dafb5c0e (diff)
* Fix reviews issues.
(bzr r3788.4.5)
Diffstat (limited to 'shutdown')
-rw-r--r--shutdown/SessionButton.cpp14
-rw-r--r--shutdown/SessionButton.h3
-rw-r--r--shutdown/SessionView.cpp3
3 files changed, 9 insertions, 11 deletions
diff --git a/shutdown/SessionButton.cpp b/shutdown/SessionButton.cpp
index fff33ca8f..af1f2b3f3 100644
--- a/shutdown/SessionButton.cpp
+++ b/shutdown/SessionButton.cpp
@@ -45,7 +45,6 @@ Button::Button(Action action, NUX_FILE_LINE_DECL)
, action([this] { return action_; })
, label([this] { return label_view_->GetText(); })
, action_(action)
- , texture_size_(-1)
{
SetAcceptKeyNavFocusOnMouseDown(false);
SetAcceptKeyNavFocusOnMouseEnter(true);
@@ -81,7 +80,6 @@ Button::Button(Action action, NUX_FILE_LINE_DECL)
break;
}
- GetDefaultMaxTextureSize(texture_prefix);
UpdateTextures(texture_prefix);
auto main_layout = new nux::VLayout();
@@ -124,18 +122,20 @@ Button::Button(Action action, NUX_FILE_LINE_DECL)
void Button::UpdateTextures(std::string const& texture_prefix)
{
- normal_tex_.Adopt(nux::CreateTexture2DFromFile((texture_prefix + ".png").c_str(), texture_size_.CP(scale), true));
- highlight_tex_.Adopt(nux::CreateTexture2DFromFile((texture_prefix + "_highlight.png").c_str(), texture_size_.CP(scale), true));
+ RawPixel const texture_size = GetDefaultMaxTextureSize(texture_prefix);
+
+ normal_tex_.Adopt(nux::CreateTexture2DFromFile((texture_prefix + ".png").c_str(), texture_size.CP(scale), true));
+ highlight_tex_.Adopt(nux::CreateTexture2DFromFile((texture_prefix + "_highlight.png").c_str(), texture_size.CP(scale), true));
}
-void Button::GetDefaultMaxTextureSize(std::string const& texture_prefix)
+RawPixel Button::GetDefaultMaxTextureSize(std::string const& texture_prefix) const
{
nux::Size size;
auto const& texture_name = (texture_prefix + ".png");
gdk_pixbuf_get_file_info(texture_name.c_str(), &size.width, &size.height);
- int max_size = std::max(std::round(size.width * scale), std::round(size.height * scale));
+ RawPixel max_size = std::max(std::round(size.width * scale), std::round(size.height * scale));
- texture_size_ = max_size;
+ return max_size;
}
void Button::Draw(nux::GraphicsEngine& ctx, bool force)
diff --git a/shutdown/SessionButton.h b/shutdown/SessionButton.h
index e46704271..a25a65cdc 100644
--- a/shutdown/SessionButton.h
+++ b/shutdown/SessionButton.h
@@ -68,14 +68,13 @@ private:
friend class TestSessionButton;
void UpdateTextures(std::string const& texture_prefix);
- void GetDefaultMaxTextureSize(std::string const& texture_prefix);
+ RawPixel GetDefaultMaxTextureSize(std::string const& texture_prefix) const;
Action action_;
IconTexture* image_view_;
StaticCairoText* label_view_;
nux::ObjectPtr<nux::BaseTexture> normal_tex_;
nux::ObjectPtr<nux::BaseTexture> highlight_tex_;
- RawPixel texture_size_;
};
} // namespace session
diff --git a/shutdown/SessionView.cpp b/shutdown/SessionView.cpp
index 375cc6779..623500dce 100644
--- a/shutdown/SessionView.cpp
+++ b/shutdown/SessionView.cpp
@@ -24,7 +24,6 @@
#include <glib/gi18n-lib.h>
#include <unity-shared/RawPixel.h>
-#include <unity-shared/UScreen.h>
namespace unity
{
@@ -96,7 +95,7 @@ View::View(Manager::Ptr const& manager)
Populate();
});
- monitor.changed.connect([this] (bool changed) {
+ monitor.changed.connect([this] (int monitor) {
UpdateViewSize();
});