~jamesh/unity-lens-applications/index-local-scopes

« back to all changes in this revision

Viewing changes to src/daemon.vala

  • Committer: James Henstridge
  • Date: 2013-04-24 09:23:55 UTC
  • Revision ID: james@jamesh.id.au-20130424092355-1jnb3c0py0twd2nx
Show previews of local scopes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1478
1478
 
1479
1479
        // figure out if the scope is remote
1480
1480
        bool is_remote_scope = false;
 
1481
        var info = scopesearcher.get_by_desktop_file (scope_id);
 
1482
 
1481
1483
        Dee.ModelIter found_iter = null;
1482
 
        var iter = remote_scopes_model.get_first_iter ();
1483
 
        var end_iter = remote_scopes_model.get_last_iter ();
1484
 
        while (iter != end_iter)
 
1484
        if (info == null)
1485
1485
        {
1486
 
          if (remote_scopes_model.get_string (iter, 0) == scope_id)
 
1486
          var iter = remote_scopes_model.get_first_iter ();
 
1487
          var end_iter = remote_scopes_model.get_last_iter ();
 
1488
          while (iter != end_iter)
1487
1489
          {
1488
 
            is_remote_scope = true;
1489
 
            found_iter = iter;
1490
 
            break;
 
1490
            if (remote_scopes_model.get_string (iter, 0) == scope_id)
 
1491
            {
 
1492
              is_remote_scope = true;
 
1493
              found_iter = iter;
 
1494
              break;
 
1495
            }
 
1496
            iter = remote_scopes_model.next (iter);
1491
1497
          }
1492
 
          iter = remote_scopes_model.next (iter);
1493
1498
        }
1494
1499
 
1495
1500
        if (is_remote_scope)
1519
1524
                                                  description,
1520
1525
                                                  icon,
1521
1526
                                                  screenshot);
 
1527
        }
 
1528
        else if (info != null)
 
1529
        {
 
1530
          var name = info.application_name;
 
1531
          if (name == null || name == "")
 
1532
            name = info.desktop_file;
 
1533
          // XXX: add this to package info.
 
1534
          var description = "";
 
1535
          Icon? icon = null;
 
1536
          try
 
1537
          {
 
1538
            if (info.icon != null && info.icon != "")
 
1539
              icon = Icon.new_for_string (info.icon);
 
1540
          }
 
1541
          catch (Error err)
 
1542
          {
 
1543
            warning ("%s", err.message);
 
1544
          }
 
1545
          if (icon == null)
 
1546
            icon = get_default_scope_icon ();
 
1547
 
 
1548
          preview = new Unity.ApplicationPreview (name,
 
1549
                                                  "",
 
1550
                                                  description,
 
1551
                                                  icon,
 
1552
                                                  null);
 
1553
        }
 
1554
        if (preview != null) {
1522
1555
          PreviewAction action;
1523
1556
          if (scope_disabled)
1524
1557
          {