B2G/gaia/apps/homescreen/js/grid.js
/*
   * Create or update a single icon for an Application (or Bookmark) object.
   */
Create or update a single icon for an Application (or Bookmark) object.
Create or update a single icon for an Application ( or Bookmark ) object .
function createOrUpdateIconForApp(app, entryPoint) {
    if (!app.isBookmark) {
      app.ondownloadapplied = function ondownloadapplied(event) {
        createOrUpdateIconForApp(event.application, entryPoint);
        app.ondownloadapplied = null;
        app.ondownloaderror = null;
      };
      app.ondownloaderror = function ondownloaderror(event) {
        createOrUpdateIconForApp(app, entryPoint);
      };
    }
    var manifest = app.manifest ? app.manifest : app.updateManifest;
    var iconsAndNameHolder = manifest;
    if (entryPoint)
      iconsAndNameHolder = manifest.entry_points[entryPoint];
    iconsAndNameHolder = new ManifestHelper(iconsAndNameHolder);
    var descriptor = {
      bookmarkURL: app.bookmarkURL,
      manifestURL: app.manifestURL,
      entry_point: entryPoint,
      updateTime: app.updateTime,
      removable: app.removable,
      name: iconsAndNameHolder.name,
      icon: bestMatchingIcon(app, iconsAndNameHolder),
      useAsyncPanZoom: app.useAsyncPanZoom
    };
    if (haveLocale && !app.isBookmark) {
      descriptor.localizedName = iconsAndNameHolder.name;
    }
    var existingIcon = getIcon(descriptor);
    if (existingIcon) {
      existingIcon.update(descriptor, app);
      markDirtyState();
      return;
    }
    var icon = new Icon(descriptor, app);
    rememberIcon(icon);
    var index = getFirstPageWithEmptySpace();
    if (index < pages.length) {
      pages[index].appendIcon(icon);
    } else {
      pageHelper.addPage([icon]);
    }
    markDirtyState();
  }
function createOrUpdateIconForApp ( app , entryPoint ) { if ( ! app . isBookmark ) { app . ondownloadapplied = function ondownloadapplied ( event ) { createOrUpdateIconForApp ( event . application , entryPoint ) ; app . ondownloadapplied = null ; app . ondownloaderror = null ; } ; app . ondownloaderror = function ondownloaderror ( event ) { createOrUpdateIconForApp ( app , entryPoint ) ; } ; } var manifest = app . manifest ? app . manifest : app . updateManifest ; var iconsAndNameHolder = manifest ; if ( entryPoint ) iconsAndNameHolder = manifest . entry_points [ entryPoint ] ; iconsAndNameHolder = new ManifestHelper ( iconsAndNameHolder ) ; var descriptor = { bookmarkURL : app . bookmarkURL , manifestURL : app . manifestURL , entry_point : entryPoint , updateTime : app . updateTime , removable : app . removable , name : iconsAndNameHolder . name , icon : bestMatchingIcon ( app , iconsAndNameHolder ) , useAsyncPanZoom : app . useAsyncPanZoom } ; if ( haveLocale && ! app . isBookmark ) { descriptor . localizedName = iconsAndNameHolder . name ; } var existingIcon = getIcon ( descriptor ) ; if ( existingIcon ) { existingIcon . update ( descriptor , app ) ; markDirtyState ( ) ; return ; } var icon = new Icon ( descriptor , app ) ; rememberIcon ( icon ) ; var index = getFirstPageWithEmptySpace ( ) ; if ( index < pages . length ) { pages [ index ] . appendIcon ( icon ) ; } else { pageHelper . addPage ( [ icon ] ) ; } markDirtyState ( ) ; }
Create or update a single icon for an Application (or Bookmark) object.
Create or update a single icon for an Application ( or Bookmark ) object .
// Make sure we update the icon/label when the app is updated. // If there's an existing icon for this bookmark/app/entry point already, // let it update itself.