38 lines
840 B
React
38 lines
840 B
React
|
var React = require('react');
|
||
|
var Util = require('../util');
|
||
|
var DesktopAppItem = require('./desktop-app-item.jsx');
|
||
|
|
||
|
module.exports = React.createClass({
|
||
|
|
||
|
getInitialState: function() {
|
||
|
return {
|
||
|
desktopFiles: []
|
||
|
};
|
||
|
},
|
||
|
|
||
|
componentDidMount: function() {
|
||
|
// Load system desktop apps
|
||
|
Util.DesktopApps.loadAllDesktopFiles('/usr/share/applications')
|
||
|
.then(function(desktopFiles) {
|
||
|
this.setState({ desktopFiles: desktopFiles });
|
||
|
}.bind(this))
|
||
|
;
|
||
|
},
|
||
|
|
||
|
render: function() {
|
||
|
|
||
|
var items = this.state.desktopFiles.map(function(desktopFile, i) {
|
||
|
var desktopEntry = desktopFile.content['Desktop Entry'];
|
||
|
return <DesktopAppItem key={desktopFile.path} desktopEntry={desktopEntry} />;
|
||
|
});
|
||
|
|
||
|
return (
|
||
|
<ul className="desktop-apps">
|
||
|
{items}
|
||
|
</ul>
|
||
|
);
|
||
|
|
||
|
}
|
||
|
|
||
|
});
|