Revert "general: Remove help-related code"
This reverts commit 2965799374.
Part-of: <https://gitlab.gnome.org/GNOME/Incubator/loupe/-/merge_requests/248>
This commit is contained in:
parent
45083720a3
commit
9e70931faf
5 changed files with 50 additions and 0 deletions
|
|
@ -20,9 +20,11 @@
|
|||
|
||||
use crate::deps::*;
|
||||
use crate::util::gettext::*;
|
||||
use crate::util::spawn;
|
||||
|
||||
use adw::prelude::*;
|
||||
use adw::subclass::prelude::*;
|
||||
use glib::clone;
|
||||
|
||||
use crate::config;
|
||||
use crate::window::LpWindow;
|
||||
|
|
@ -112,6 +114,9 @@ impl LpApplication {
|
|||
gio::ActionEntryBuilder::new("about")
|
||||
.activate(|app: &Self, _, _| app.show_about())
|
||||
.build(),
|
||||
gio::ActionEntryBuilder::new("help")
|
||||
.activate(|app: &Self, _, _| app.show_help())
|
||||
.build(),
|
||||
gio::ActionEntryBuilder::new("quit")
|
||||
.activate(|app: &Self, _, _| app.quit())
|
||||
.build(),
|
||||
|
|
@ -125,6 +130,7 @@ impl LpApplication {
|
|||
|
||||
self.add_action_entries(actions);
|
||||
|
||||
self.set_accels_for_action("app.help", &["F1"]);
|
||||
self.set_accels_for_action("app.quit", &["<Ctrl>Q"]);
|
||||
self.set_accels_for_action("app.new-window", &["<Ctrl>N"]);
|
||||
|
||||
|
|
@ -207,4 +213,16 @@ impl LpApplication {
|
|||
|
||||
about.present();
|
||||
}
|
||||
|
||||
pub fn show_help(&self) {
|
||||
spawn(clone!(@weak self as app => async move {
|
||||
let context = app
|
||||
.active_window()
|
||||
.map(|w| gtk::prelude::WidgetExt::display(&w).app_launch_context());
|
||||
|
||||
if let Err(e) = gio::AppInfo::launch_default_for_uri_future("help:loupe", context.as_ref()).await {
|
||||
log::error!("Failed to launch help: {}", e.message());
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue