+
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 15 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ notify-rust = { version = "4", optional = true }
packagekit-zbus = { version = "0.1", optional = true }

[dependencies.libcosmic]
git = "https://github.com/pop-os/libcosmic.git"
git = "https://github.com/jpttrssn/libcosmic.git"
branch = "launch-app-in-term"
default-features = false
features = ["multi-window", "tokio", "winit"]

Expand Down
42 changes: 20 additions & 22 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -724,35 +724,34 @@ impl App {
return None;
}
};
let entry = match freedesktop_entry_parser::parse_entry(&path) {
Ok(ok) => ok,
Err(err) => {
log::warn!("failed to read desktop file {:?}: {}", path, err);
let entry = match cosmic::desktop::load_desktop_file(None, &path) {
Some(entry) => entry,
None => {
log::warn!("failed to read desktop file {:?}", path);
return None;
}
};
//TODO: handle Terminal=true
let exec = match entry.section("Desktop Entry").attr("Exec") {
let exec = match entry.exec {
Some(some) => some,
None => {
log::warn!("no exec section in {:?}", path);
return None;
}
};
//TODO: use libcosmic for loading desktop data
Some((exec.to_string(), desktop_id))
Some((exec, desktop_id, entry.terminal))
})
.await
.unwrap_or(None)
},
|result| {
#[cfg(feature = "desktop")]
if let Some((exec, desktop_id)) = result {
if let Some((exec, desktop_id, terminal)) = result {
tokio::spawn(async move {
cosmic::desktop::spawn_desktop_exec(
&exec,
Vec::<(&str, &str)>::new(),
Some(&desktop_id),
terminal,
)
.await;
});
Expand Down Expand Up @@ -2993,26 +2992,25 @@ impl Application for App {
let (operation, err) = self.failed_operations.get(id)?;

let (title, body) = operation.failed_dialog(&err);
widget::dialog(title)
widget::dialog()
.title(title)
.body(body)
.icon(widget::icon::from_name("dialog-error").size(64))
//TODO: retry action
.primary_action(
widget::button::standard(fl!("cancel")).on_press(Message::DialogCancel),
)
}
DialogPage::Uninstall(_backend_name, _id, info) => {
widget::dialog(fl!("uninstall-app", name = info.name.as_str()))
.body(fl!("uninstall-app-warning", name = info.name.as_str()))
.icon(widget::icon::from_name(Self::APP_ID).size(64))
.primary_action(
widget::button::destructive(fl!("uninstall"))
.on_press(Message::DialogConfirm),
)
.secondary_action(
widget::button::standard(fl!("cancel")).on_press(Message::DialogCancel),
)
}
DialogPage::Uninstall(_backend_name, _id, info) => widget::dialog()
.title(fl!("uninstall-app", name = info.name.as_str()))
.body(fl!("uninstall-app-warning", name = info.name.as_str()))
.icon(widget::icon::from_name(Self::APP_ID).size(64))
.primary_action(
widget::button::destructive(fl!("uninstall")).on_press(Message::DialogConfirm),
)
.secondary_action(
widget::button::standard(fl!("cancel")).on_press(Message::DialogCancel),
),
};

Some(dialog.into())
Expand Down
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载