~bregma/unity-scope-home/lp-1430063

« back to all changes in this revision

Viewing changes to src/scope.vala

  • Committer: Tarmac
  • Author(s): Pawel Stolowski
  • Date: 2013-10-25 12:32:39 UTC
  • mfrom: (176.1.5 preview-click-events)
  • Revision ID: tarmac-20131025123239-cr9szp8mdoh80wst
Collect click metrics for preview actions. Fixes: https://bugs.launchpad.net/bugs/1243623.

Approved by Michal Hruby, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
  private KeywordSearch keywords_search = new KeywordSearch ();
44
44
  private bool smart_scopes_initialized = false;
45
45
  public bool smart_scopes_ready { get; internal set; default = false; }
46
 
  private SmartScopes.SmartScopeClientInterface sss_client = null;
 
46
  internal SmartScopes.SmartScopeClientInterface sss_client = null;
47
47
  private SmartScopes.ChannelIdMap channel_id_map = new SmartScopes.ChannelIdMap ();
48
48
  private uint metrics_timer;
49
49
  private int remote_scopes_retry_count = 0;
439
439
    debug ("Adding activation metrics record for scope %s, action_type=%u", scope_id, action_type);
440
440
    var timestamp = new DateTime.now_utc ();
441
441
 
442
 
    if (action_type == Unity.Protocol.ActionType.ACTIVATE_RESULT)
 
442
    if (action_type == Unity.Protocol.ActionType.ACTIVATE_RESULT 
 
443
        || action_type == Unity.Protocol.ActionType.PREVIEW_ACTION)
443
444
    {
444
445
      sss_client.add_click_event (session_id, server_sid, scope_id, timestamp);
445
446
    }
546
547
 
547
548
    if (!scope_mgr.remote_content_search || sss_client == null ||
548
549
        (activation.action_type != Unity.Protocol.ActionType.ACTIVATE_RESULT &&
549
 
         activation.action_type != Unity.Protocol.ActionType.PREVIEW_RESULT))
 
550
         activation.action_type != Unity.Protocol.ActionType.PREVIEW_RESULT &&
 
551
         activation.action_type != Unity.Protocol.ActionType.PREVIEW_ACTION))
550
552
      return null; //nothing to do
551
553
 
552
554
    string? server_sid = channel_id_map.server_sid_for_channel (activation.channel_id);
582
584
      return null;
583
585
    }
584
586
 
 
587
    // at this point it can only be a remote scope activation request;
 
588
    // if it's a preview action, then take activation uri from the id
 
589
    // and make the Dash go there via goto_uri argument.
 
590
    if (activation.action_type == Unity.Protocol.ActionType.PREVIEW_ACTION)
 
591
    {
 
592
      string action_id = activation.hints["preview-action-id"].get_string ();
 
593
      return new ActivationResponse (Unity.HandledType.NOT_HANDLED, action_id);
 
594
    }
 
595
 
585
596
    if (activation.action_type == Unity.Protocol.ActionType.PREVIEW_RESULT)
586
597
    {
587
598
      try