summaryrefslogtreecommitdiff
path: root/beos
diff options
context:
space:
mode:
authorFran├žois Revol <revol@free.fr>2014-01-01 19:23:28 +0100
committerFran├žois Revol <revol@free.fr>2014-01-04 19:44:05 +0100
commitf713cdd90b1b13d790f5e062a28c729aa98f6933 (patch)
treedac796e22c539d1cda89cf410929472a610a9f42 /beos
parent1025a49cb6c0eee0b66ac74eb5f639001643fe90 (diff)
downloadnetsurf-f713cdd90b1b13d790f5e062a28c729aa98f6933.tar.gz
netsurf-f713cdd90b1b13d790f5e062a28c729aa98f6933.tar.bz2
beos: Add credits and licence buttons to about box
We'll simplify it to just mention version infos like on atari.
Diffstat (limited to 'beos')
-rw-r--r--beos/about.cpp21
-rw-r--r--beos/scaffolding.cpp49
-rw-r--r--beos/scaffolding.h3
3 files changed, 64 insertions, 9 deletions
diff --git a/beos/about.cpp b/beos/about.cpp
index f8447fa2a..3f7adf7fc 100644
--- a/beos/about.cpp
+++ b/beos/about.cpp
@@ -28,6 +28,8 @@ extern "C" {
#include "beos/window.h"
#include <Alert.h>
+#include <Application.h>
+#include <Invoker.h>
#include <ScrollView.h>
#include <String.h>
#include <TextView.h>
@@ -102,18 +104,29 @@ static void add_section(BTextView *textview, const char *header,
void nsbeos_about(struct gui_window *gui)
{
BAlert *alert;
- alert = new BAlert("about", "", /*"HomePage",*/ "Ok");
+ alert = new BAlert("about", "", "Credits", "Licence", "Ok");
//XXX: i18n-ize
BTextView *tv = alert->TextView();
+ BHandler *target = be_app;
+ BMessage *message = new BMessage(ABOUT_BUTTON);
+ BInvoker *invoker = NULL;
if (gui) {
- alert->SetFeel(B_MODAL_SUBSET_WINDOW_FEEL);
nsbeos_scaffolding *s = nsbeos_get_scaffold(gui);
if (s) {
NSBrowserWindow *w = nsbeos_get_bwindow_for_scaffolding(s);
- if (w)
+ if (w) {
+ alert->SetFeel(B_MODAL_SUBSET_WINDOW_FEEL);
alert->AddToSubset(w);
+ }
+ NSBaseView *v = nsbeos_get_baseview_for_scaffolding(s);
+ if (v) {
+ if (w)
+ message->AddPointer("Window", w);
+ target = v;
+ }
}
}
+ invoker = new BInvoker(message, target);
// make space for controls
alert->ResizeBy(200, 640);
@@ -130,5 +143,5 @@ void nsbeos_about(struct gui_window *gui)
add_section(tv, "documenters", documenters);
add_section(tv, url_label, url);
- alert->Go(NULL);
+ alert->Go(invoker);
}
diff --git a/beos/scaffolding.cpp b/beos/scaffolding.cpp
index 1790cf06b..a67ab50f8 100644
--- a/beos/scaffolding.cpp
+++ b/beos/scaffolding.cpp
@@ -502,6 +502,7 @@ NSBaseView::MessageReceived(BMessage *message)
case TOOLBAR_THROBBER:
case TOOLBAR_EDIT:
case CHOICES_SHOW:
+ case ABOUT_BUTTON:
case APPLICATION_QUIT:
if (Window())
Window()->DetachCurrentMessage();
@@ -781,11 +782,7 @@ void nsbeos_scaffolding_dispatch_event(nsbeos_scaffolding *scaffold, BMessage *m
break;
case B_ABOUT_REQUESTED:
{
- nsbeos_about(NULL);
- /* XXX: doesn't work yet! bug in rsrc:/
- BString url("rsrc:/about.en.html,text/html");
- browser_window_create(url.String(), NULL, NULL, true, false);
- */
+ nsbeos_about(scaffold->top_level);
break;
}
case B_NETPOSITIVE_DOWN:
@@ -1198,6 +1195,43 @@ void nsbeos_scaffolding_dispatch_event(nsbeos_scaffolding *scaffold, BMessage *m
break;
case CHOICES_SHOW:
break;
+ case ABOUT_BUTTON:
+ /* XXX: doesn't work yet! bug in rsrc:/
+ BString url("rsrc:/about.en.html,text/html");
+ browser_window_create(url.String(), NULL, NULL, true, false);
+ */
+ {
+ int32 button;
+ if (message->FindInt32("which", &button) == B_OK) {
+ const char *goto_url = NULL;
+ nserror nserr;
+ nsurl *url;
+ switch (button) {
+ case 0:
+ goto_url = "about:credits";
+ break;
+ case 1:
+ goto_url = "about:licence";
+ break;
+ default:
+ break;
+ }
+ if (goto_url == NULL)
+ break;
+ nserr = nsurl_create(goto_url, &url);
+ if (nserr == NSERROR_OK) {
+ nserr = browser_window_navigate(bw,
+ url, NULL,
+ (browser_window_nav_flags)(BROWSER_WINDOW_HISTORY | BROWSER_WINDOW_VERIFIABLE),
+ NULL, NULL, NULL);
+ nsurl_unref(url);
+ }
+ if (nserr != NSERROR_OK) {
+ warn_user(messages_get_errorcode(nserr), 0);
+ }
+ }
+ }
+ break;
case APPLICATION_QUIT:
netsurf_quit = true;
break;
@@ -1276,6 +1310,11 @@ NSBrowserWindow *nsbeos_get_bwindow_for_scaffolding(nsbeos_scaffolding *scaffold
return scaffold->window;
}
+NSBaseView *nsbeos_get_baseview_for_scaffolding(nsbeos_scaffolding *scaffold)
+{
+ return scaffold->top_view;
+}
+
static void recursively_set_menu_items_target(BMenu *menu, BHandler *handler)
{
menu->SetTargetForItems(handler);
diff --git a/beos/scaffolding.h b/beos/scaffolding.h
index 7b7080322..1b78d54a8 100644
--- a/beos/scaffolding.h
+++ b/beos/scaffolding.h
@@ -173,6 +173,7 @@ typedef enum {
/* misc actions */
CHOICES_SHOW,
+ ABOUT_BUTTON,
APPLICATION_QUIT,
} menu_action;
@@ -181,6 +182,8 @@ NSBrowserWindow *nsbeos_find_last_window(void);
NSBrowserWindow *nsbeos_get_bwindow_for_scaffolding(nsbeos_scaffolding *scaffold);
+NSBaseView *nsbeos_get_baseview_for_scaffolding(nsbeos_scaffolding *scaffold);
+
nsbeos_scaffolding *nsbeos_new_scaffolding(struct gui_window *toplevel);
bool nsbeos_scaffolding_is_busy(nsbeos_scaffolding *scaffold);