mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-22 18:32:16 +03:00
beos: Add credits and licence buttons to about box
We'll simplify it to just mention version infos like on atari.
This commit is contained in:
parent
1025a49cb6
commit
f713cdd90b
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user