+ Geary Help
+ Documentation coming soon
+
+
diff --git a/src/client/geary-application.vala b/src/client/geary-application.vala
index 315ae46b..50af79f8 100644
--- a/src/client/geary-application.vala
+++ b/src/client/geary-application.vala
@@ -128,7 +128,7 @@ along with Geary; if not, write to the Free Software Foundation, Inc.,
public override int startup() {
exec_dir = (File.new_for_path(Environment.find_program_in_path(args[0]))).get_parent();
- Configuration.init(GearyApplication.instance.get_install_dir() != null, GSETTINGS_DIR);
+ Configuration.init(is_installed(), GSETTINGS_DIR);
int result = base.startup();
result = parse_arguments(args);
@@ -286,7 +286,11 @@ along with Geary; if not, write to the Free Software Foundation, Inc.,
public File get_exec_dir() {
return exec_dir;
}
-
+
+ public bool is_installed() {
+ return exec_dir.has_prefix(File.new_for_path(INSTALL_PREFIX));
+ }
+
// Returns the installation directory, or null if we're running outside of the installation
// directory.
public File? get_install_dir() {
diff --git a/src/client/geary-controller.vala b/src/client/geary-controller.vala
index 9efe33c1..6d7a53b7 100644
--- a/src/client/geary-controller.vala
+++ b/src/client/geary-controller.vala
@@ -35,6 +35,7 @@ public class GearyController {
}
// Named actions.
+ public const string ACTION_HELP = "GearyHelp";
public const string ACTION_ABOUT = "GearyAbout";
public const string ACTION_QUIT = "GearyQuit";
public const string ACTION_NEW_MESSAGE = "GearyNewMessage";
@@ -126,7 +127,11 @@ public class GearyController {
null, on_preferences };
prefs.label = _("_Preferences");
entries += prefs;
-
+
+ Gtk.ActionEntry help = { ACTION_HELP, Gtk.Stock.HELP, TRANSLATABLE, null, null, on_help };
+ help.label = _("_Help");
+ entries += help;
+
Gtk.ActionEntry about = { ACTION_ABOUT, Gtk.Stock.ABOUT, TRANSLATABLE, null, null, on_about };
about.label = _("_About");
entries += about;
@@ -651,7 +656,34 @@ public class GearyController {
public void on_quit() {
GearyApplication.instance.exit();
}
-
+
+ private void on_help() {
+ try {
+ if (GearyApplication.instance.is_installed()) {
+ Gtk.show_uri(null, "ghelp:geary", Gdk.CURRENT_TIME);
+ } else {
+ Pid pid;
+ File exec_dir = GearyApplication.instance.get_exec_dir();
+ string[] argv = new string[3];
+ argv[0] = "gnome-help";
+ argv[1] = exec_dir.get_parent().get_child("help").get_path();
+ argv[2] = null;
+ if (!Process.spawn_async(exec_dir.get_path(), argv, null,
+ SpawnFlags.SEARCH_PATH | SpawnFlags.STDERR_TO_DEV_NULL, null, out pid)) {
+ debug("Failed to launch help locally.");
+ }
+ }
+ } catch (Error error) {
+ debug("Error showing help: %s", error.message);
+ Gtk.Dialog dialog = new Gtk.Dialog.with_buttons("Error", null,
+ Gtk.DialogFlags.DESTROY_WITH_PARENT, Gtk.Stock.CLOSE, Gtk.ResponseType.CLOSE, null);
+ dialog.response.connect(() => { dialog.destroy(); });
+ dialog.get_content_area().add(new Gtk.Label("Error showing help: %s".printf(error.message)));
+ dialog.show_all();
+ dialog.run();
+ }
+ }
+
public void on_about() {
Gtk.show_about_dialog(main_window,
"program-name", GearyApplication.NAME,
diff --git a/ui/toolbar_menu.ui b/ui/toolbar_menu.ui
index 873b4596..8b78c2bb 100644
--- a/ui/toolbar_menu.ui
+++ b/ui/toolbar_menu.ui
@@ -2,6 +2,7 @@