summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2014-01-12 10:27:41 +0000
committerVincent Sanders <vince@kyllikki.org>2014-01-12 10:27:41 +0000
commit56bb9582b16dfd45bbd1665adaf87c6c5986aed3 (patch)
treec92b65226b16977ddd0649a9be38d3ebdf06b6c0
parentc8496df3df7d059528f2d5e735be5c55bfa75ef6 (diff)
downloadnetsurf-56bb9582b16dfd45bbd1665adaf87c6c5986aed3.tar.gz
netsurf-56bb9582b16dfd45bbd1665adaf87c6c5986aed3.tar.bz2
move set title, set url, start and stop throbber window operations to gui table
-rw-r--r--amiga/gui.c10
-rw-r--r--amiga/theme.h5
-rw-r--r--atari/gui.c14
-rw-r--r--beos/gui.cpp7
-rw-r--r--beos/scaffolding.h5
-rw-r--r--cocoa/gui.m14
-rw-r--r--desktop/browser.c13
-rw-r--r--desktop/gui.h39
-rw-r--r--desktop/gui_factory.c30
-rw-r--r--framebuffer/gui.c17
-rw-r--r--gtk/gui.c6
-rw-r--r--gtk/scaffolding.h7
-rw-r--r--monkey/browser.h4
-rw-r--r--monkey/main.c6
-rw-r--r--riscos/gui.c6
-rw-r--r--riscos/window.h6
-rw-r--r--windows/gui.c14
17 files changed, 159 insertions, 44 deletions
diff --git a/amiga/gui.c b/amiga/gui.c
index 3a655f52d..463334676 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -3896,7 +3896,7 @@ static void gui_window_destroy(struct gui_window *g)
win_destroyed = true;
}
-void gui_window_set_title(struct gui_window *g, const char *title)
+static void gui_window_set_title(struct gui_window *g, const char *title)
{
struct Node *node;
ULONG cur_tab = 0;
@@ -4592,7 +4592,7 @@ void gui_window_set_status(struct gui_window *g, const char *text)
}
}
-void gui_window_set_url(struct gui_window *g, const char *url)
+static void gui_window_set_url(struct gui_window *g, const char *url)
{
ULONG cur_tab = 0;
@@ -5095,8 +5095,14 @@ void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
static struct gui_table ami_gui_table = {
.poll = gui_poll,
.quit = gui_quit,
+
.window_create = gui_window_create,
.window_destroy = gui_window_destroy,
+
+ .window_set_title = gui_window_set_title,
+ .window_set_url = gui_window_set_url,
+ .window_start_throbber = gui_window_start_throbber,
+ .window_stop_throbber = gui_window_stop_throbber,
};
/** Normal entry point from OS */
diff --git a/amiga/theme.h b/amiga/theme.h
index 3c3931c12..b47c015e1 100644
--- a/amiga/theme.h
+++ b/amiga/theme.h
@@ -41,4 +41,9 @@ void ami_reset_pointer(struct gui_window_2 *gwin);
* and ALWAYS in preference to SetWindowPointer(), as it features more pointers and uses
* the correct ones specified in user preferences. */
void ami_update_pointer(struct Window *win, gui_pointer_shape shape);
+
+void gui_window_start_throbber(struct gui_window *g);
+void gui_window_stop_throbber(struct gui_window *g);
+
+
#endif
diff --git a/atari/gui.c b/atari/gui.c
index 3ac267a9b..de088a47e 100644
--- a/atari/gui.c
+++ b/atari/gui.c
@@ -288,7 +288,7 @@ void gui_window_get_dimensions(struct gui_window *w, int *width, int *height,
*height = rect.g_h;
}
-void gui_window_set_title(struct gui_window *gw, const char *title)
+static void gui_window_set_title(struct gui_window *gw, const char *title)
{
if (gw == NULL)
@@ -540,7 +540,7 @@ void gui_window_hide_pointer(struct gui_window *w)
}
-void gui_window_set_url(struct gui_window *w, const char *url)
+static void gui_window_set_url(struct gui_window *w, const char *url)
{
int l;
@@ -594,7 +594,7 @@ static void throbber_advance( void * data )
schedule(100, throbber_advance, gw );
}
-void gui_window_start_throbber(struct gui_window *w)
+static void gui_window_start_throbber(struct gui_window *w)
{
GRECT work;
if (w == NULL)
@@ -605,7 +605,7 @@ void gui_window_start_throbber(struct gui_window *w)
rendering = true;
}
-void gui_window_stop_throbber(struct gui_window *w)
+static void gui_window_stop_throbber(struct gui_window *w)
{
if (w == NULL)
return;
@@ -1108,8 +1108,14 @@ void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
static struct gui_table atari_gui_table = {
.poll = gui_poll,
.quit = gui_quit,
+
.window_create = gui_window_create,
.window_destroy = gui_window_destroy,
+
+ .window_set_title = gui_window_set_title,
+ .window_set_url = gui_window_set_url,
+ .window_start_throbber = gui_window_start_throbber,
+ .window_stop_throbber = gui_window_stop_throbber,
};
/* #define WITH_DBG_LOGFILE 1 */
diff --git a/beos/gui.cpp b/beos/gui.cpp
index 22c45598d..c5e2fe482 100644
--- a/beos/gui.cpp
+++ b/beos/gui.cpp
@@ -1089,8 +1089,15 @@ void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
static struct gui_table beos_gui_table = {
.poll = gui_poll,
.quit = gui_quit,
+
.window_create = gui_window_create,
.window_destroy = gui_window_destroy,
+
+ .window_set_title = gui_window_set_title,
+ .window_set_url = gui_window_set_url,
+ .window_start_throbber = gui_window_start_throbber,
+ .window_stop_throbber = gui_window_stop_throbber,
+
};
diff --git a/beos/scaffolding.h b/beos/scaffolding.h
index 1b78d54a8..210499fc7 100644
--- a/beos/scaffolding.h
+++ b/beos/scaffolding.h
@@ -200,5 +200,10 @@ void nsbeos_scaffolding_destroy(nsbeos_scaffolding *scaffold);
void nsbeos_scaffolding_popup_menu(nsbeos_scaffolding *g, BPoint where);
+void gui_window_set_title(struct gui_window *_g, const char *title);
+void gui_window_set_url(struct gui_window *_g, const char *url);
+void gui_window_start_throbber(struct gui_window* _g);
+void gui_window_stop_throbber(struct gui_window* _g);
+
#endif /* NETSURF_BEOS_SCAFFOLDING_H */
diff --git a/cocoa/gui.m b/cocoa/gui.m
index fa80814eb..80f811416 100644
--- a/cocoa/gui.m
+++ b/cocoa/gui.m
@@ -102,7 +102,7 @@ static void gui_window_destroy(struct gui_window *g)
[vc release];
}
-void gui_window_set_title(struct gui_window *g, const char *title)
+static void gui_window_set_title(struct gui_window *g, const char *title)
{
[(BrowserViewController *)g setTitle: [NSString stringWithUTF8String: title]];
}
@@ -209,18 +209,18 @@ void gui_window_hide_pointer(struct gui_window *g)
{
}
-void gui_window_set_url(struct gui_window *g, const char *url)
+static void gui_window_set_url(struct gui_window *g, const char *url)
{
[(BrowserViewController *)g setUrl: [NSString stringWithUTF8String: url]];
}
-void gui_window_start_throbber(struct gui_window *g)
+static void gui_window_start_throbber(struct gui_window *g)
{
[(BrowserViewController *)g setIsProcessing: YES];
[(BrowserViewController *)g updateBackForward];
}
-void gui_window_stop_throbber(struct gui_window *g)
+static void gui_window_stop_throbber(struct gui_window *g)
{
[(BrowserViewController *)g setIsProcessing: NO];
[(BrowserViewController *)g updateBackForward];
@@ -330,8 +330,14 @@ void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
static struct gui_table gui_table = {
.poll = &gui_poll,
+
.window_create = gui_window_create,
.window_destroy = gui_window_destroy,
+
+ .window_set_title = gui_window_set_title,
+ .window_set_url = gui_window_set_url,
+ .window_start_throbber = gui_window_start_throbber,
+ .window_stop_throbber = gui_window_stop_throbber,
};
struct gui_table *cocoa_gui_table = &gui_table;
diff --git a/desktop/browser.c b/desktop/browser.c
index aceb8fb65..e01595fcc 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -866,7 +866,7 @@ static void browser_window_start_throbber(struct browser_window *bw)
while (bw->parent)
bw = bw->parent;
- gui_window_start_throbber(bw->window);
+ guit->window_start_throbber(bw->window);
}
@@ -883,8 +883,9 @@ static void browser_window_stop_throbber(struct browser_window *bw)
while (bw->parent)
bw = bw->parent;
- if (!browser_window_check_throbber(bw))
- gui_window_stop_throbber(bw->window);
+ if (!browser_window_check_throbber(bw)) {
+ guit->window_stop_throbber(bw->window);
+ }
}
@@ -1958,7 +1959,7 @@ void browser_window_update(struct browser_window *bw, bool scroll_to_top)
case BROWSER_WINDOW_NORMAL:
/* Root browser window, constituting a front end window/tab */
- gui_window_set_title(bw->window,
+ guit->window_set_title(bw->window,
content_get_title(bw->current_content));
browser_window_update_extent(bw);
@@ -2358,7 +2359,7 @@ void browser_window_refresh_url_bar(struct browser_window *bw, nsurl *url,
/* With no fragment, we may as well pass url straight through
* saving a malloc, copy, free cycle.
*/
- gui_window_set_url(bw->window, nsurl_access(url));
+ guit->window_set_url(bw->window, nsurl_access(url));
} else {
nsurl *display_url;
nserror error;
@@ -2369,7 +2370,7 @@ void browser_window_refresh_url_bar(struct browser_window *bw, nsurl *url,
return;
}
- gui_window_set_url(bw->window, nsurl_access(display_url));
+ guit->window_set_url(bw->window, nsurl_access(display_url));
nsurl_unref(display_url);
}
}
diff --git a/desktop/gui.h b/desktop/gui.h
index 940eef0a5..26e1792f8 100644
--- a/desktop/gui.h
+++ b/desktop/gui.h
@@ -70,28 +70,42 @@ struct form_control;
* function table implementing GUI interface to browser core
*/
struct gui_table {
+
+ /* Mandantory entries */
+
/** called to let the frontend update its state and run any
* I/O operations.
*/
- void (*poll)(bool active); /* Mandantory */
+ void (*poll)(bool active);
- /** create a gui window for a browser window */
- struct gui_window *(*window_create)(struct browser_window *bw,
- struct browser_window *clone,
- bool new_tab); /* Mandantory */
+ /** create a gui window for a browsing context */
+ struct gui_window *(*window_create)(struct browser_window *bw, struct browser_window *clone, bool new_tab);
/** destroy previously created gui window */
- void (*window_destroy)(struct gui_window *g); /* Mandantory */
+ void (*window_destroy)(struct gui_window *g);
+ /* Optional entries */
+
/** called to allow the gui to cleanup */
- void (*quit)(void); /* Optional */
+ void (*quit)(void);
+
+ /** set the window title. */
+ void (*window_set_title)(struct gui_window *g, const char *title);
+
+ /** set the navigation url. */
+ void (*window_set_url)(struct gui_window *g, const char *url);
+
+ /** start the navigation throbber. */
+ void (*window_start_throbber)(struct gui_window *g);
+
+ /** stop the navigation throbber. */
+ void (*window_stop_throbber)(struct gui_window *g);
};
extern struct gui_table *guit; /* the gui vtable */
-void gui_window_set_title(struct gui_window *g, const char *title);
void gui_window_redraw_window(struct gui_window *g);
void gui_window_update_box(struct gui_window *g,
const struct rect *rect);
@@ -105,9 +119,6 @@ void gui_window_update_extent(struct gui_window *g);
void gui_window_set_status(struct gui_window *g, const char *text);
void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape);
void gui_window_hide_pointer(struct gui_window *g);
-void gui_window_set_url(struct gui_window *g, const char *url);
-void gui_window_start_throbber(struct gui_window *g);
-void gui_window_stop_throbber(struct gui_window *g);
void gui_window_set_icon(struct gui_window *g, hlcache_handle *icon);
void gui_window_set_search_ico(hlcache_handle *ico);
void gui_window_place_caret(struct gui_window *g, int x, int y, int height,
@@ -119,12 +130,12 @@ bool gui_window_scroll_start(struct gui_window *g);
bool gui_window_drag_start(struct gui_window *g, gui_drag_type type,
const struct rect *rect);
-void gui_window_save_link(struct gui_window *g, const char *url,
+void gui_window_save_link(struct gui_window *g, const char *url,
const char *title);
struct gui_download_window *gui_download_window_create(download_context *ctx,
struct gui_window *parent);
-nserror gui_download_window_data(struct gui_download_window *dw,
+nserror gui_download_window_data(struct gui_download_window *dw,
const char *data, unsigned int size);
void gui_download_window_error(struct gui_download_window *dw,
const char *error_msg);
@@ -172,7 +183,7 @@ void gui_launch_url(const char *url);
struct ssl_cert_info;
-void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
+void gui_cert_verify(nsurl *url, const struct ssl_cert_info *certs,
unsigned long num, nserror (*cb)(bool proceed, void *pw),
void *cbpw);
diff --git a/desktop/gui_factory.c b/desktop/gui_factory.c
index 9a4fa396a..c760218ec 100644
--- a/desktop/gui_factory.c
+++ b/desktop/gui_factory.c
@@ -9,6 +9,22 @@ static void gui_default_quit(void)
{
}
+static void gui_default_window_set_title(struct gui_window *g, const char *title)
+{
+}
+
+static void gui_default_window_set_url(struct gui_window *g, const char *url)
+{
+}
+
+static void gui_default_window_start_throbber(struct gui_window *g)
+{
+}
+
+static void gui_default_window_stop_throbber(struct gui_window *g)
+{
+}
+
nserror gui_factory_register(struct gui_table *gt)
{
/* ensure not already initialised */
@@ -31,7 +47,19 @@ nserror gui_factory_register(struct gui_table *gt)
/* fill in the optional entries with defaults */
if (gt->quit == NULL) {
- gt->quit = &gui_default_quit;
+ gt->quit = gui_default_quit;
+ }
+ if (gt->window_set_title == NULL) {
+ gt->window_set_title = gui_default_window_set_title;
+ }
+ if (gt->window_set_url == NULL) {
+ gt->window_set_url = gui_default_window_set_url;
+ }
+ if (gt->window_start_throbber == NULL) {
+ gt->window_start_throbber = gui_default_window_start_throbber;
+ }
+ if (gt->window_stop_throbber == NULL) {
+ gt->window_stop_throbber = gui_default_window_stop_throbber;
}
guit = gt;
diff --git a/framebuffer/gui.c b/framebuffer/gui.c
index 12145fd80..5a903c31e 100644
--- a/framebuffer/gui.c
+++ b/framebuffer/gui.c
@@ -1536,12 +1536,6 @@ gui_window_destroy(struct gui_window *gw)
}
void
-gui_window_set_title(struct gui_window *g, const char *title)
-{
- LOG(("%p, %s", g, title));
-}
-
-void
gui_window_redraw_window(struct gui_window *g)
{
fb_queue_redraw(g->browser, 0, 0, fbtk_get_width(g->browser), fbtk_get_height(g->browser) );
@@ -1657,7 +1651,7 @@ gui_window_hide_pointer(struct gui_window *g)
{
}
-void
+static void
gui_window_set_url(struct gui_window *g, const char *url)
{
fbtk_set_text(g->url, url);
@@ -1720,14 +1714,14 @@ throbber_advance(void *pw)
}
}
-void
+static void
gui_window_start_throbber(struct gui_window *g)
{
g->throbber_index = 0;
schedule(10, throbber_advance, g);
}
-void
+static void
gui_window_stop_throbber(struct gui_window *gw)
{
gw->throbber_index = -1;
@@ -1903,8 +1897,13 @@ void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
static struct gui_table framebuffer_gui_table = {
.poll = gui_poll,
.quit = gui_quit,
+
.window_create = gui_window_create,
.window_destroy = gui_window_destroy,
+
+ .window_set_url = gui_window_set_url,
+ .window_start_throbber = gui_window_start_throbber,
+ .window_stop_throbber = gui_window_stop_throbber,
};
/** Entry point from OS.
diff --git a/gtk/gui.c b/gtk/gui.c
index c94b9c836..1905f20dc 100644
--- a/gtk/gui.c
+++ b/gtk/gui.c
@@ -1135,8 +1135,14 @@ bool path_add_part(char *path, int length, const char *newpart)
static struct gui_table nsgtk_gui_table = {
.poll = gui_poll,
.quit = gui_quit,
+
.window_create = gui_window_create,
.window_destroy = gui_window_destroy,
+
+ .window_set_title = gui_window_set_title,
+ .window_set_url = gui_window_set_url,
+ .window_start_throbber = gui_window_start_throbber,
+ .window_stop_throbber = gui_window_stop_throbber,
};
/**
diff --git a/gtk/scaffolding.h b/gtk/scaffolding.h
index 79e3fa0df..b1f11bbdf 100644
--- a/gtk/scaffolding.h
+++ b/gtk/scaffolding.h
@@ -177,4 +177,11 @@ gboolean nsgtk_window_url_changed(GtkWidget *, GdkEventKey *, gpointer);
nserror nsgtk_scaffolding_new_tab(struct gui_window *gw);
+/* core acessors */
+void gui_window_set_title(struct gui_window *g, const char *title);
+void gui_window_set_url(struct gui_window *g, const char *url);
+void gui_window_start_throbber(struct gui_window *g);
+void gui_window_stop_throbber(struct gui_window *g);
+
+
#endif /* NETSURF_GTK_SCAFFOLDING_H */
diff --git a/monkey/browser.h b/monkey/browser.h
index 0b1fd8d13..ab4e59bbb 100644
--- a/monkey/browser.h
+++ b/monkey/browser.h
@@ -46,5 +46,9 @@ void monkey_kill_browser_windows(void);
struct gui_window *gui_window_create(struct browser_window *bw, struct browser_window *clone, bool new_tab);
void gui_window_destroy(struct gui_window *g);
+void gui_window_set_title(struct gui_window *g, const char *title);
+void gui_window_set_url(struct gui_window *g, const char *url);
+void gui_window_start_throbber(struct gui_window *g);
+void gui_window_stop_throbber(struct gui_window *g);
#endif /* NETSURF_MONKEY_BROWSER_H */
diff --git a/monkey/main.c b/monkey/main.c
index 2ef3bb98f..73803f536 100644
--- a/monkey/main.c
+++ b/monkey/main.c
@@ -116,8 +116,14 @@ static bool nslog_stream_configure(FILE *fptr)
static struct gui_table monkey_gui_table = {
.poll = monkey_poll,
.quit = monkey_quit,
+
.window_create = gui_window_create,
.window_destroy = gui_window_destroy,
+
+ .window_set_title = gui_window_set_title,
+ .window_set_url = gui_window_set_url,
+ .window_start_throbber = gui_window_start_throbber,
+ .window_stop_throbber = gui_window_stop_throbber,
};
int
diff --git a/riscos/gui.c b/riscos/gui.c
index 460036573..ee4c59105 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -840,8 +840,14 @@ static bool nslog_stream_configure(FILE *fptr)
static struct gui_table riscos_gui_table = {
.poll = gui_poll,
.quit = gui_quit,
+
.window_create = gui_window_create,
.window_destroy = gui_window_destroy,
+
+ .window_set_title = gui_window_set_title,
+ .window_set_url = gui_window_set_url,
+ .window_start_throbber = gui_window_start_throbber,
+ .window_stop_throbber = gui_window_stop_throbber,
};
diff --git a/riscos/window.h b/riscos/window.h
index a59a9423c..8614ce0d2 100644
--- a/riscos/window.h
+++ b/riscos/window.h
@@ -29,9 +29,15 @@ void ro_gui_window_initialise(void);
bool ro_gui_window_check_menu(wimp_menu *menu);
+/* core acessors */
struct gui_window *gui_window_create(struct browser_window *bw, struct browser_window *clone, bool new_tab);
void gui_window_destroy(struct gui_window *g);
+void gui_window_set_title(struct gui_window *g, const char *title);
+void gui_window_set_url(struct gui_window *g, const char *url);
+void gui_window_start_throbber(struct gui_window *g);
+void gui_window_stop_throbber(struct gui_window *g);
+
#endif
diff --git a/windows/gui.c b/windows/gui.c
index a01b6c4df..6f0dfd874 100644
--- a/windows/gui.c
+++ b/windows/gui.c
@@ -1422,7 +1422,7 @@ static void gui_window_destroy(struct gui_window *w)
* set window title
* \param title the [url]
*/
-void gui_window_set_title(struct gui_window *w, const char *title)
+static void gui_window_set_title(struct gui_window *w, const char *title)
{
if (w == NULL)
return;
@@ -1654,7 +1654,7 @@ void gui_window_hide_pointer(struct gui_window *w)
{
}
-void gui_window_set_url(struct gui_window *w, const char *url)
+static void gui_window_set_url(struct gui_window *w, const char *url)
{
if (w == NULL)
return;
@@ -1662,7 +1662,7 @@ void gui_window_set_url(struct gui_window *w, const char *url)
}
-void gui_window_start_throbber(struct gui_window *w)
+static void gui_window_start_throbber(struct gui_window *w)
{
if (w == NULL)
return;
@@ -1687,7 +1687,7 @@ void gui_window_start_throbber(struct gui_window *w)
Animate_Play(w->throbber, 0, -1, -1);
}
-void gui_window_stop_throbber(struct gui_window *w)
+static void gui_window_stop_throbber(struct gui_window *w)
{
if (w == NULL)
return;
@@ -1886,8 +1886,14 @@ nsws_create_main_class(HINSTANCE hinstance) {
static struct gui_table gui_table = {
.poll = gui_poll,
+
.window_create = gui_window_create,
.window_destroy = gui_window_destroy,
+
+ .window_set_title = gui_window_set_title,
+ .window_set_url = gui_window_set_url,
+ .window_start_throbber = gui_window_start_throbber,
+ .window_stop_throbber = gui_window_stop_throbber,
};
struct gui_table *win32_gui_table = &gui_table;