static void
cache_by_id (ShellAppSystem *self, GSList *apps)
{
  GSList *iter;

  for (iter = apps; iter; iter = iter->next)
    {
      ShellAppInfo *info = iter->data;
      shell_app_info_ref (info);
      /* the name is owned by the info itself */
      g_hash_table_replace (self->priv->app_id_to_info, (char*)shell_app_info_get_id (info),
                            info);
    }
}
/* ShellAppSystem ensures we have a unique instance of
 * apps per id.
 */
void
_shell_app_system_register_app (ShellAppSystem   *self,
                                ShellApp         *app)
{
  const char *id;
  ShellAppRef *ref;

  id = shell_app_get_id (app);

  g_return_if_fail (g_hash_table_lookup (self->priv->app_id_to_app, id) == NULL);

  ref = g_new0 (ShellAppRef, 1);
  ref->appsys = self;
  ref->info = shell_app_info_ref (_shell_app_get_info (app));
  g_hash_table_insert (self->priv->app_id_to_app, (char*)shell_app_info_get_id (ref->info), app);
  g_object_weak_ref (G_OBJECT (app), shell_app_system_on_app_weakref, ref);
}
static void
cache_by_id (ShellAppSystem *self, GSList *apps)
{
  GSList *iter;

  for (iter = apps; iter; iter = iter->next)
    {
      ShellAppInfo *info = iter->data;
      const char *id = shell_app_info_get_id (info);
      char *prefix = shell_app_info_get_prefix (info);

      shell_app_info_ref (info);
      /* the name is owned by the info itself */

      if (prefix
          && !g_slist_find_custom (self->priv->known_vendor_prefixes, prefix,
                                   (GCompareFunc)g_strcmp0))
        self->priv->known_vendor_prefixes = g_slist_append (self->priv->known_vendor_prefixes,
                                                            prefix);
      else
        g_free (prefix);
      g_hash_table_replace (self->priv->app_id_to_info, (char*)id, info);
    }
}