- cleanup dead gtk code and copyrights

- fix refs received before we have a window open (as in OpenWith...), maybe I should just open a new window each time anyway ?

svn path=/trunk/netsurf/; revision=5476
This commit is contained in:
François Revel 2008-10-02 19:57:19 +00:00
parent e4cdeb178e
commit 5de594527f
11 changed files with 25 additions and 221 deletions

View File

@ -106,6 +106,8 @@ static struct form_control *select_menu_control;
static thread_id sBAppThreadID;
static BMessage *gFirstRefsReceived = NULL;
static int sEventPipe[2];
#if 0 /* GTK */
@ -156,13 +158,23 @@ NSBrowserApplication::MessageReceived(BMessage *message)
}
void
NSBrowserApplication::ArgvReceived(int32 argc, char **argv)
{
CALLED();
}
void
NSBrowserApplication::RefsReceived(BMessage *message)
{
CALLED();
DetachCurrentMessage();
NSBrowserWindow *win = nsbeos_find_last_window();
if (!win)
if (!win) {
gFirstRefsReceived = message;
return;
}
win->Unlock();
nsbeos_pipe_message_top(message, win, win->Scaffolding());
}
@ -507,102 +519,12 @@ void gui_init(int argc, char** argv)
urldb_load(option_url_file);
urldb_load_cookies(option_cookie_file);
//nsbeos_history_init();
nsbeos_history_init();
//nsbeos_download_initialise();
be_app->Unlock();
#if 0 /* GTK */
PangoFontDescription *fontdesc;
gtk_init(&argc, &argv);
check_homedir();
find_resource(buf, "netsurf.glade", "./beos/res/netsurf.glade");
LOG(("Using '%s' as Glade template file", buf));
glade_file_location = strdup(buf);
glade_init();
gladeWindows = glade_xml_new(glade_file_location, NULL, NULL);
if (gladeWindows == NULL)
die("Unable to load Glade window definitions.\n");
glade_xml_signal_autoconnect(gladeWindows);
find_resource(buf, "netsurf.xpm", "./beos/res/netsurf.xpm");
beos_window_set_default_icon_from_file(buf, NULL);
wndTooltip = beos_WINDOW(glade_xml_get_widget(gladeWindows, "wndTooltip"));
labelTooltip = beos_LABEL(glade_xml_get_widget(gladeWindows, "tooltip"));
nsbeos_completion_init();
find_resource(buf, "throbber.gif", "./beos/res/throbber.gif");
nsbeos_throbber_initialise(buf);
if (nsbeos_throbber == NULL)
die("Unable to load throbber image.\n");
find_resource(buf, "Choices", "~/.netsurf/Choices");
LOG(("Using '%s' as Preferences file", buf));
options_file_location = strdup(buf);
options_read(buf);
/* check what the font settings are, setting them to a default font
* if they're not set - stops Pango whinging
*/
#define SETFONTDEFAULT(x,y) (x) = ((x) != NULL) ? (x) : strdup((y))
SETFONTDEFAULT(option_font_sans, "Sans");
SETFONTDEFAULT(option_font_serif, "Serif");
SETFONTDEFAULT(option_font_mono, "Monospace");
SETFONTDEFAULT(option_font_cursive, "Serif");
SETFONTDEFAULT(option_font_fantasy, "Serif");
nsbeos_options_init();
if (!option_cookie_file) {
find_resource(buf, "Cookies", "~/.netsurf/Cookies");
LOG(("Using '%s' as Cookies file", buf));
option_cookie_file = strdup(buf);
}
if (!option_cookie_jar) {
find_resource(buf, "Cookies", "~/.netsurf/Cookies");
LOG(("Using '%s' as Cookie Jar file", buf));
option_cookie_jar = strdup(buf);
}
if (!option_cookie_file || !option_cookie_jar)
die("Failed initialising cookie options");
if (!option_url_file) {
find_resource(buf, "URLs", "~/.netsurf/URLs");
LOG(("Using '%s' as URL file", buf));
option_url_file = strdup(buf);
}
if (!option_ca_path) {
find_resource(buf, "certs", "/etc/ssl/certs");
LOG(("Using '%s' as certificate path", buf));
option_ca_path = strdup(buf);
}
find_resource(buf, "messages", "./beos/res/messages");
LOG(("Using '%s' as Messages file", buf));
messages_load(buf);
find_resource(buf, "mime.types", "/etc/mime.types");
beos_fetch_filetype_init(buf);
/* set up stylesheet urls */
find_resource(buf, "beosdefault.css", "./beos/res/beosdefault.css");
default_stylesheet_url = path_to_url(buf);
LOG(("Using '%s' as Default CSS URL", default_stylesheet_url));
find_resource(buf, "adblock.css", "./beos/res/adblock.css");
adblock_stylesheet_url = path_to_url(buf);
LOG(("Using '%s' as AdBlock CSS URL", adblock_stylesheet_url));
urldb_load(option_url_file);
urldb_load_cookies(option_cookie_file);
wndAbout = beos_WINDOW(glade_xml_get_widget(gladeWindows, "wndAbout"));
beos_label_set_text(beos_LABEL(
glade_xml_get_widget(gladeWindows, "labelVersion")),
@ -616,9 +538,6 @@ void gui_init(int argc, char** argv)
wndWarning = beos_WINDOW(glade_xml_get_widget(gladeWindows, "wndWarning"));
wndOpenFile = beos_DIALOG(glade_xml_get_widget(gladeWindows, "wndOpenFile"));
nsbeos_history_init();
nsbeos_download_initialise();
#endif
}
@ -628,11 +547,18 @@ void gui_init2(int argc, char** argv)
CALLED();
const char *addr = NETSURF_HOMEPAGE;
if (option_homepage_url != NULL && option_homepage_url[0] != '\0')
addr = option_homepage_url;
if (option_homepage_url != NULL && option_homepage_url[0] != '\0')
addr = option_homepage_url;
if (argc > 1) addr = argv[1];
if (gFirstRefsReceived) addr = NULL;
browser_window_create(addr, 0, 0, true, false);
if (gFirstRefsReceived) {
// resend the refs we got before having a window to send them to
be_app_messenger.SendMessage(gFirstRefsReceived);
delete gFirstRefsReceived;
gFirstRefsReceived = NULL;
}
}

