2015-08-28 14:20:07 +02:00
|
|
|
var React = require('react');
|
2015-09-04 12:10:08 +02:00
|
|
|
var Util = require('../../util');
|
2015-08-28 14:20:07 +02:00
|
|
|
var DesktopAppItem = require('./desktop-app-item.jsx');
|
2015-08-31 23:08:56 +02:00
|
|
|
var IconThemeSelector = require('./icon-theme-selector.jsx');
|
2015-08-30 21:29:19 +02:00
|
|
|
var path = require('path');
|
2015-08-31 23:08:56 +02:00
|
|
|
var debug = require('debug')('pitaya:desktop-app-list');
|
2015-08-28 14:20:07 +02:00
|
|
|
|
|
|
|
module.exports = React.createClass({
|
|
|
|
|
|
|
|
getInitialState: function() {
|
|
|
|
return {
|
2015-08-31 23:08:56 +02:00
|
|
|
selectedTheme: null
|
2015-08-28 14:20:07 +02:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
render: function() {
|
|
|
|
|
2015-09-03 15:50:23 +02:00
|
|
|
var items = this.props.desktopApps.map(function(desktopApp, i) {
|
|
|
|
var desktopEntry = desktopApp.content['Desktop Entry'];
|
|
|
|
return <DesktopAppItem theme={this.state.selectedTheme} key={desktopApp.path} desktopEntry={desktopEntry} />;
|
2015-08-31 23:08:56 +02:00
|
|
|
}.bind(this));
|
2015-08-28 14:20:07 +02:00
|
|
|
|
|
|
|
return (
|
2015-08-31 23:08:56 +02:00
|
|
|
<div>
|
|
|
|
<IconThemeSelector onThemeSelected={this.onThemeSelected} />
|
|
|
|
<ul className="desktop-apps">
|
|
|
|
{items}
|
|
|
|
</ul>
|
|
|
|
</div>
|
2015-08-28 14:20:07 +02:00
|
|
|
);
|
|
|
|
|
2015-08-31 23:08:56 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
onThemeSelected: function(theme) {
|
|
|
|
console.log('Selected theme %s', theme);
|
|
|
|
this.setState({ selectedTheme: theme });
|
2015-08-28 14:20:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
});
|