From cc3456940b6b30a0fc4f83226c34e4e873336cd0 Mon Sep 17 00:00:00 2001 Message-Id: From: Mark Wooding Date: Fri, 27 Nov 2009 20:28:55 +0000 Subject: [PATCH] Help button for login box. With free nasty hack for Macs. Organization: Straylight/Edgeware From: Richard Kettlewell --- disobedience/help.c | 11 ++++++++++- disobedience/login.c | 23 ++++++++++++++++++----- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/disobedience/help.c b/disobedience/help.c index 5b708e8..ca5a8d8 100644 --- a/disobedience/help.c +++ b/disobedience/help.c @@ -31,7 +31,16 @@ void popup_help(const char *what) { if(!what) what = "index.html"; - byte_xasprintf(&path, "%s/%s", dochtmldir, what); +#if __APPLE__ + if(!strcmp(browser, "open")) + /* Apple's open(1) isn't really a web browser so needs some extra hints + * that it should see the argument as a URL. Otherwise it doesn't treat # + * specially. A better answer would be to identify the system web browser + * and invoke it directly. */ + byte_xasprintf(&path, "file:///%s/%s", dochtmldir, what); + else +#endif + byte_xasprintf(&path, "%s/%s", dochtmldir, what); if(!(pid = xfork())) { exitfn = _exit; if(!xfork()) { diff --git a/disobedience/login.c b/disobedience/login.c index 4031c3a..a02c1c6 100644 --- a/disobedience/login.c +++ b/disobedience/login.c @@ -230,6 +230,12 @@ static void login_cancel(GtkButton attribute((unused)) *button, gtk_widget_destroy(login_window); } +/** @brief User pressed cancel in the login window */ +static void login_help(GtkButton attribute((unused)) *button, + gpointer attribute((unused)) userdata) { + popup_help("intro.html#login"); +} + /** @brief Keypress handler */ static gboolean login_keypress(GtkWidget attribute((unused)) *widget, GdkEventKey *event, @@ -251,18 +257,25 @@ static gboolean login_keypress(GtkWidget attribute((unused)) *widget, /* Buttons that appear at the bottom of the window */ static struct button buttons[] = { { - "Login", - login_ok, - "(Re-)connect using these settings", + GTK_STOCK_HELP, + login_help, + "Go to manual", 0, - NULL, + gtk_box_pack_start, }, { GTK_STOCK_CLOSE, login_cancel, "Discard changes and close window", 0, - NULL, + gtk_box_pack_end, + }, + { + "Login", + login_ok, + "(Re-)connect using these settings", + 0, + gtk_box_pack_end, }, }; -- [mdw]