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
|
|
@ -42,6 +42,10 @@
|
||||||
</item>
|
</item>
|
||||||
</section>
|
</section>
|
||||||
<section>
|
<section>
|
||||||
|
<item>
|
||||||
|
<attribute name="label" translatable="yes">_Help</attribute>
|
||||||
|
<attribute name="action">app.help</attribute>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
|
<attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
|
||||||
<attribute name="action">win.show-help-overlay</attribute>
|
<attribute name="action">win.show-help-overlay</attribute>
|
||||||
|
|
|
||||||
19
help/C/index.page
Normal file
19
help/C/index.page
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
<page xmlns="http://projectmallard.org/1.0/"
|
||||||
|
type="guide" style="task"
|
||||||
|
xmlns:its="http://www.w3.org/2005/11/its"
|
||||||
|
id="index">
|
||||||
|
|
||||||
|
<info>
|
||||||
|
<desc>Help for Loupe.</desc>
|
||||||
|
<title type='link' role="trail"><media its:translate="no" type="image" src="figures/org.gnome.eog-symbolic.svg"/></title>
|
||||||
|
<title type='link'>Loupe</title>
|
||||||
|
<title type='text'>Loupe</title>
|
||||||
|
<credit type="author copyright">
|
||||||
|
<name>Christopher Davis</name>
|
||||||
|
<email>christopherdavis@gnome.org</email>
|
||||||
|
<years>2020</years>
|
||||||
|
</credit>
|
||||||
|
</info>
|
||||||
|
|
||||||
|
<title>Loupe</title>
|
||||||
|
</page>
|
||||||
8
help/meson.build
Normal file
8
help/meson.build
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
sources = [
|
||||||
|
'index.page'
|
||||||
|
]
|
||||||
|
|
||||||
|
gnome.yelp(
|
||||||
|
meson.project_name(),
|
||||||
|
sources: sources,
|
||||||
|
)
|
||||||
|
|
@ -53,6 +53,7 @@ conf.set('localedir', iv_localedir)
|
||||||
conf.set('pkgdatadir', iv_pkgdatadir)
|
conf.set('pkgdatadir', iv_pkgdatadir)
|
||||||
|
|
||||||
subdir('data')
|
subdir('data')
|
||||||
|
subdir('help')
|
||||||
subdir('src')
|
subdir('src')
|
||||||
subdir('po')
|
subdir('po')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,11 @@
|
||||||
|
|
||||||
use crate::deps::*;
|
use crate::deps::*;
|
||||||
use crate::util::gettext::*;
|
use crate::util::gettext::*;
|
||||||
|
use crate::util::spawn;
|
||||||
|
|
||||||
use adw::prelude::*;
|
use adw::prelude::*;
|
||||||
use adw::subclass::prelude::*;
|
use adw::subclass::prelude::*;
|
||||||
|
use glib::clone;
|
||||||
|
|
||||||
use crate::config;
|
use crate::config;
|
||||||
use crate::window::LpWindow;
|
use crate::window::LpWindow;
|
||||||
|
|
@ -112,6 +114,9 @@ impl LpApplication {
|
||||||
gio::ActionEntryBuilder::new("about")
|
gio::ActionEntryBuilder::new("about")
|
||||||
.activate(|app: &Self, _, _| app.show_about())
|
.activate(|app: &Self, _, _| app.show_about())
|
||||||
.build(),
|
.build(),
|
||||||
|
gio::ActionEntryBuilder::new("help")
|
||||||
|
.activate(|app: &Self, _, _| app.show_help())
|
||||||
|
.build(),
|
||||||
gio::ActionEntryBuilder::new("quit")
|
gio::ActionEntryBuilder::new("quit")
|
||||||
.activate(|app: &Self, _, _| app.quit())
|
.activate(|app: &Self, _, _| app.quit())
|
||||||
.build(),
|
.build(),
|
||||||
|
|
@ -125,6 +130,7 @@ impl LpApplication {
|
||||||
|
|
||||||
self.add_action_entries(actions);
|
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.quit", &["<Ctrl>Q"]);
|
||||||
self.set_accels_for_action("app.new-window", &["<Ctrl>N"]);
|
self.set_accels_for_action("app.new-window", &["<Ctrl>N"]);
|
||||||
|
|
||||||
|
|
@ -207,4 +213,16 @@ impl LpApplication {
|
||||||
|
|
||||||
about.present();
|
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