<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:browser="http://namespaces.zope.org/browser"
    xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
    xmlns:plone="http://namespaces.plone.org/plone"
    i18n_domain="untranslated"
    >

  <!-- override plone.app.theming policy adapter -->
  <adapter
      factory=".policy.SwitchableThemingPolicy"
      provides="ploneintranet.themeswitcher.interfaces.ISwitchableThemingPolicy"
      for="ploneintranet.themeswitcher.interfaces.IThemeSwitcher"
      />

  <!-- remove browser layers and bundles if necessary -->
  <subscriber
      for="plone.app.layout.navigation.interfaces.INavigationRoot
           zope.traversing.interfaces.IBeforeTraverseEvent"
      handler=".policy.filter_request"
      />

  <!-- @@switch_theme view used as site action
         zope.Public is safe here, returns a redirect
    -->
  <browser:page
      name="switch_theme"
      for="*"
      class=".action.SwitchThemeView"
      permission="zope.Public"
      layer="ploneintranet.themeswitcher.interfaces.IThemeSwitcher"
      />

  <genericsetup:registerProfile
      name="default"
      title="Plone Intranet: -- [Themeswitcher]"
      description="Enables on-the-fly theme switching"
      provides="Products.GenericSetup.interfaces.EXTENSION"
      for="Products.CMFPlone.interfaces.IPloneSiteRoot"
      directory="profiles/default"
      />

  <genericsetup:registerProfile
      name="uninstall"
      title="Plone Intranet: -- [Themeswitcher uninstall]"
      description="Enables on-the-fly theme switching"
      provides="Products.GenericSetup.interfaces.EXTENSION"
      directory="profiles/uninstall"
      />

  <genericsetup:registerProfile
      name="testing"
      title="Plone Intranet: -- [Themeswitcher: Testing]"
      description="Installs testthemeA for test purposes"
      provides="Products.GenericSetup.interfaces.EXTENSION"
      for="Products.CMFPlone.interfaces.IPloneSiteRoot"
      directory="profiles/testing"
      />

  <plone:static
      directory="static/themeA"
      name="ploneintranet.themeswitcher.testthemeA"
      type="theme"
      />

  <subscriber
      for="zope.processlifetime.IProcessStarting"
      handler=".dbconfig.dbconfig"
      />
</configure>
