diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2012-12-14 16:17:24 +0100 |
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2012-12-14 16:17:24 +0100 |
| commit | e55b9f9cfe2a3012b394441035c098a214d6933c (patch) | |
| tree | bccc357a66a8caeda736e29f10f30a34ef94e969 /unity-shared | |
| parent | 81480186c99c26d3aae8caec5455dfb1123ea136 (diff) | |
PanelStyle: use std::array to handle file names
(bzr r2970.5.3)
Diffstat (limited to 'unity-shared')
| -rw-r--r-- | unity-shared/PanelStyle.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/unity-shared/PanelStyle.cpp b/unity-shared/PanelStyle.cpp index 0db2bbc5d..95c53d17f 100644 --- a/unity-shared/PanelStyle.cpp +++ b/unity-shared/PanelStyle.cpp @@ -21,6 +21,7 @@ #include "config.h" #include <math.h> +#include <array> #include <gtk/gtk.h> #include <boost/algorithm/string/predicate.hpp> @@ -192,19 +193,17 @@ BaseTexturePtr Style::GetBackground(int width, int height, float opacity) std::vector<std::string> Style::GetWindowButtonFileNames(WindowButtonType type, WindowState state) { std::vector<std::string> files; - std::string names[] = { "close", "minimize", "unmaximize", "maximize" }; - std::string states[] = { "", "_focused_prelight", "_focused_pressed", "_unfocused", - "_unfocused", "_unfocused_prelight", "_unfocused_pressed"}; + static const std::array<std::string, 4> names = {{ "close", "minimize", "unmaximize", "maximize" }}; + static const std::array<std::string, 7> states = {{ "", "_focused_prelight", "_focused_pressed", "_unfocused", + "_unfocused", "_unfocused_prelight", "_unfocused_pressed" }}; - std::ostringstream subpath; - subpath << "unity/" << names[static_cast<int>(type)] - << states[static_cast<int>(state)] << ".png"; + std::string subpath = "unity/" + names[static_cast<int>(type)] + states[static_cast<int>(state)] + ".png"; // Look in home directory const char* home_dir = g_get_home_dir(); if (home_dir) { - glib::String filename(g_build_filename(home_dir, ".themes", _theme_name.c_str(), subpath.str().c_str(), NULL)); + glib::String filename(g_build_filename(home_dir, ".themes", _theme_name.c_str(), subpath.c_str(), NULL)); if (g_file_test(filename.Value(), G_FILE_TEST_EXISTS)) files.push_back (filename.Value()); @@ -214,7 +213,7 @@ std::vector<std::string> Style::GetWindowButtonFileNames(WindowButtonType type, if (!var) var = "/usr"; - glib::String filename(g_build_filename(var, "share", "themes", _theme_name.c_str(), subpath.str().c_str(), NULL)); + glib::String filename(g_build_filename(var, "share", "themes", _theme_name.c_str(), subpath.c_str(), NULL)); if (g_file_test(filename.Value(), G_FILE_TEST_EXISTS)) files.push_back (filename.Value()); |