View File

@ -38,6 +38,7 @@ virtual ~NSBrowserApplication();
virtual void MessageReceived(BMessage *message);
virtual void RefsReceived(BMessage *message);
virtual void ArgvReceived(int32 argc, char **argv);
virtual bool QuitRequested();
};

View File

@ -52,7 +52,7 @@ static bool nsgtk_history_add_internal(const char *, const struct url_data *);
static void nsgtk_history_selection_changed(GtkTreeSelection *, gpointer);
#endif
void nsgtk_history_init(void)
void nsbeos_history_init(void)
{
#warning XXX
#if 0 /* GTK */

View File

@ -1,6 +1,5 @@
/*
* Copyright 2008 François Revol <mmu_man@users.sourceforge.net>
* Copyright 2006-2007 Daniel Silverstone <dsilvers@digital-scurf.org>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@ -48,33 +47,6 @@ static BList *callbacks = NULL;
/** earliest deadline. It's used for select() in gui_poll() */
bigtime_t earliest_callback_timeout = B_INFINITE_TIMEOUT;
#warning XXX
#if 0 /* GTK */
/** List of callbacks which have occurred and are pending running. */
static GList *pending_callbacks = NULL;
/** List of callbacks which are queued to occur in the future. */
static GList *queued_callbacks = NULL;
/** List of callbacks which are about to be run in this ::schedule_run. */
static GList *this_run = NULL;
static gboolean
nsbeos_schedule_generic_callback(gpointer data)
{
_nsbeos_callback_t *cb = (_nsbeos_callback_t *)(data);
if (cb->callback_killed) {
/* This callback instance has been killed. */
LOG(("CB at %p already dead.", cb));
free(cb);
return FALSE;
}
LOG(("CB for %p(%p) set pending.", cb->callback, cb->context));
/* The callback is alive, so move it to pending. */
cb->callback_fired = true;
queued_callbacks = g_list_remove(queued_callbacks, cb);
pending_callbacks = g_list_append(pending_callbacks, cb);
return FALSE;
}
#endif
static bool
nsbeos_schedule_kill_callback(void *_target, void *_match)
@ -104,21 +76,6 @@ schedule_remove(void (*callback)(void *p), void *p)
callbacks->DoForEach(nsbeos_schedule_kill_callback, &cb_match);
#warning XXX
#if 0 /* GTK */
_nsbeos_callback_t cb_match = {
.callback = callback,
.context = p,
};
g_list_foreach(queued_callbacks,
nsbeos_schedule_kill_callback, &cb_match);
g_list_foreach(pending_callbacks,
nsbeos_schedule_kill_callback, &cb_match);
g_list_foreach(this_run,
nsbeos_schedule_kill_callback, &cb_match);
#endif
}
void
@ -140,20 +97,6 @@ schedule(int t, void (*callback)(void *p), void *p)
if (earliest_callback_timeout > timeout)
earliest_callback_timeout = timeout;
callbacks->AddItem(cb);
#warning XXX
#if 0 /* GTK */
const int msec_timeout = t * 10;
_nsbeos_callback_t *cb = malloc(sizeof(_nsbeos_callback_t));
/* Kill any pending schedule of this kind. */
schedule_remove(callback, p);
cb->callback = callback;
cb->context = p;
cb->callback_killed = cb->callback_fired = false;
/* Prepend is faster right now. */
queued_callbacks = g_list_prepend(queued_callbacks, cb);
g_timeout_add(msec_timeout, nsbeos_schedule_generic_callback, cb);
#endif
}
void
@ -185,27 +128,4 @@ schedule_run(void)
callbacks->RemoveItem(cb);
free(cb);
}
#warning XXX
#if 0 /* GTK */
/* Capture this run of pending callbacks into the list. */
this_run = pending_callbacks;
if (this_run == NULL)
return; /* Nothing to do */
/* Clear the pending list. */
pending_callbacks = NULL;
LOG(("Captured a run of %d callbacks to fire.", g_list_length(this_run)));
/* Run all the callbacks which made it this far. */
while (this_run != NULL) {
_nsbeos_callback_t *cb = (_nsbeos_callback_t *)(this_run->data);
this_run = g_list_remove(this_run, this_run->data);
if (!cb->callback_killed)
cb->callback(cb->context);
free(cb);
}
#endif
}

