summaryrefslogtreecommitdiff
path: root/dash
diff options
authorMarco Trevisan (TreviƱo) <mail@3v1n0.net>2013-07-11 03:21:07 +0000
committerTarmac <>2013-07-11 03:21:07 +0000
commit180e59cab6f20d4cacff5287fa55868e8634ddf0 (patch)
treec3b4cf394cc4f0dfa3438110fca23c931f94da0e /dash
parent5c5d2dd05bc3f0e1db900da4f4fece8a49d63573 (diff)
parent5f1cf3f8b596e263969e39f3367b5ecd5ce07f09 (diff)
CMake: run X-dependent tests using a dummy Xorg server on make check-headless
This is possible using dummy-xorg-test-runner.sh to run these tests. Calling ./dummy-xorg-test-runner.sh binary --any-parameter -f --bar will load binary (with requested parameters) in a fake X server (using dummy xorg video driver, that now also uses llvmpipe to get 3d acceleration). Fixes: https://bugs.launchpad.net/bugs/1197561, https://bugs.launchpad.net/bugs/1199857, https://bugs.launchpad.net/bugs/1199890. Approved by PS Jenkins bot, Christopher Townsend. (bzr r3420)
Diffstat (limited to 'dash')
-rwxr-xr-xdash/ScopeView.cpp78
1 files changed, 37 insertions, 41 deletions
diff --git a/dash/ScopeView.cpp b/dash/ScopeView.cpp
index 0c8bce3b9..47958d68a 100755
--- a/dash/ScopeView.cpp
+++ b/dash/ScopeView.cpp
@@ -19,8 +19,6 @@
#include "ScopeView.h"
-#include <boost/lexical_cast.hpp>
-
#include <NuxCore/Logger.h>
#include <Nux/HScrollBar.h>
#include <Nux/VScrollBar.h>
@@ -171,13 +169,13 @@ ScopeView::ScopeView(Scope::Ptr const& scope, nux::Area* show_filters)
if (scope_)
{
- conn_manager_.Add(scope_->categories.changed.connect([this](Categories::Ptr const& categories) { SetupCategories(categories); }));
+ conn_manager_.Add(scope_->categories.changed.connect(sigc::mem_fun(this, &ScopeView::SetupCategories)));
SetupCategories(scope->categories);
- conn_manager_.Add(scope_->results.changed.connect([this](Results::Ptr const& results) { SetupResults(results); }));
+ conn_manager_.Add(scope_->results.changed.connect(sigc::mem_fun(this, &ScopeView::SetupResults)));
SetupResults(scope->results);
- conn_manager_.Add(scope_->filters.changed.connect([this](Filters::Ptr const& filters) { SetupFilters(filters); }));
+ conn_manager_.Add(scope_->filters.changed.connect(sigc::mem_fun(this, &ScopeView::SetupFilters)));
SetupFilters(scope->filters);
scope_->connected.changed.connect([&](bool is_connected)
@@ -202,7 +200,7 @@ ScopeView::ScopeView(Scope::Ptr const& scope, nux::Area* show_filters)
nux::Geometry focused_pos;
g_variant_get (data, "(iiii)", &focused_pos.x, &focused_pos.y, &focused_pos.width, &focused_pos.height);
- for (auto group : category_views_)
+ for (auto const& group : category_views_)
{
if (group->GetLayout() != nullptr)
{
@@ -295,15 +293,15 @@ void ScopeView::SetupCategories(Categories::Ptr const& categories)
conn = categories->category_removed.connect(sigc::mem_fun(this, &ScopeView::OnCategoryRemoved));
category_removed_connection_ = conn_manager_.Add(conn);
- auto resync_categories = [categories, this] (glib::Object<DeeModel> model)
+ auto resync_categories = [this, categories] ()
{
ClearCategories();
for (unsigned int i = 0; i < categories->count(); ++i)
OnCategoryAdded(categories->RowAtIndex(i));
};
- categories->model.changed.connect(resync_categories);
- resync_categories(categories->model());
+ categories->model.changed.connect(sigc::hide(resync_categories));
+ resync_categories();
scope_->category_order.changed.connect(sigc::mem_fun(this, &ScopeView::OnCategoryOrderChanged));
}
@@ -323,11 +321,8 @@ void ScopeView::OnCategoryOrderChanged(std::vector<unsigned int> const& order)
category_order_ = order;
- for (auto iter = category_views_.begin(); iter != category_views_.end(); ++iter)
- {
- PlacesGroup::Ptr group = *iter;
+ for (auto const& group : category_views_)
scroll_layout_->RemoveChildObject(group.GetPointer());
- }
if (scope_)
{
@@ -395,7 +390,7 @@ void ScopeView::SetupFilters(Filters::Ptr const& filters)
conn = filters->filter_removed.connect(sigc::mem_fun(this, &ScopeView::OnFilterRemoved));
filter_removed_connection_ = conn_manager_.Add(conn);
- auto resync_filters = [filters, this] (glib::Object<DeeModel> model)
+ auto resync_filters = [this, filters] ()
{
auto conn = conn_manager_.Get(filter_removed_connection_);
bool blocked = conn.block(true);
@@ -407,17 +402,18 @@ void ScopeView::SetupFilters(Filters::Ptr const& filters)
conn.block(blocked);
};
- filters->model.changed.connect(resync_filters);
- resync_filters(filters->model());
+ filters->model.changed.connect(sigc::hide(resync_filters));
+ resync_filters();
}
void ScopeView::OnCategoryAdded(Category const& category)
{
- std::string name = category.name;
- std::string icon_hint = category.icon_hint;
- std::string renderer_name = category.renderer_name;
- if (category.index == unsigned(-1))
+ if (category.index == static_cast<unsigned>(-1))
return;
+
+ std::string const& name = category.name;
+ std::string const& icon_hint = category.icon_hint;
+ std::string const& renderer_name = category.renderer_name;
unsigned index = category.index;
bool reset_filter_models = index < category_views_.size();
@@ -425,7 +421,7 @@ void ScopeView::OnCategoryAdded(Category const& category)
<< name
<< "(" << icon_hint
<< ", " << renderer_name
- << ", " << boost::lexical_cast<int>(index) << ")";
+ << ", " << index << ")";
//////////////////////////////////////////////////
// Find the current focus category position && result index
@@ -544,7 +540,7 @@ void ScopeView::OnCategoryChanged(Category const& category)
if (category_views_.size() <= category.index)
return;
- PlacesGroup::Ptr group = category_views_[category.index];
+ PlacesGroup::Ptr const& group = category_views_[category.index];
group->SetName(category.name);
group->SetIcon(category.icon_hint);
@@ -554,19 +550,21 @@ void ScopeView::OnCategoryChanged(Category const& category)
void ScopeView::OnCategoryRemoved(Category const& category)
{
- std::string name = category.name;
- std::string icon_hint = category.icon_hint;
- std::string renderer_name = category.renderer_name;
unsigned index = category.index;
+
if (index == unsigned(-1) || category_views_.size() <= index)
return;
+
+ std::string const& name = category.name;
+ std::string const& icon_hint = category.icon_hint;
+ std::string const&renderer_name = category.renderer_name;
bool reset_filter_models = index < category_views_.size()-1;
LOG_DEBUG(logger) << "Category removed '" << (scope_ ? scope_->name() : "unknown") << "': "
<< name
<< "(" << icon_hint
<< ", " << renderer_name
- << ", " << boost::lexical_cast<int>(index) << ")";
+ << ", " << index << ")";
auto category_pos = category_views_.begin() + index;
PlacesGroup::Ptr group = *category_pos;
@@ -609,12 +607,12 @@ void ScopeView::OnCategoryRemoved(Category const& category)
void ScopeView::ClearCategories()
{
- for (auto iter = category_views_.begin(), end = category_views_.end(); iter != end; ++iter)
+ for (auto const& group : category_views_)
{
- PlacesGroup::Ptr group = *iter;
RemoveChild(group.GetPointer());
scroll_layout_->RemoveChildObject(group.GetPointer());
}
+
counts_.clear();
category_views_.clear();
last_expanded_group_.Release();
@@ -825,8 +823,10 @@ void ScopeView::HideResultsMessage()
bool ScopeView::PerformSearch(std::string const& search_query, SearchCallback const& callback)
{
if (search_string_ != search_query)
+ {
for (auto const& group : category_views_)
group->SetExpanded(false);
+ }
search_string_ = search_query;
if (scope_)
@@ -910,7 +910,7 @@ void ScopeView::OnScopeFilterExpanded(bool expanded)
QueueRelayout();
}
- for (auto category_view : category_views_)
+ for (auto const& category_view : category_views_)
category_view->SetFiltersExpanded(expanded);
}
@@ -1028,9 +1028,8 @@ bool ScopeView::AcceptKeyNavFocus()
void ScopeView::ForceCategoryExpansion(std::string const& view_id, bool expand)
{
- for (auto iter = category_views_.begin(); iter != category_views_.end(); ++iter)
+ for (auto const& group : category_views_)
{
- PlacesGroup::Ptr group = *iter;
if (group->GetChildView()->unique_id == view_id)
{
if (expand)
@@ -1048,19 +1047,17 @@ void ScopeView::ForceCategoryExpansion(std::string const& view_id, bool expand)
void ScopeView::SetResultsPreviewAnimationValue(float preview_animation)
{
- for (auto it = category_views_.begin(); it != category_views_.end(); ++it)
- {
- (*it)->SetResultsPreviewAnimationValue(preview_animation);
- }
+ for (auto const& group : category_views_)
+ group->SetResultsPreviewAnimationValue(preview_animation);
}
void ScopeView::EnableResultTextures(bool enable_result_textures)
{
scroll_view_->EnableScrolling(!enable_result_textures);
- for (auto it = category_views_.begin(); it != category_views_.end(); ++it)
+ for (auto const& group : category_views_)
{
- ResultView* result_view = (*it)->GetChildView();
+ ResultView* result_view = group->GetChildView();
if (result_view)
{
result_view->enable_texture_render = enable_result_textures;
@@ -1130,13 +1127,12 @@ PlacesGroup::Ptr ScopeView::CreatePlacesGroup(Category const& category)
ScopeView::CategoryGroups ScopeView::GetOrderedCategoryViews() const
{
CategoryGroups category_view_ordered;
- for (auto iter = category_order_.begin(); iter != category_order_.end(); ++iter)
+ for (auto const& category_index : category_order_)
{
- unsigned int category_index = *iter;
if (category_views_.size() <= category_index)
- continue;
+ continue;
- PlacesGroup::Ptr group = category_views_[category_index];
+ PlacesGroup::Ptr const& group = category_views_[category_index];
category_view_ordered.push_back(group);
}
return category_view_ordered;