pub struct Apps { /* private fields */ }Expand description
The installed programs and the person’s and the system’s choices of which opens what.
Implementations§
Source§impl Apps
impl Apps
Sourcepub fn load(dirs: &XdgDirs, lang: &str, path_var: Option<&OsStr>) -> Self
pub fn load(dirs: &XdgDirs, lang: &str, path_var: Option<&OsStr>) -> Self
Reads the desktop entries below applications in every data folder and every
mimeapps.list.
Of two entries with the same id the first found wins, so the person’s own copy overrides
the system’s, and an entry marked Hidden hides the system’s copy as well as itself. Only
Type=Application entries count. An entry whose TryExec program is not installed is
dropped: an absolute path must be an executable file, a bare name is looked for in the
folders of path_var. Entries marked NoDisplay are kept, since they are left out of
menus but still open files. lang (tr_TR.UTF-8) picks the name: Name[tr_TR], then
Name[tr], then Name. An application entry without a name, without an Exec line or
with one that cannot be split is skipped with a Diagnostic, as is a line that cannot
be read; its id stays taken, so a broken copy of the person’s never brings back the
system’s.
Sourcepub fn diagnostics(&self) -> &[Diagnostic]
pub fn diagnostics(&self) -> &[Diagnostic]
The problems found while reading, in the order the files were read.
Sourcepub fn all(&self) -> &[DesktopApp]
pub fn all(&self) -> &[DesktopApp]
Every installed program, in the order found: the person’s own folder first, each folder
in name order. A launcher leaves out the ones whose entry says NoDisplay.
Sourcepub fn get(&self, id: &str) -> Option<&DesktopApp>
pub fn get(&self, id: &str) -> Option<&DesktopApp>
The program with this desktop file id, when it is installed.
Sourcepub fn for_mime(&self, db: &MimeDb, mime: &str) -> Vec<&DesktopApp>
pub fn for_mime(&self, db: &MimeDb, mime: &str) -> Vec<&DesktopApp>
The programs that open a file of kind mime, the most fitting first, each once.
For mime and then each kind it is a special case of (MimeDb::ancestors): the
defaults mimeapps.list names for it, then its [Added Associations], then the programs
whose entries list it. A program in the [Removed Associations] of a kind is left out for
that kind, unless a more important file adds it back. The mimeapps.list files are read
in this order, the first the most important: <desktop>-mimeapps.list for each running
desktop and then mimeapps.list, in the person’s configuration folder, in each system
configuration folder, then below applications in the person’s data folder and in each
system data folder. A listed id that is not installed is passed over.
Sourcepub fn default_for(&self, db: &MimeDb, mime: &str) -> Option<&DesktopApp>
pub fn default_for(&self, db: &MimeDb, mime: &str) -> Option<&DesktopApp>
The program a file of kind mime opens with when nothing else is asked for: the one
[Default Applications] names for the kind or, failing that, for the nearest kind it is a
special case of; else the first of for_mime; else None.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Apps
impl RefUnwindSafe for Apps
impl Send for Apps
impl Sync for Apps
impl Unpin for Apps
impl UnsafeUnpin for Apps
impl UnwindSafe for Apps
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more