Remove gui_window_get_browser_window from core. Remove unused implementations from front ends. Rename the GTK front end implementation to nsgtk_get_browser_window and change the GTK front end to use that.

svn path=/trunk/netsurf/; revision=12737
This commit is contained in:
Michael Drake 2011-09-05 13:28:17 +00:00
parent ce1ba5e351
commit 34fe2531f2
10 changed files with 61 additions and 71 deletions

View File

@ -105,11 +105,6 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
return (struct gui_window *)result; return (struct gui_window *)result;
} }
struct browser_window *gui_window_get_browser_window(struct gui_window *g)
{
return [(BrowserViewController *)g browser];
}
void gui_window_destroy(struct gui_window *g) void gui_window_destroy(struct gui_window *g)
{ {
BrowserViewController *vc = (BrowserViewController *)g; BrowserViewController *vc = (BrowserViewController *)g;

View File

@ -77,7 +77,6 @@ void gui_quit(void);
struct gui_window *gui_create_browser_window(struct browser_window *bw, struct gui_window *gui_create_browser_window(struct browser_window *bw,
struct browser_window *clone, bool new_tab); struct browser_window *clone, bool new_tab);
struct browser_window *gui_window_get_browser_window(struct gui_window *g);
void gui_window_destroy(struct gui_window *g); void gui_window_destroy(struct gui_window *g);
void gui_window_set_title(struct gui_window *g, const char *title); void gui_window_set_title(struct gui_window *g, const char *title);
void gui_window_redraw_window(struct gui_window *g); void gui_window_redraw_window(struct gui_window *g);

View File

@ -322,7 +322,7 @@ void nsgtk_scaffolding_destroy(nsgtk_scaffolding *g)
static void nsgtk_window_update_back_forward(struct gtk_scaffolding *g) static void nsgtk_window_update_back_forward(struct gtk_scaffolding *g)
{ {
int width, height; int width, height;
struct browser_window *bw = gui_window_get_browser_window(g->top_level); struct browser_window *bw = nsgtk_get_browser_window(g->top_level);
g->buttons[BACK_BUTTON]->sensitivity = g->buttons[BACK_BUTTON]->sensitivity =
history_back_available(bw->history); history_back_available(bw->history);
@ -380,7 +380,7 @@ static guint nsgtk_scaffolding_update_edit_actions_sensitivity(
g->buttons[PASTE_BUTTON]->sensitivity = true; g->buttons[PASTE_BUTTON]->sensitivity = true;
} else { } else {
struct browser_window *bw = struct browser_window *bw =
gui_window_get_browser_window(g->top_level); nsgtk_get_browser_window(g->top_level);
has_selection = browser_window_has_selection(bw); has_selection = browser_window_has_selection(bw);
g->buttons[COPY_BUTTON]->sensitivity = has_selection; g->buttons[COPY_BUTTON]->sensitivity = has_selection;
@ -448,7 +448,7 @@ static gboolean nsgtk_window_popup_menu_hidden(GtkWidget *widget,
gboolean nsgtk_window_url_activate_event(GtkWidget *widget, gpointer data) gboolean nsgtk_window_url_activate_event(GtkWidget *widget, gpointer data)
{ {
struct gtk_scaffolding *g = data; struct gtk_scaffolding *g = data;
struct browser_window *bw = gui_window_get_browser_window(g->top_level); struct browser_window *bw = nsgtk_get_browser_window(g->top_level);
char *url; char *url;
if (search_is_url(gtk_entry_get_text(GTK_ENTRY(g->url_bar))) if (search_is_url(gtk_entry_get_text(GTK_ENTRY(g->url_bar)))
== false) == false)
@ -512,7 +512,7 @@ static void nsgtk_window_tabs_num_changed(GtkNotebook *notebook,
*/ */
static void nsgtk_openfile_open(const char *filename) static void nsgtk_openfile_open(const char *filename)
{ {
struct browser_window *bw = gui_window_get_browser_window( struct browser_window *bw = nsgtk_get_browser_window(
current_model->top_level); current_model->top_level);
char url[strlen(filename) + FILE_SCHEME_PREFIX_LEN + 1]; char url[strlen(filename) + FILE_SCHEME_PREFIX_LEN + 1];
@ -526,7 +526,7 @@ static void nsgtk_openfile_open(const char *filename)
MULTIHANDLER(newwindow) MULTIHANDLER(newwindow)
{ {
struct browser_window *bw = gui_window_get_browser_window(g->top_level); struct browser_window *bw = nsgtk_get_browser_window(g->top_level);
const char *url = option_homepage_url; const char *url = option_homepage_url;
if ((url != NULL) && (url[0] == '\0')) if ((url != NULL) && (url[0] == '\0'))
@ -542,7 +542,7 @@ MULTIHANDLER(newwindow)
MULTIHANDLER(newtab) MULTIHANDLER(newtab)
{ {
struct browser_window *bw = gui_window_get_browser_window(g->top_level); struct browser_window *bw = nsgtk_get_browser_window(g->top_level);
if (option_new_blank) { if (option_new_blank) {
browser_window_create(NULL, bw, NULL, false, true); browser_window_create(NULL, bw, NULL, false, true);
@ -597,7 +597,7 @@ static gboolean nsgtk_filter_directory(const GtkFileFilterInfo *info,
MULTIHANDLER(savepage) MULTIHANDLER(savepage)
{ {
if (gui_window_get_browser_window(g->top_level)->current_content if (nsgtk_get_browser_window(g->top_level)->current_content
== NULL) == NULL)
return FALSE; return FALSE;
@ -617,7 +617,7 @@ MULTIHANDLER(savepage)
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(fc), filter); gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(fc), filter);
gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(fc), filter); gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(fc), filter);
res = url_nice(content_get_url(gui_window_get_browser_window( res = url_nice(content_get_url(nsgtk_get_browser_window(
g->top_level)->current_content), &path, false); g->top_level)->current_content), &path, false);
if (res != URL_FUNC_OK) { if (res != URL_FUNC_OK) {
path = strdup(messages_get("SaveText")); path = strdup(messages_get("SaveText"));
@ -654,7 +654,7 @@ MULTIHANDLER(savepage)
} }
closedir(d); closedir(d);
save_complete_init(); save_complete_init();
save_complete(gui_window_get_browser_window( save_complete(nsgtk_get_browser_window(
g->top_level)->current_content, path); g->top_level)->current_content, path);
g_free(path); g_free(path);
@ -669,7 +669,7 @@ MULTIHANDLER(pdf)
#ifdef WITH_PDF_EXPORT #ifdef WITH_PDF_EXPORT
GtkWidget *save_dialog; GtkWidget *save_dialog;
struct browser_window *bw = gui_window_get_browser_window(g->top_level); struct browser_window *bw = nsgtk_get_browser_window(g->top_level);
struct print_settings *settings; struct print_settings *settings;
char filename[PATH_MAX]; char filename[PATH_MAX];
char dirname[PATH_MAX]; char dirname[PATH_MAX];
@ -739,7 +739,7 @@ MULTIHANDLER(pdf)
MULTIHANDLER(plaintext) MULTIHANDLER(plaintext)
{ {
if (gui_window_get_browser_window(g->top_level)->current_content if (nsgtk_get_browser_window(g->top_level)->current_content
== NULL) == NULL)
return FALSE; return FALSE;
@ -752,7 +752,7 @@ MULTIHANDLER(plaintext)
char *filename; char *filename;
url_func_result res; url_func_result res;
res = url_nice(content_get_url(gui_window_get_browser_window( res = url_nice(content_get_url(nsgtk_get_browser_window(
g->top_level)->current_content), &filename, false); g->top_level)->current_content), &filename, false);
if (res != URL_FUNC_OK) { if (res != URL_FUNC_OK) {
filename = strdup(messages_get("SaveText")); filename = strdup(messages_get("SaveText"));
@ -770,7 +770,7 @@ MULTIHANDLER(plaintext)
if (gtk_dialog_run(GTK_DIALOG(fc)) == GTK_RESPONSE_ACCEPT) { if (gtk_dialog_run(GTK_DIALOG(fc)) == GTK_RESPONSE_ACCEPT) {
filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fc)); filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fc));
save_as_text(gui_window_get_browser_window( save_as_text(nsgtk_get_browser_window(
g->top_level)->current_content, filename); g->top_level)->current_content, filename);
g_free(filename); g_free(filename);
} }
@ -797,7 +797,7 @@ MULTIHANDLER(printpreview)
MULTIHANDLER(print) MULTIHANDLER(print)
{ {
struct browser_window *bw = gui_window_get_browser_window(g->top_level); struct browser_window *bw = nsgtk_get_browser_window(g->top_level);
GtkPrintOperation *print_op; GtkPrintOperation *print_op;
GtkPageSetup *page_setup; GtkPageSetup *page_setup;
@ -886,7 +886,7 @@ MENUHANDLER(savelink)
{ {
struct gtk_scaffolding *g = (struct gtk_scaffolding *) data; struct gtk_scaffolding *g = (struct gtk_scaffolding *) data;
struct gui_window *gui = g->top_level; struct gui_window *gui = g->top_level;
struct browser_window *bw = gui_window_get_browser_window(gui); struct browser_window *bw = nsgtk_get_browser_window(gui);
if (!current_menu_link_box) if (!current_menu_link_box)
return FALSE; return FALSE;
@ -904,7 +904,7 @@ MENUHANDLER(link_openwin)
{ {
struct gtk_scaffolding *g = (struct gtk_scaffolding *) data; struct gtk_scaffolding *g = (struct gtk_scaffolding *) data;
struct gui_window *gui = g->top_level; struct gui_window *gui = g->top_level;
struct browser_window *bw = gui_window_get_browser_window(gui); struct browser_window *bw = nsgtk_get_browser_window(gui);
if (current_menu_link_box == NULL) if (current_menu_link_box == NULL)
return FALSE; return FALSE;
@ -921,7 +921,7 @@ MENUHANDLER(link_opentab)
{ {
struct gtk_scaffolding *g = (struct gtk_scaffolding *) data; struct gtk_scaffolding *g = (struct gtk_scaffolding *) data;
struct gui_window *gui = g->top_level; struct gui_window *gui = g->top_level;
struct browser_window *bw = gui_window_get_browser_window(gui); struct browser_window *bw = nsgtk_get_browser_window(gui);
temp_open_background = 1; temp_open_background = 1;
@ -938,7 +938,7 @@ MENUHANDLER(link_opentab)
MULTIHANDLER(cut) MULTIHANDLER(cut)
{ {
struct browser_window *bw = gui_window_get_browser_window(g->top_level); struct browser_window *bw = nsgtk_get_browser_window(g->top_level);
GtkWidget *focused = gtk_window_get_focus(g->window); GtkWidget *focused = gtk_window_get_focus(g->window);
/* If the url bar has focus, let gtk handle it */ /* If the url bar has focus, let gtk handle it */
@ -952,7 +952,7 @@ MULTIHANDLER(cut)
MULTIHANDLER(copy) MULTIHANDLER(copy)
{ {
struct browser_window *bw = gui_window_get_browser_window(g->top_level); struct browser_window *bw = nsgtk_get_browser_window(g->top_level);
GtkWidget *focused = gtk_window_get_focus(g->window); GtkWidget *focused = gtk_window_get_focus(g->window);
/* If the url bar has focus, let gtk handle it */ /* If the url bar has focus, let gtk handle it */
@ -992,7 +992,7 @@ MENUHANDLER(customize)
MULTIHANDLER(selectall) MULTIHANDLER(selectall)
{ {
struct browser_window *bw = gui_window_get_browser_window(g->top_level); struct browser_window *bw = nsgtk_get_browser_window(g->top_level);
if (nsgtk_widget_has_focus(GTK_WIDGET(g->url_bar))) { if (nsgtk_widget_has_focus(GTK_WIDGET(g->url_bar))) {
LOG(("Selecting all URL bar text")); LOG(("Selecting all URL bar text"));
@ -1013,7 +1013,7 @@ MULTIHANDLER(find)
MULTIHANDLER(preferences) MULTIHANDLER(preferences)
{ {
struct browser_window *bw = gui_window_get_browser_window(g->top_level); struct browser_window *bw = nsgtk_get_browser_window(g->top_level);
if (g->preferences_dialog == NULL) if (g->preferences_dialog == NULL)
g->preferences_dialog = nsgtk_options_init(bw, g->window); g->preferences_dialog = nsgtk_options_init(bw, g->window);
else else
@ -1024,7 +1024,7 @@ MULTIHANDLER(preferences)
MULTIHANDLER(zoomplus) MULTIHANDLER(zoomplus)
{ {
struct browser_window *bw = gui_window_get_browser_window(g->top_level); struct browser_window *bw = nsgtk_get_browser_window(g->top_level);
float old_scale = nsgtk_get_scale_for_gui(g->top_level); float old_scale = nsgtk_get_scale_for_gui(g->top_level);
browser_window_set_scale(bw, old_scale + 0.05, true); browser_window_set_scale(bw, old_scale + 0.05, true);
@ -1034,7 +1034,7 @@ MULTIHANDLER(zoomplus)
MULTIHANDLER(zoomnormal) MULTIHANDLER(zoomnormal)
{ {
struct browser_window *bw = gui_window_get_browser_window(g->top_level); struct browser_window *bw = nsgtk_get_browser_window(g->top_level);
browser_window_set_scale(bw, 1.0, true); browser_window_set_scale(bw, 1.0, true);
@ -1043,7 +1043,7 @@ MULTIHANDLER(zoomnormal)
MULTIHANDLER(zoomminus) MULTIHANDLER(zoomminus)
{ {
struct browser_window *bw = gui_window_get_browser_window(g->top_level); struct browser_window *bw = nsgtk_get_browser_window(g->top_level);
float old_scale = nsgtk_get_scale_for_gui(g->top_level); float old_scale = nsgtk_get_scale_for_gui(g->top_level);
browser_window_set_scale(bw, old_scale - 0.05, true); browser_window_set_scale(bw, old_scale - 0.05, true);
@ -1067,7 +1067,7 @@ MULTIHANDLER(fullscreen)
MULTIHANDLER(viewsource) MULTIHANDLER(viewsource)
{ {
nsgtk_source_dialog_init(g->window, nsgtk_source_dialog_init(g->window,
gui_window_get_browser_window(g->top_level)); nsgtk_get_browser_window(g->top_level));
return TRUE; return TRUE;
} }
@ -1209,7 +1209,7 @@ MULTIHANDLER(saveboxtree)
"Unable to open file for writing."); "Unable to open file for writing.");
} else { } else {
struct browser_window *bw; struct browser_window *bw;
bw = gui_window_get_browser_window(g->top_level); bw = nsgtk_get_browser_window(g->top_level);
if (bw->current_content && if (bw->current_content &&
content_get_type(bw->current_content) == content_get_type(bw->current_content) ==
@ -1258,7 +1258,7 @@ MULTIHANDLER(savedomtree)
"Unable to open file for writing."); "Unable to open file for writing.");
} else { } else {
struct browser_window *bw; struct browser_window *bw;
bw = gui_window_get_browser_window(g->top_level); bw = nsgtk_get_browser_window(g->top_level);
if (bw->current_content && if (bw->current_content &&
content_get_type(bw->current_content) == content_get_type(bw->current_content) ==
@ -1282,7 +1282,7 @@ MULTIHANDLER(savedomtree)
MULTIHANDLER(stop) MULTIHANDLER(stop)
{ {
struct browser_window *bw = struct browser_window *bw =
gui_window_get_browser_window(g->top_level); nsgtk_get_browser_window(g->top_level);
browser_window_stop(bw); browser_window_stop(bw);
@ -1292,7 +1292,7 @@ MULTIHANDLER(stop)
MULTIHANDLER(reload) MULTIHANDLER(reload)
{ {
struct browser_window *bw = struct browser_window *bw =
gui_window_get_browser_window(g->top_level); nsgtk_get_browser_window(g->top_level);
if (bw == NULL) if (bw == NULL)
return TRUE; return TRUE;
@ -1310,7 +1310,7 @@ MULTIHANDLER(reload)
MULTIHANDLER(back) MULTIHANDLER(back)
{ {
struct browser_window *bw = struct browser_window *bw =
gui_window_get_browser_window(g->top_level); nsgtk_get_browser_window(g->top_level);
if ((bw == NULL) || (!history_back_available(bw->history))) if ((bw == NULL) || (!history_back_available(bw->history)))
return TRUE; return TRUE;
@ -1330,7 +1330,7 @@ MULTIHANDLER(back)
MULTIHANDLER(forward) MULTIHANDLER(forward)
{ {
struct browser_window *bw = struct browser_window *bw =
gui_window_get_browser_window(g->top_level); nsgtk_get_browser_window(g->top_level);
if ((bw == NULL) || (!history_forward_available(bw->history))) if ((bw == NULL) || (!history_forward_available(bw->history)))
return TRUE; return TRUE;
@ -1351,7 +1351,7 @@ MULTIHANDLER(home)
{ {
static const char *addr = NETSURF_HOMEPAGE; static const char *addr = NETSURF_HOMEPAGE;
struct browser_window *bw = struct browser_window *bw =
gui_window_get_browser_window(g->top_level); nsgtk_get_browser_window(g->top_level);
if (option_homepage_url != NULL && option_homepage_url[0] != '\0') if (option_homepage_url != NULL && option_homepage_url[0] != '\0')
addr = option_homepage_url; addr = option_homepage_url;
@ -1364,7 +1364,7 @@ MULTIHANDLER(home)
MULTIHANDLER(localhistory) MULTIHANDLER(localhistory)
{ {
struct browser_window *bw = struct browser_window *bw =
gui_window_get_browser_window(g->top_level); nsgtk_get_browser_window(g->top_level);
int x,y, width, height, mainwidth, mainheight, margin = 20; int x,y, width, height, mainwidth, mainheight, margin = 20;
/* if entries of the same url but different frag_ids have been added /* if entries of the same url but different frag_ids have been added
@ -1402,7 +1402,7 @@ MULTIHANDLER(globalhistory)
MULTIHANDLER(addbookmarks) MULTIHANDLER(addbookmarks)
{ {
struct browser_window *bw = gui_window_get_browser_window(g->top_level); struct browser_window *bw = nsgtk_get_browser_window(g->top_level);
if (bw == NULL || bw->current_content == NULL || if (bw == NULL || bw->current_content == NULL ||
content_get_url(bw->current_content) == NULL) content_get_url(bw->current_content) == NULL)
@ -1457,7 +1457,7 @@ MULTIHANDLER(closetab)
MULTIHANDLER(contents) MULTIHANDLER(contents)
{ {
browser_window_go(gui_window_get_browser_window(g->top_level), browser_window_go(nsgtk_get_browser_window(g->top_level),
"http://www.netsurf-browser.org/documentation/", 0, true); "http://www.netsurf-browser.org/documentation/", 0, true);
return TRUE; return TRUE;
@ -1465,7 +1465,7 @@ MULTIHANDLER(contents)
MULTIHANDLER(guide) MULTIHANDLER(guide)
{ {
browser_window_go(gui_window_get_browser_window(g->top_level), browser_window_go(nsgtk_get_browser_window(g->top_level),
"http://www.netsurf-browser.org/documentation/guide", 0, true); "http://www.netsurf-browser.org/documentation/guide", 0, true);
return TRUE; return TRUE;
@ -1473,7 +1473,7 @@ MULTIHANDLER(guide)
MULTIHANDLER(info) MULTIHANDLER(info)
{ {
browser_window_go(gui_window_get_browser_window(g->top_level), browser_window_go(nsgtk_get_browser_window(g->top_level),
"http://www.netsurf-browser.org/documentation/info", 0, true); "http://www.netsurf-browser.org/documentation/info", 0, true);
return TRUE; return TRUE;
@ -1482,7 +1482,7 @@ MULTIHANDLER(info)
MULTIHANDLER(about) MULTIHANDLER(about)
{ {
nsgtk_about_dialog_init(g->window, nsgtk_about_dialog_init(g->window,
gui_window_get_browser_window(g->top_level), nsgtk_get_browser_window(g->top_level),
netsurf_version); netsurf_version);
return TRUE; return TRUE;
} }
@ -1505,7 +1505,7 @@ static gboolean nsgtk_history_expose_event(GtkWidget *widget,
struct rect clip; struct rect clip;
struct gtk_history_window *hw = (struct gtk_history_window *)g; struct gtk_history_window *hw = (struct gtk_history_window *)g;
struct browser_window *bw = struct browser_window *bw =
gui_window_get_browser_window(hw->g->top_level); nsgtk_get_browser_window(hw->g->top_level);
struct redraw_context ctx = { struct redraw_context ctx = {
.interactive = true, .interactive = true,
@ -1541,7 +1541,7 @@ static gboolean nsgtk_history_button_press_event(GtkWidget *widget,
{ {
struct gtk_history_window *hw = (struct gtk_history_window *)g; struct gtk_history_window *hw = (struct gtk_history_window *)g;
struct browser_window *bw = struct browser_window *bw =
gui_window_get_browser_window(hw->g->top_level); nsgtk_get_browser_window(hw->g->top_level);
LOG(("X=%g, Y=%g", event->x, event->y)); LOG(("X=%g, Y=%g", event->x, event->y));
@ -2220,7 +2220,7 @@ void nsgtk_scaffolding_toggle_search_bar_visibility(nsgtk_scaffolding *g)
{ {
gboolean vis; gboolean vis;
struct browser_window *bw = struct browser_window *bw =
gui_window_get_browser_window(g->top_level); nsgtk_get_browser_window(g->top_level);
g_object_get(G_OBJECT(g->search->bar), "visible", &vis, NULL); g_object_get(G_OBJECT(g->search->bar), "visible", &vis, NULL);
if (vis) { if (vis) {
if (bw != NULL) if (bw != NULL)
@ -2243,7 +2243,7 @@ struct gui_window *nsgtk_scaffolding_top_level(nsgtk_scaffolding *g)
void nsgtk_scaffolding_set_top_level (struct gui_window *gw) void nsgtk_scaffolding_set_top_level (struct gui_window *gw)
{ {
nsgtk_get_scaffold(gw)->top_level = gw; nsgtk_get_scaffold(gw)->top_level = gw;
struct browser_window *bw = gui_window_get_browser_window(gw); struct browser_window *bw = nsgtk_get_browser_window(gw);
assert(bw != NULL); assert(bw != NULL);
@ -2334,7 +2334,7 @@ void nsgtk_scaffolding_initial_sensitivity(struct gtk_scaffolding *g)
*/ */
static bool is_menu_over_link(struct gtk_scaffolding *g, gdouble x, gdouble y) static bool is_menu_over_link(struct gtk_scaffolding *g, gdouble x, gdouble y)
{ {
struct browser_window *bw = gui_window_get_browser_window(g->top_level); struct browser_window *bw = nsgtk_get_browser_window(g->top_level);
current_menu_link_box = NULL; current_menu_link_box = NULL;
if ((bw->current_content != NULL) && if ((bw->current_content != NULL) &&

View File

@ -60,7 +60,7 @@ static struct search_callbacks nsgtk_search_callbacks = {
gboolean nsgtk_search_forward_button_clicked(GtkWidget *widget, gpointer data) gboolean nsgtk_search_forward_button_clicked(GtkWidget *widget, gpointer data)
{ {
struct gtk_scaffolding *g = (struct gtk_scaffolding *)data; struct gtk_scaffolding *g = (struct gtk_scaffolding *)data;
struct browser_window *bw = gui_window_get_browser_window( struct browser_window *bw = nsgtk_get_browser_window(
nsgtk_scaffolding_top_level(g)); nsgtk_scaffolding_top_level(g));
nsgtk_search_init(g); nsgtk_search_init(g);
search_flags_t flags = SEARCH_FLAG_FORWARDS | search_flags_t flags = SEARCH_FLAG_FORWARDS |
@ -82,7 +82,7 @@ gboolean nsgtk_search_forward_button_clicked(GtkWidget *widget, gpointer data)
gboolean nsgtk_search_back_button_clicked(GtkWidget *widget, gpointer data) gboolean nsgtk_search_back_button_clicked(GtkWidget *widget, gpointer data)
{ {
struct gtk_scaffolding *g = (struct gtk_scaffolding *)data; struct gtk_scaffolding *g = (struct gtk_scaffolding *)data;
struct browser_window *bw = gui_window_get_browser_window( struct browser_window *bw = nsgtk_get_browser_window(
nsgtk_scaffolding_top_level(g)); nsgtk_scaffolding_top_level(g));
nsgtk_search_init(g); nsgtk_search_init(g);
search_flags_t flags = 0 |(gtk_toggle_button_get_active( search_flags_t flags = 0 |(gtk_toggle_button_get_active(
@ -105,10 +105,10 @@ void nsgtk_search_init(struct gtk_scaffolding *g)
{ {
hlcache_handle *c; hlcache_handle *c;
assert(gui_window_get_browser_window(nsgtk_scaffolding_top_level(g)) assert(nsgtk_get_browser_window(nsgtk_scaffolding_top_level(g))
!= NULL); != NULL);
c = gui_window_get_browser_window(nsgtk_scaffolding_top_level(g))-> c = nsgtk_get_browser_window(nsgtk_scaffolding_top_level(g))->
current_content; current_content;
if ((!c) || (content_get_type(c) != CONTENT_HTML && if ((!c) || (content_get_type(c) != CONTENT_HTML &&
@ -131,7 +131,7 @@ gboolean nsgtk_search_close_button_clicked(GtkWidget *widget, gpointer data)
gboolean nsgtk_search_entry_changed(GtkWidget *widget, gpointer data) gboolean nsgtk_search_entry_changed(GtkWidget *widget, gpointer data)
{ {
nsgtk_scaffolding *g = (nsgtk_scaffolding *)data; nsgtk_scaffolding *g = (nsgtk_scaffolding *)data;
struct browser_window *bw = gui_window_get_browser_window( struct browser_window *bw = nsgtk_get_browser_window(
nsgtk_scaffolding_top_level(g)); nsgtk_scaffolding_top_level(g));
if (bw != NULL) if (bw != NULL)
@ -147,7 +147,7 @@ gboolean nsgtk_search_entry_changed(GtkWidget *widget, gpointer data)
gboolean nsgtk_search_entry_activate(GtkWidget *widget, gpointer data) gboolean nsgtk_search_entry_activate(GtkWidget *widget, gpointer data)
{ {
nsgtk_scaffolding *g = (nsgtk_scaffolding *)data; nsgtk_scaffolding *g = (nsgtk_scaffolding *)data;
struct browser_window *bw = gui_window_get_browser_window( struct browser_window *bw = nsgtk_get_browser_window(
nsgtk_scaffolding_top_level(g)); nsgtk_scaffolding_top_level(g));
nsgtk_search_init(g); nsgtk_search_init(g);
search_flags_t flags = SEARCH_FLAG_FORWARDS | search_flags_t flags = SEARCH_FLAG_FORWARDS |
@ -183,7 +183,7 @@ gboolean nsgtk_websearch_activate(GtkWidget *widget, gpointer data)
{ {
struct gtk_scaffolding *g = (struct gtk_scaffolding *)data; struct gtk_scaffolding *g = (struct gtk_scaffolding *)data;
temp_open_background = 0; temp_open_background = 0;
search_web_new_window(gui_window_get_browser_window( search_web_new_window(nsgtk_get_browser_window(
nsgtk_scaffolding_top_level(g)), nsgtk_scaffolding_top_level(g)),
(char *)gtk_entry_get_text(GTK_ENTRY( (char *)gtk_entry_get_text(GTK_ENTRY(
nsgtk_scaffolding_websearch(g)))); nsgtk_scaffolding_websearch(g))));

View File

@ -96,7 +96,7 @@ void gui_paste_from_clipboard(struct gui_window *g, int x, int y)
text = gtk_clipboard_wait_for_text (clipboard); text = gtk_clipboard_wait_for_text (clipboard);
/* clipboard_wait... converts the string to utf8 for us */ /* clipboard_wait... converts the string to utf8 for us */
if (text != NULL) if (text != NULL)
browser_window_paste_text(gui_window_get_browser_window(g), browser_window_paste_text(nsgtk_get_browser_window(g),
text, strlen(text), true); text, strlen(text), true);
g_free(text); g_free(text);
} }

View File

@ -78,7 +78,7 @@ void nsgtk_tab_add(struct gui_window *window, GtkWidget *tab_contents, bool back
"blankpage", NULL); */ "blankpage", NULL); */
/* segfaults /* segfaults
struct browser_window *bw = struct browser_window *bw =
gui_window_get_browser_window(window); nsgtk_get_browser_window(window);
browser_window_go(bw, blankpage, 0, true); */ browser_window_go(bw, blankpage, 0, true); */
/* free(blankpage); */ /* free(blankpage); */
} }
@ -191,7 +191,7 @@ void nsgtk_tab_page_changed(GtkNotebook *notebook, gpointer *page,
"gui_window"); "gui_window");
if (gw == NULL) if (gw == NULL)
return; return;
struct browser_window *bw = gui_window_get_browser_window(gw); struct browser_window *bw = nsgtk_get_browser_window(gw);
if (bw == NULL) if (bw == NULL)
return; return;

View File

@ -410,19 +410,19 @@ void nsgtk_toolbar_close(nsgtk_scaffolding *g)
nsgtk_window_get_signalhandler( nsgtk_window_get_signalhandler(
nsgtk_scaffolding_top_level(list), nsgtk_scaffolding_top_level(list),
NSGTK_WINDOW_SIGNAL_REDRAW)); NSGTK_WINDOW_SIGNAL_REDRAW));
if ((gui_window_get_browser_window(nsgtk_scaffolding_top_level( if ((nsgtk_get_browser_window(nsgtk_scaffolding_top_level(
list))->current_content != NULL) && list))->current_content != NULL) &&
(content_get_url(gui_window_get_browser_window( (content_get_url(nsgtk_get_browser_window(
nsgtk_scaffolding_top_level(list))-> nsgtk_scaffolding_top_level(list))->
current_content) != NULL)) current_content) != NULL))
browser_window_refresh_url_bar( browser_window_refresh_url_bar(
gui_window_get_browser_window( nsgtk_get_browser_window(
nsgtk_scaffolding_top_level(list)), nsgtk_scaffolding_top_level(list)),
content_get_url( content_get_url(
gui_window_get_browser_window( nsgtk_get_browser_window(
nsgtk_scaffolding_top_level(list))-> nsgtk_scaffolding_top_level(list))->
current_content), current_content),
gui_window_get_browser_window( nsgtk_get_browser_window(
nsgtk_scaffolding_top_level(list))-> nsgtk_scaffolding_top_level(list))->
frag_id); frag_id);

View File

@ -101,7 +101,7 @@ nsgtk_scaffolding *nsgtk_get_scaffold(struct gui_window *g)
return g->scaffold; return g->scaffold;
} }
struct browser_window *gui_window_get_browser_window(struct gui_window *g) struct browser_window *nsgtk_get_browser_window(struct gui_window *g)
{ {
return g->bw; return g->bw;
} }

View File

@ -33,6 +33,8 @@ typedef enum nsgtk_window_signals {
extern struct gui_window *window_list; extern struct gui_window *window_list;
extern int temp_open_background; extern int temp_open_background;
struct browser_window *nsgtk_get_browser_window(struct gui_window *g);
nsgtk_scaffolding *nsgtk_get_scaffold(struct gui_window *g); nsgtk_scaffolding *nsgtk_get_scaffold(struct gui_window *g);
void nsgtk_reflow_all_windows(void); void nsgtk_reflow_all_windows(void);
void nsgtk_window_process_reformats(void); void nsgtk_window_process_reformats(void);

View File

@ -110,12 +110,6 @@ gui_create_browser_window(struct browser_window *bw,
return ret; return ret;
} }
struct browser_window *
gui_window_get_browser_window(struct gui_window *g)
{
return g->bw;
}
void void
gui_window_destroy(struct gui_window *g) gui_window_destroy(struct gui_window *g)
{ {