From: Andy Spencer Date: Mon, 9 Jan 2012 06:08:45 +0000 (+0000) Subject: Integrate User Guide into UI X-Git-Tag: v0.7~19 X-Git-Url: http://pileus.org/git/?p=aweather;a=commitdiff_plain;h=f45856566635a97514c4ddb89522ffa35ecc3fba;hp=61c00571244f73a357de9d9a247a8dee426e1113 Integrate User Guide into UI --- diff --git a/data/main.ui.in b/data/main.ui.in index 7113cc3..cd9d216 100644 --- a/data/main.ui.in +++ b/data/main.ui.in @@ -15,18 +15,18 @@ gtk-clear - - _Contents - Contents - AWeather Reference Manual - gtk-help - - _Fullscreen gtk-fullscreen + + _Man Page + Man Page + Unix Man Page + gtk-help + + _Offline gtk-disconnect @@ -54,6 +54,13 @@ gtk-media-play + + _User Guide + User Guide + AWeather User Guide + gtk-help + + Zoom _In gtk-zoom-in @@ -72,7 +79,7 @@ dialog AWeather @VERSION@ - Copyright ©2008-2011 Andy Spencer + Copyright ©2008-2012 Andy Spencer A weather monitoring program http://lug.rose-hulman.edu/proj/aweather GNU GENERAL PUBLIC LICENSE @@ -320,6 +327,7 @@ The hypothetical commands `show w' and `show c' should show the appropriate part The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <http://www.gnu.org/philosophy/why-not-lgpl.html>. Andy Spencer <andy753421@gmail.com> + Jason Holmes <Doppler5@aol.com> logo.svg True @@ -524,10 +532,19 @@ The hypothetical commands `show w' and `show c' should show the appropriate part True False - + + True + False + userguide + True + True + + + + True False - contents + manpage True True diff --git a/docs/Makefile.am b/docs/Makefile.am index 2c45385..6e6f23b 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -1,5 +1,5 @@ man1_MANS = aweather.1 wsr88ddec.1 -html_DATA = aweather.html +html_DATA = aweather.html userguide.html EXTRA_DIST = $(man1_MANS) $(html_DATA) \ aweather.ad wsr88ddec.ad diff --git a/src/aweather-gui.c b/src/aweather-gui.c index c34c6e4..9c88987 100644 --- a/src/aweather-gui.c +++ b/src/aweather-gui.c @@ -128,10 +128,17 @@ G_MODULE_EXPORT void on_cleancache(GtkMenuItem *menu, AWeatherGui *self) cleancache_r(cache); } -G_MODULE_EXPORT void on_contents(GtkMenuItem *menu, AWeatherGui *self) +G_MODULE_EXPORT void on_help(GtkMenuItem *menu, AWeatherGui *self) { GError *err = NULL; - gchar *path = g_strdup(HTMLDIR "/aweather.html"); + const gchar *name = gtk_buildable_get_name(GTK_BUILDABLE(menu)); + gchar *page = g_str_has_suffix(name, "userguide") ? "userguide" : + g_str_has_suffix(name, "manpage") ? "aweather" : NULL; + if (page == NULL) { + g_warning("Unknown help page: %s", page); + return; + } + gchar *path = g_strdup_printf("%s/%s.html", HTMLDIR, page); g_strdelimit(path, "/", G_DIR_SEPARATOR); gchar *argv[] = {"xdg-open", path, NULL}; g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &err);