gdritter repos xdg-desktop / master
Add some predicates on DesktopEntry Getty Ritter 6 years ago
1 changed file(s) with 21 addition(s) and 0 deletion(s). Collapse all Expand all
245245 }
246246
247247 impl DesktopEntry {
248 pub fn is_application(&self) -> bool {
249 match self.typ {
250 EntryType::Application(_) => true,
251 _ => false,
252 }
253 }
254
255 pub fn is_directory(&self) -> bool {
256 match self.typ {
257 EntryType::Directory => true,
258 _ => false,
259 }
260 }
261
262 pub fn is_link(&self) -> bool {
263 match self.typ {
264 EntryType::Link(_) => true,
265 _ => false,
266 }
267 }
268
248269 pub fn from_file<R: Read>(reader: &mut R) -> Result<DesktopEntry, Error> {
249270 let mut bags = parser::bags_from_file(reader)?;
250271 DesktopEntry::from_bags(&mut bags)