<root>
<variable name="normal_view" action="change" value="normal_view" />
<variable name="icon_view" action="change" value="icon_view" />
<variable name="view_mode" action="change" value="normal_view" />
<variable name="false" value="false" action="change" />
<variable name="true" value="true" action="change" />
<menu>
<template path="/actions/*">
<submenu dir-for="label">
<attr-connect name="label" function="last-dir" />
<template path="*">
<item dir-for="label,event">
<icon dir-for="icon" width="8" height="8" />
<attr-connect name="label" function="last-dir" />
</item>
</template>
</submenu>
</template>
<submenu label="view">
<item label="switch">
<handler>
<variable action="change" name="changed" variable="false" />
<if type="equal" variable1="view_mode" variable2="normal_view">
   <variable name="view_mode" action="change" value="icon_view" />
   <variable action="change" name="changed" variable="true" />
</if>
<if type="equal" variable1="changed" variable2="false">
<if type="equal" variable1="view_mode" variable2="icon_view">
   <variable name="view_mode" action="change" value="normal_view" />
</if>
</if>
</handler>
</item>
</submenu>
</menu>

<hbox>
<vbox>
<template path="/fileviews/*/list/items/*">
<variable name="name" action="change" function="path" />
<variable name="name" action="append" value="/name" />
<attr-connect name="widget-name" variable="name" />
<template path="data/*">
<hbox>
  <variable name="column-path" action="change" value="/fileviews/" />
  <variable name="column-path" action="append" function="nth-dir" param="2" />
  <variable name="column-path" action="append" value="/list/columns/" />
  <variable name="column-path" action="append" function="last-dir" />
  <label>
    <attr-connect name="label" function="last-dir" />
    <attr-connect name="label" function="label" param="column-path" />'
  </label>
  <label dir-for="label" />
</hbox>
</template>
<hide />
</template>
</vbox>
<template path="/fileviews/*">
<vbox>
<template path="path_edit">
<edit dir-for="input,output,event" />
</template>
<switch variable="view_mode">
<if type="equal" variable1="normal_view" variable2=".switch_value">
<list>
<template path="list/columns/*">
  <column dir-for="label">
    <attr-connect name="name" function="last-dir" />
    <attr-connect name="label" function="last-dir" />
  </column>
</template>
<template path="list/items/*">
  <selection>
    <template path="selected">
       <handler>
          <hide name="path" />
          <variable name="path" action="change" function="remove_last_dir" />
          <variable name="path" action="append" value="/name" />
          <variable name="call-path" action="change" function="path" />
          <show name="path" />
          <call var="call-path" />
       </handler>
    </template>
    <template path="data/*">
       <data dir-for="label">
         <attr-connect name="column-name" function="last-dir" />
         <attr-connect name="label" function="last-dir" />
       </data>
    </template>
  </selection>
</template>
</list>
</if>
<if type="equal" variable1="icon_view" variable2=".switch_value">
<custom:icon-view> 
 <template path="list/items/*">
  <custom:select-item>
     <template path="selected">
       <handler>
          <hide name="path" />
          <variable name="path" action="change" function="remove_last_dir" />
          <variable name="path" action="append" value="/name" />
          <variable name="call-path" action="change" function="path" />
          <show name="path" />
          <call var="call-path" />
       </handler>
    </template>
    <template path="data/name">
       <label dir-for="label">
          <attr-connect name="label" function="last-dir" />
       </label>
       <icon dir-for="icon" />
    </template>
  </custom:select-item>
</template>
</custom:icon-view>
</if>
</switch>
</vbox>
</template>
</hbox>
</root>
