diff options
| author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2013-11-14 04:00:29 +0100 |
|---|---|---|
| committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2013-11-14 04:00:29 +0100 |
| commit | 1868be7a56c2c73ab87bbb4a13a8dfd863a57d1b (patch) | |
| tree | a31b13edb0de7559615b02f8a76fc39de4f12c2d /unity-shared | |
| parent | bb7a257afe615e6bdb93894df1a2eab2ed29a6f6 (diff) | |
Unity: always prefer passing [this] to lambdas than [&]
(bzr r3592.2.1)
Diffstat (limited to 'unity-shared')
| -rw-r--r-- | unity-shared/CoverArt.cpp | 2 | ||||
| -rw-r--r-- | unity-shared/IconLoader.cpp | 2 | ||||
| -rw-r--r-- | unity-shared/OverlayWindowButtons.cpp | 2 | ||||
| -rw-r--r-- | unity-shared/PanelStyle.cpp | 8 | ||||
| -rw-r--r-- | unity-shared/RatingsButton.cpp | 4 | ||||
| -rw-r--r-- | unity-shared/SearchBar.cpp | 14 | ||||
| -rw-r--r-- | unity-shared/SearchBarSpinner.cpp | 2 | ||||
| -rw-r--r-- | unity-shared/TextInput.cpp | 4 | ||||
| -rw-r--r-- | unity-shared/ThumbnailGenerator.cpp | 4 | ||||
| -rw-r--r-- | unity-shared/UBusServer.cpp | 2 | ||||
| -rw-r--r-- | unity-shared/UScreen.cpp | 4 | ||||
| -rw-r--r-- | unity-shared/WindowButtons.cpp | 6 |
12 files changed, 27 insertions, 27 deletions
diff --git a/unity-shared/CoverArt.cpp b/unity-shared/CoverArt.cpp index 31fe52c5b..b793cec21 100644 --- a/unity-shared/CoverArt.cpp +++ b/unity-shared/CoverArt.cpp @@ -160,7 +160,7 @@ void CoverArt::StartWaiting() rotate_matrix_.Rotate_z(0.0f); rotation_ = 0.0f; - spinner_timeout_.reset(new glib::TimeoutSeconds(IMAGE_TIMEOUT, [&] + spinner_timeout_.reset(new glib::TimeoutSeconds(IMAGE_TIMEOUT, [this] { StopWaiting(); diff --git a/unity-shared/IconLoader.cpp b/unity-shared/IconLoader.cpp index ee7db98df..bfa03fae7 100644 --- a/unity-shared/IconLoader.cpp +++ b/unity-shared/IconLoader.cpp @@ -830,7 +830,7 @@ IconLoader::Impl::Impl() , theme_(::gtk_icon_theme_get_default()) , handle_counter_(0) { - theme_changed_signal_.Connect(theme_, "changed", [&] (GtkIconTheme*) { + theme_changed_signal_.Connect(theme_, "changed", [this] (GtkIconTheme*) { /* Since the theme has been changed we can clear the cache, however we * could include two improvements here: * 1) clear only the themed icons in cache diff --git a/unity-shared/OverlayWindowButtons.cpp b/unity-shared/OverlayWindowButtons.cpp index 5b89b781c..4ef24c608 100644 --- a/unity-shared/OverlayWindowButtons.cpp +++ b/unity-shared/OverlayWindowButtons.cpp @@ -36,7 +36,7 @@ OverlayWindowButtons::OverlayWindowButtons() : nux::BaseWindow("OverlayWindowButtons") , window_buttons_(new WindowButtons()) { - window_buttons_->queue_draw.connect([&] (nux::Layout* /*layout*/) { + window_buttons_->queue_draw.connect([this] (nux::Layout* /*layout*/) { QueueDraw(); }); diff --git a/unity-shared/PanelStyle.cpp b/unity-shared/PanelStyle.cpp index ba0768224..5ce50c1fa 100644 --- a/unity-shared/PanelStyle.cpp +++ b/unity-shared/PanelStyle.cpp @@ -96,22 +96,22 @@ Style::Style() GtkSettings* settings = gtk_settings_get_default(); _style_changed_signal.Connect(settings, "notify::gtk-theme-name", - [&] (GtkSettings*, GParamSpec*) { + [this] (GtkSettings*, GParamSpec*) { Refresh(); }); _font_changed_signal.Connect(settings, "notify::gtk-font-name", - [&] (GtkSettings*, GParamSpec*) { + [this] (GtkSettings*, GParamSpec*) { changed.emit(); }); _dpi_changed_signal.Connect(settings, "notify::gtk-xft-dpi", - [&] (GtkSettings*, GParamSpec*) { + [this] (GtkSettings*, GParamSpec*) { changed.emit(); }); _settings_changed_signal.Connect(_gsettings, "changed::" + PANEL_TITLE_FONT_KEY, - [&] (GSettings*, gchar*) { + [this] (GSettings*, gchar*) { changed.emit(); }); diff --git a/unity-shared/RatingsButton.cpp b/unity-shared/RatingsButton.cpp index 45782d7e6..1ab69cca8 100644 --- a/unity-shared/RatingsButton.cpp +++ b/unity-shared/RatingsButton.cpp @@ -50,7 +50,7 @@ RatingsButton::RatingsButton(int star_size, int star_gap, NUX_FILE_LINE_DECL) mouse_move.connect(sigc::mem_fun(this, &RatingsButton::RecvMouseMove)); mouse_drag.connect(sigc::mem_fun(this, &RatingsButton::RecvMouseDrag)); - key_nav_focus_change.connect([&](nux::Area* area, bool has_focus, nux::KeyNavDirection direction) + key_nav_focus_change.connect([this](nux::Area* area, bool has_focus, nux::KeyNavDirection direction) { if (has_focus && direction != nux::KEY_NAV_NONE) focused_star_ = 0; @@ -59,7 +59,7 @@ RatingsButton::RatingsButton(int star_size, int star_gap, NUX_FILE_LINE_DECL) QueueDraw(); }); - key_nav_focus_activate.connect([&](nux::Area*) { SetRating(static_cast<float>(focused_star_+1)/num_stars); }); + key_nav_focus_activate.connect([this](nux::Area*) { SetRating(static_cast<float>(focused_star_+1)/num_stars); }); key_down.connect(sigc::mem_fun(this, &RatingsButton::OnKeyDown)); } diff --git a/unity-shared/SearchBar.cpp b/unity-shared/SearchBar.cpp index 3f300e91c..4c0482f05 100644 --- a/unity-shared/SearchBar.cpp +++ b/unity-shared/SearchBar.cpp @@ -167,8 +167,8 @@ void SearchBar::Init() pango_entry_->SetFontFamily(PANGO_ENTRY_DEFAULT_FONT_FAMILY.c_str()); pango_entry_->SetFontSize(PANGO_ENTRY_FONT_SIZE); pango_entry_->text_changed.connect(sigc::mem_fun(this, &SearchBar::OnSearchChanged)); - pango_entry_->activated.connect([&]() { activated.emit(); }); - pango_entry_->cursor_moved.connect([&](int i) { QueueDraw(); }); + pango_entry_->activated.connect([this]() { activated.emit(); }); + pango_entry_->cursor_moved.connect([this](int i) { QueueDraw(); }); pango_entry_->mouse_down.connect(sigc::mem_fun(this, &SearchBar::OnMouseButtonDown)); pango_entry_->end_key_focus.connect(sigc::mem_fun(this, &SearchBar::OnEndKeyFocus)); pango_entry_->key_up.connect([this] (unsigned int, unsigned long, unsigned long) { @@ -234,17 +234,17 @@ void SearchBar::Init() show_filters_->SetMaximumWidth(style.GetFilterBarWidth() - arrow_layout_->GetBaseWidth() - 8); // Lambda functions - auto mouse_expand = [&](int, int, unsigned long, unsigned long) + auto mouse_expand = [this](int, int, unsigned long, unsigned long) { showing_filters = !showing_filters; }; - auto key_redraw = [&](nux::Area*, bool, nux::KeyNavDirection) + auto key_redraw = [this](nux::Area*, bool, nux::KeyNavDirection) { QueueDraw(); }; - auto key_expand = [&](nux::Area*) + auto key_expand = [this](nux::Area*) { showing_filters = !showing_filters; }; @@ -261,13 +261,13 @@ void SearchBar::Init() sigc::mem_fun(this, &SearchBar::OnFontChanged)); OnFontChanged(gtk_settings_get_default()); - search_hint.changed.connect([&](std::string const& s) { OnSearchHintChanged(); }); + search_hint.changed.connect([this](std::string const& s) { OnSearchHintChanged(); }); search_string.SetGetterFunction(sigc::mem_fun(this, &SearchBar::get_search_string)); search_string.SetSetterFunction(sigc::mem_fun(this, &SearchBar::set_search_string)); im_active.SetGetterFunction(sigc::mem_fun(this, &SearchBar::get_im_active)); im_preedit.SetGetterFunction(sigc::mem_fun(this, &SearchBar::get_im_preedit)); showing_filters.changed.connect(sigc::mem_fun(this, &SearchBar::OnShowingFiltersChanged)); - can_refine_search.changed.connect([&] (bool can_refine) + can_refine_search.changed.connect([this] (bool can_refine) { if (show_filter_hint_) { diff --git a/unity-shared/SearchBarSpinner.cpp b/unity-shared/SearchBarSpinner.cpp index 645e64a76..7dba5ef19 100644 --- a/unity-shared/SearchBarSpinner.cpp +++ b/unity-shared/SearchBarSpinner.cpp @@ -176,7 +176,7 @@ SearchBarSpinner::SetState(SpinnerState state) if (search_timeout_ > 0 && state_== STATE_SEARCHING) { - spinner_timeout_.reset(new glib::Timeout(search_timeout_, [&] { + spinner_timeout_.reset(new glib::Timeout(search_timeout_, [this] { state_ = STATE_READY; return false; })); diff --git a/unity-shared/TextInput.cpp b/unity-shared/TextInput.cpp index 8a1929449..9969323bd 100644 --- a/unity-shared/TextInput.cpp +++ b/unity-shared/TextInput.cpp @@ -74,7 +74,7 @@ void TextInput::Init() pango_entry_ = new IMTextEntry(); pango_entry_->SetFontFamily(PANGO_ENTRY_DEFAULT_FONT_FAMILY.c_str()); pango_entry_->SetFontSize(PANGO_ENTRY_FONT_SIZE); - pango_entry_->cursor_moved.connect([&](int i) { QueueDraw(); }); + pango_entry_->cursor_moved.connect([this](int i) { QueueDraw(); }); pango_entry_->mouse_down.connect(sigc::mem_fun(this, &TextInput::OnMouseButtonDown)); pango_entry_->end_key_focus.connect(sigc::mem_fun(this, &TextInput::OnEndKeyFocus)); @@ -93,7 +93,7 @@ void TextInput::Init() input_string.SetSetterFunction(sigc::mem_fun(this, &TextInput::set_input_string)); im_active.SetGetterFunction(sigc::mem_fun(this, &TextInput::get_im_active)); im_preedit.SetGetterFunction(sigc::mem_fun(this, &TextInput::get_im_preedit)); - input_hint.changed.connect([&](std::string const& s) { OnInputHintChanged(); }); + input_hint.changed.connect([this](std::string const& s) { OnInputHintChanged(); }); } diff --git a/unity-shared/ThumbnailGenerator.cpp b/unity-shared/ThumbnailGenerator.cpp index fae86ad91..9eef47bab 100644 --- a/unity-shared/ThumbnailGenerator.cpp +++ b/unity-shared/ThumbnailGenerator.cpp @@ -187,7 +187,7 @@ ThumbnailNotifier::Ptr ThumbnailGeneratorImpl::GetThumbnail(std::string const& u if (!thread_create_timer_ && thumbnail_thread_is_running_ == false) { - thread_create_timer_.reset(new glib::Timeout(0, [&]() + thread_create_timer_.reset(new glib::Timeout(0, [this]() { thumbnail_thread_is_running_ = true; pthread_create (&thumbnail_thread_, NULL, thumbnail_thread_start, this); @@ -214,7 +214,7 @@ ThumbnailNotifier::Ptr ThumbnailGeneratorImpl::GetThumbnail(std::string const& u void ThumbnailGeneratorImpl::StartCleanupTimer() { if (!cleanup_timer_) - cleanup_timer_.reset(new glib::Timeout(CLEANUP_DURATION, [&]() { DoCleanup(); return false; })); + cleanup_timer_.reset(new glib::Timeout(CLEANUP_DURATION, [this]() { DoCleanup(); return false; })); } diff --git a/unity-shared/UBusServer.cpp b/unity-shared/UBusServer.cpp index 7016548a7..105983bfc 100644 --- a/unity-shared/UBusServer.cpp +++ b/unity-shared/UBusServer.cpp @@ -44,7 +44,7 @@ unsigned UBusServer::RegisterInterest(std::string const& interest_name, void UBusServer::UnregisterInterest(unsigned connection_id) { auto it = std::find_if(interests_.begin(), interests_.end(), - [&] (std::pair<std::string, UBusConnection::Ptr> const& p) + [connection_id] (std::pair<std::string, UBusConnection::Ptr> const& p) { return p.second->id == connection_id; }); if (it != interests_.end()) interests_.erase(it); } diff --git a/unity-shared/UScreen.cpp b/unity-shared/UScreen.cpp index 6812a8325..869383824 100644 --- a/unity-shared/UScreen.cpp +++ b/unity-shared/UScreen.cpp @@ -35,7 +35,7 @@ UScreen::UScreen() { size_changed_signal_.Connect(screen_, "size-changed", sigc::mem_fun(this, &UScreen::Changed)); monitors_changed_signal_.Connect(screen_, "monitors-changed", sigc::mem_fun(this, &UScreen::Changed)); - proxy_.Connect("Resuming", [&] (GVariant* data) { resuming.emit(); }); + proxy_.Connect("Resuming", [this] (GVariant* data) { resuming.emit(); }); Refresh(); } @@ -101,7 +101,7 @@ void UScreen::Changed(GdkScreen* screen) if (refresh_idle_) return; - refresh_idle_.reset(new glib::Idle([&] () { + refresh_idle_.reset(new glib::Idle([this] () { Refresh(); refresh_idle_.reset(); diff --git a/unity-shared/WindowButtons.cpp b/unity-shared/WindowButtons.cpp index d771b4e20..84836cbf9 100644 --- a/unity-shared/WindowButtons.cpp +++ b/unity-shared/WindowButtons.cpp @@ -262,17 +262,17 @@ WindowButtons::WindowButtons() controlled_window.changed.connect(sigc::mem_fun(this, &WindowButtons::OnControlledWindowChanged)); focused.changed.connect(sigc::hide(sigc::mem_fun(this, &WindowButtons::QueueDraw))); - auto lambda_enter = [&](int x, int y, unsigned long button_flags, unsigned long key_flags) + auto lambda_enter = [this](int x, int y, unsigned long button_flags, unsigned long key_flags) { mouse_enter.emit(x, y, button_flags, key_flags); }; - auto lambda_leave = [&](int x, int y, unsigned long button_flags, unsigned long key_flags) + auto lambda_leave = [this](int x, int y, unsigned long button_flags, unsigned long key_flags) { mouse_leave.emit(x, y, button_flags, key_flags); }; - auto lambda_moved = [&](int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags) + auto lambda_moved = [this](int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags) { mouse_move.emit(x, y, dx, dy, button_flags, key_flags); }; |