View File

@ -1,6 +1,5 @@
/*
* Copyright 2008 François Revol <mmu_man@users.sourceforge.net>
* Copyright 2006 Daniel Silverstone <dsilvers@digital-scurf.org>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*

View File

@ -1,6 +1,5 @@
/*
* Copyright 2008 François Revol <mmu_man@users.sourceforge.net>
* Copyright 2006 Rob Kendrick <rjek@rjek.com>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*

View File

@ -1,6 +1,5 @@
/*
* Copyright 2008 François Revol <mmu_man@users.sourceforge.net>
* Copyright 2006 Rob Kendrick <rjek@rjek.com>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*

View File

@ -1,6 +1,5 @@
/*
* Copyright 2008 François Revol <mmu_man@users.sourceforge.net>
* Copyright 2006 Rob Kendrick <rjek@rjek.com>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*

View File

@ -1432,41 +1432,6 @@ const uint8 kWatch2CursorBits[] = {
};
#if 0 /* GTK */
static GdkCursor *nsbeos_create_menu_cursor(void)
{
static char menu_cursor_bits[] = {
0x00, 0x00, 0x80, 0x7F, 0x88, 0x40, 0x9E, 0x5E, 0x88, 0x40, 0x80, 0x56,
0x80, 0x40, 0x80, 0x5A, 0x80, 0x40, 0x80, 0x5E, 0x80, 0x40, 0x80, 0x56,
0x80, 0x40, 0x80, 0x7F, 0x00, 0x00, 0x00, 0x00, };
static char menu_cursor_mask_bits[] = {
0xC0, 0xFF, 0xC8, 0xFF, 0xDF, 0xFF, 0xFF, 0xFF, 0xDF, 0xFF, 0xC8, 0xFF,
0xC0, 0xFF, 0xC0, 0xFF, 0xC0, 0xFF, 0xC0, 0xFF, 0xC0, 0xFF, 0xC0, 0xFF,
0xC0, 0xFF, 0xC0, 0xFF, 0xC0, 0xFF, 0x00, 0x00, };
static GdkCursor *r;
static GdkColor fg = { 0, 0, 0, 0 };
static GdkColor bg = { 0, 65535, 65535, 65535 };
GdkPixmap *source, *mask;
if (r != NULL)
return r;
source = gdk_bitmap_create_from_data(NULL, menu_cursor_bits,
16, 16);
mask = gdk_bitmap_create_from_data (NULL, menu_cursor_mask_bits,
16, 16);
r = gdk_cursor_new_from_pixmap(source, mask, &fg, &bg, 8, 8);
gdk_pixmap_unref(source);
gdk_pixmap_unref(mask);
return r;
}
#endif
void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
{
BCursor *cursor = NULL;

View File

@ -1,6 +1,5 @@
/*
* Copyright 2008 François Revol <mmu_man@users.sourceforge.net>
* Copyright 2006 Daniel Silverstone <dsilvers@digital-scurf.org>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*

View File

@ -22,17 +22,14 @@
#include "desktop/options.h"
extern bool option_render_cairo;
extern bool option_render_resample;
extern char *option_url_file;
#define EXTRA_OPTION_DEFINE \
bool option_render_cairo = true; \
bool option_render_resample = false; \
char *option_url_file = 0;
#define EXTRA_OPTION_TABLE \
{ "render_cairo", OPTION_BOOL, &option_render_cairo }, \
{ "render_resample", OPTION_BOOL, &option_render_resample }, \
{ "url_file", OPTION_STRING, &option_url_file },
#endif