~brandontschaefer/unity/disable-super-tap-detection

« back to all changes in this revision

Viewing changes to dash/LensView.cpp

  • Committer: Tarmac
  • Author(s): Nick Dedekind
  • Date: 2012-10-02 12:55:23 UTC
  • mfrom: (2740.6.5 unity.other)
  • Revision ID: tarmac-20121002125523-opojuwgxnkydpzbu
Immediate feedback for dash preview activation.. Fixes: https://bugs.launchpad.net/bugs/1043808. Approved by Gord Allott, Brandon Schaefer.

Show diffs side-by-side

added added

removed removed

Lines of Context:
344
344
  grid->expanded = false;
345
345
 
346
346
  group->SetRendererName(renderer_name.c_str());
347
 
  grid->UriActivated.connect(sigc::bind([&] (std::string const& uri, ResultView::ActivateType type, std::string const& view_id) 
 
347
  grid->UriActivated.connect(sigc::bind([&] (std::string const& uri, ResultView::ActivateType type, GVariant* data, std::string const& view_id) 
348
348
  {
 
349
    uri_activated.emit(type, uri, data, view_id); 
349
350
    switch (type)
350
351
    {
351
352
      case ResultView::ActivateType::DIRECT:
352
353
      {
353
 
        uri_activated.emit(uri); 
354
354
        lens_->Activate(uri);  
355
355
      } break;
356
356
      case ResultView::ActivateType::PREVIEW:
357
357
      {
358
 
        uri_preview_activated.emit(uri, view_id);
359
358
        lens_->Preview(uri);
360
359
      } break;
361
360
      default: break;
450
449
  return static_cast<ResultViewGrid*>(group->GetChildView());
451
450
}
452
451
 
 
452
ResultView* LensView::GetResultViewForCategory(unsigned category_index)
 
453
{
 
454
  if (category_index >= categories_.size()) return nullptr;
 
455
  PlacesGroup* group = categories_.at(category_index);
 
456
  return static_cast<ResultView*>(group->GetChildView());
 
457
}
 
458
 
453
459
void LensView::OnResultAdded(Result const& result)
454
460
{
455
461
  try {
718
724
    for (unsigned int i = 0; i < category_order.size(); i++)
719
725
    {
720
726
      unsigned cat_index = category_order.at(i);
721
 
      ResultViewGrid* grid = GetGridForCategory(cat_index);
722
 
      if (grid == nullptr) continue;
723
 
      auto it = grid->GetIteratorAtRow(0);
 
727
      ResultView* result_view = GetResultViewForCategory(cat_index);
 
728
      if (result_view == nullptr) continue;
 
729
      auto it = result_view->GetIteratorAtRow(0);
724
730
      if (!it.IsLast())
725
731
      {
726
732
        Result result(*it);
727
 
        uri_activated(result.uri);
728
 
        lens_->Activate(result.uri);
 
733
        result_view->Activate(result.uri, result_view->GetIndexForUri(result.uri), ResultView::ActivateType::DIRECT);
729
734
        return;
730
735
      }
731
736
    }
 
737
 
732
738
    // Fallback
733
739
    Result result = results->RowAtIndex(0);
734
740
    if (result.uri != "")
735
741
    {
736
 
      uri_activated(result.uri);
 
742
      uri_activated.emit(ResultView::ActivateType::DIRECT, result.uri, nullptr, "");
737
743
      lens_->Activate(result.uri);
738
744
    }
739
745
  }