summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2014-10-24 20:45:21 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2014-10-24 20:45:21 +0100
commit94f32b83694b4a45e723d0fdfd6f4496701e56e3 (patch)
tree329a612a4061e97858459b110e8c44987194b76e
parent69e82a8966e7e5b8157856a5c990eaabc7b3fc79 (diff)
downloadnetsurf-94f32b83694b4a45e723d0fdfd6f4496701e56e3.tar.gz
netsurf-94f32b83694b4a45e723d0fdfd6f4496701e56e3.tar.bz2
Move create_form_select_menu to window gui table.
-rw-r--r--amiga/gui.c2
-rw-r--r--beos/gui.cpp1
-rw-r--r--beos/window.cpp1
-rw-r--r--cocoa/gui.m2
-rw-r--r--desktop/browser.c2
-rw-r--r--desktop/gui_factory.c17
-rw-r--r--desktop/gui_misc.h5
-rw-r--r--desktop/gui_window.h5
-rw-r--r--gtk/gui.c54
-rw-r--r--gtk/window.c55
-rw-r--r--riscos/gui.c1
-rw-r--r--riscos/gui.h1
-rw-r--r--riscos/window.c3
13 files changed, 75 insertions, 74 deletions
diff --git a/amiga/gui.c b/amiga/gui.c
index 391b3a387..587c285f6 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -5082,6 +5082,7 @@ static struct gui_window_table amiga_window_table = {
.remove_caret = gui_window_remove_caret,
.drag_start = gui_window_drag_start,
.new_content = gui_window_new_content,
+ .create_form_select_menu = gui_create_form_select_menu,
.file_gadget_open = gui_file_gadget_open,
.drag_save_object = gui_drag_save_object,
.drag_save_selection =gui_drag_save_selection,
@@ -5112,7 +5113,6 @@ static struct gui_browser_table amiga_browser_table = {
.quit = gui_quit,
.launch_url = gui_launch_url,
- .create_form_select_menu = gui_create_form_select_menu,
.cert_verify = gui_cert_verify,
.login = gui_401login_open,
};
diff --git a/beos/gui.cpp b/beos/gui.cpp
index dab0e6097..eeadd8407 100644
--- a/beos/gui.cpp
+++ b/beos/gui.cpp
@@ -984,7 +984,6 @@ static struct gui_browser_table beos_browser_table = {
beos_schedule,
gui_quit,
gui_launch_url,
- NULL, //create_form_select_menu
NULL, //cert_verify
gui_401login_open
};
diff --git a/beos/window.cpp b/beos/window.cpp
index 44dd8e5ac..8202aa14d 100644
--- a/beos/window.cpp
+++ b/beos/window.cpp
@@ -1362,6 +1362,7 @@ static struct gui_window_table window_table = {
NULL, //scroll_visible
NULL, //scroll_start
gui_window_new_content,
+ NULL, //create_form_select_menu
NULL, //file_gadget_open
NULL, //drag_save_object
NULL, //drag_save_selection
diff --git a/cocoa/gui.m b/cocoa/gui.m
index d030a68b9..28e68e9f7 100644
--- a/cocoa/gui.m
+++ b/cocoa/gui.m
@@ -292,6 +292,7 @@ static struct gui_window_table window_table = {
.new_content = gui_window_new_content,
.start_throbber = gui_window_start_throbber,
.stop_throbber = gui_window_stop_throbber,
+ .create_form_select_menu = gui_create_form_select_menu,
};
struct gui_window_table *cocoa_window_table = &window_table;
@@ -301,7 +302,6 @@ static struct gui_browser_table browser_table = {
.schedule = cocoa_schedule,
.launch_url = gui_launch_url,
- .create_form_select_menu = gui_create_form_select_menu,
.cert_verify = gui_cert_verify,
};
diff --git a/desktop/browser.c b/desktop/browser.c
index 3eaa733b8..10df156e5 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -1604,7 +1604,7 @@ static nserror browser_window_callback(hlcache_handle *c,
if (event->data.select_menu.gadget->type == GADGET_SELECT) {
struct browser_window *root =
browser_window_get_root(bw);
- guit->browser->create_form_select_menu(root->window,
+ guit->window->create_form_select_menu(root->window,
event->data.select_menu.gadget);
}
diff --git a/desktop/gui_factory.c b/desktop/gui_factory.c
index c0cf0ffc5..e7770e770 100644
--- a/desktop/gui_factory.c
+++ b/desktop/gui_factory.c
@@ -108,6 +108,11 @@ static void gui_default_window_remove_caret(struct gui_window *g)
{
}
+static void gui_default_window_create_form_select_menu(struct gui_window *g,
+ struct form_control *control)
+{
+}
+
static void gui_default_window_file_gadget_open(struct gui_window *g,
hlcache_handle *hl,
struct form_control *gadget)
@@ -211,6 +216,10 @@ static nserror verify_window_register(struct gui_window_table *gwt)
if (gwt->scroll_start == NULL) {
gwt->scroll_start = gui_default_window_scroll_start;
}
+ if (gwt->create_form_select_menu == NULL) {
+ gwt->create_form_select_menu =
+ gui_default_window_create_form_select_menu;
+ }
if (gwt->file_gadget_open == NULL) {
gwt->file_gadget_open = gui_default_window_file_gadget_open;
}
@@ -541,11 +550,6 @@ static nserror gui_default_launch_url(struct nsurl *url)
return NSERROR_NO_FETCH_HANDLER;
}
-static void gui_default_create_form_select_menu(struct gui_window *g,
- struct form_control *control)
-{
-}
-
static void gui_default_cert_verify(nsurl *url,
const struct ssl_cert_info *certs,
@@ -589,9 +593,6 @@ static nserror verify_browser_register(struct gui_browser_table *gbt)
if (gbt->launch_url == NULL) {
gbt->launch_url = gui_default_launch_url;
}
- if (gbt->create_form_select_menu == NULL) {
- gbt->create_form_select_menu = gui_default_create_form_select_menu;
- }
if (gbt->cert_verify == NULL) {
gbt->cert_verify = gui_default_cert_verify;
}
diff --git a/desktop/gui_misc.h b/desktop/gui_misc.h
index 5c47668e3..daad6ba2e 100644
--- a/desktop/gui_misc.h
+++ b/desktop/gui_misc.h
@@ -70,11 +70,6 @@ struct gui_browser_table {
nserror (*launch_url)(struct nsurl *url);
/**
- * create a form select menu
- */
- void (*create_form_select_menu)(struct gui_window *gw, struct form_control *control);
-
- /**
* verify certificate
*/
void (*cert_verify)(struct nsurl *url, const struct ssl_cert_info *certs, unsigned long num, nserror (*cb)(bool proceed, void *pw), void *cbpw);
diff --git a/desktop/gui_window.h b/desktop/gui_window.h
index f5240a6b4..e503d4b86 100644
--- a/desktop/gui_window.h
+++ b/desktop/gui_window.h
@@ -267,6 +267,11 @@ struct gui_window_table {
void (*new_content)(struct gui_window *g);
/**
+ * create a form select menu
+ */
+ void (*create_form_select_menu)(struct gui_window *gw, struct form_control *control);
+
+ /**
* Called when file chooser gadget is activated
*/
void (*file_gadget_open)(struct gui_window *g, struct hlcache_handle *hl, struct form_control *gadget);
diff --git a/gtk/gui.c b/gtk/gui.c
index 12f1c1602..5e691be6f 100644
--- a/gtk/gui.c
+++ b/gtk/gui.c
@@ -52,7 +52,6 @@
#include "content/hlcache.h"
#include "content/urldb.h"
#include "content/backing_store.h"
-#include "render/form.h"
#include "desktop/browser.h"
#include "desktop/save_complete.h"
#include "desktop/save_pdf/pdf_plotters.h"
@@ -94,15 +93,10 @@ struct glade_file_location_s *glade_file_location;
static GtkWindow *nsgtk_warning_window;
GtkWidget *widWarning;
-static GtkWidget *select_menu;
-static struct form_control *select_menu_control;
-
static void nsgtk_ssl_accept(GtkButton *w, gpointer data);
static void nsgtk_ssl_reject(GtkWidget *w, gpointer data);
static gboolean nsgtk_ssl_delete_event(GtkWidget *w, GdkEvent *event,
gpointer data);
-static void nsgtk_select_menu_clicked(GtkCheckMenuItem *checkmenuitem,
- gpointer user_data);
#ifdef WITH_PDF_EXPORT
static void nsgtk_PDF_set_pass(GtkButton *w, gpointer data);
static void nsgtk_PDF_no_pass(GtkButton *w, gpointer data);
@@ -557,53 +551,6 @@ static void gui_quit(void)
gtk_fetch_filetype_fin();
}
-static void nsgtk_select_menu_clicked(GtkCheckMenuItem *checkmenuitem,
- gpointer user_data)
-{
- form_select_process_selection(select_menu_control,
- (intptr_t)user_data);
-}
-
-static void gui_create_form_select_menu(struct gui_window *g,
- struct form_control *control)
-{
-
- intptr_t i;
- struct form_option *option;
-
- GtkWidget *menu_item;
-
- /* control->data.select.multiple is true if multiple selections
- * are allowable. We ignore this, as the core handles it for us.
- * Yay. \o/
- */
-
- if (select_menu != NULL)
- gtk_widget_destroy(select_menu);
-
- select_menu = gtk_menu_new();
- select_menu_control = control;
-
- for (i = 0, option = control->data.select.items; option;
- i++, option = option->next) {
- menu_item = gtk_check_menu_item_new_with_label(option->text);
- if (option->selected)
- gtk_check_menu_item_set_active(
- GTK_CHECK_MENU_ITEM(menu_item), TRUE);
-
- g_signal_connect(menu_item, "toggled",
- G_CALLBACK(nsgtk_select_menu_clicked), (gpointer)i);
-
- gtk_menu_shell_append(GTK_MENU_SHELL(select_menu), menu_item);
- }
-
- gtk_widget_show_all(select_menu);
-
- gtk_menu_popup(GTK_MENU(select_menu), NULL, NULL, NULL,
- NULL /* data */, 0, gtk_get_current_event_time());
-
-}
-
static nserror gui_launch_url(struct nsurl *url)
{
gboolean ok;
@@ -1240,7 +1187,6 @@ static struct gui_browser_table nsgtk_browser_table = {
.quit = gui_quit,
.launch_url = gui_launch_url,
- .create_form_select_menu = gui_create_form_select_menu,
.cert_verify = gui_cert_verify,
.login = gui_401login_open,
};
diff --git a/gtk/window.c b/gtk/window.c
index e444d7bfa..00aad32d2 100644
--- a/gtk/window.c
+++ b/gtk/window.c
@@ -38,6 +38,7 @@
#include "desktop/searchweb.h"
#include "desktop/textinput.h"
#include "desktop/gui_window.h"
+#include "render/form.h"
#include "gtk/compat.h"
#include "gtk/gui.h"
@@ -54,6 +55,12 @@
extern const GdkPixdata menu_cursor_pixdata;
+static GtkWidget *select_menu;
+static struct form_control *select_menu_control;
+
+static void nsgtk_select_menu_clicked(GtkCheckMenuItem *checkmenuitem,
+ gpointer user_data);
+
struct gui_window {
/** The gtk scaffold object containing menu, buttons, url bar, [tabs],
* drawing area, etc that may contain one or more gui_windows.
@@ -162,6 +169,13 @@ float nsgtk_get_scale_for_gui(struct gui_window *g)
return browser_window_get_scale(g->bw);
}
+static void nsgtk_select_menu_clicked(GtkCheckMenuItem *checkmenuitem,
+ gpointer user_data)
+{
+ form_select_process_selection(select_menu_control,
+ (intptr_t)user_data);
+}
+
#if GTK_CHECK_VERSION(3,0,0)
static gboolean
@@ -1199,6 +1213,46 @@ static void gui_window_start_selection(struct gui_window *g)
gtk_widget_grab_focus(GTK_WIDGET(g->layout));
}
+static void gui_window_create_form_select_menu(struct gui_window *g,
+ struct form_control *control)
+{
+
+ intptr_t i;
+ struct form_option *option;
+
+ GtkWidget *menu_item;
+
+ /* control->data.select.multiple is true if multiple selections
+ * are allowable. We ignore this, as the core handles it for us.
+ * Yay. \o/
+ */
+
+ if (select_menu != NULL)
+ gtk_widget_destroy(select_menu);
+
+ select_menu = gtk_menu_new();
+ select_menu_control = control;
+
+ for (i = 0, option = control->data.select.items; option;
+ i++, option = option->next) {
+ menu_item = gtk_check_menu_item_new_with_label(option->text);
+ if (option->selected)
+ gtk_check_menu_item_set_active(
+ GTK_CHECK_MENU_ITEM(menu_item), TRUE);
+
+ g_signal_connect(menu_item, "toggled",
+ G_CALLBACK(nsgtk_select_menu_clicked), (gpointer)i);
+
+ gtk_menu_shell_append(GTK_MENU_SHELL(select_menu), menu_item);
+ }
+
+ gtk_widget_show_all(select_menu);
+
+ gtk_menu_popup(GTK_MENU(select_menu), NULL, NULL, NULL,
+ NULL /* data */, 0, gtk_get_current_event_time());
+
+}
+
static void
gui_window_file_gadget_open(struct gui_window *g,
hlcache_handle *hl,
@@ -1247,6 +1301,7 @@ static struct gui_window_table window_table = {
.set_pointer = gui_window_set_pointer,
.place_caret = gui_window_place_caret,
.remove_caret = gui_window_remove_caret,
+ .create_form_select_menu = gui_window_create_form_select_menu,
.file_gadget_open = gui_window_file_gadget_open,
.start_selection = gui_window_start_selection,
diff --git a/riscos/gui.c b/riscos/gui.c
index 90825b07c..ade22cb48 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -2408,7 +2408,6 @@ static struct gui_browser_table riscos_browser_table = {
.quit = gui_quit,
.launch_url = gui_launch_url,
- .create_form_select_menu = gui_create_form_select_menu,
.cert_verify = gui_cert_verify,
.login = gui_401login_open,
};
diff --git a/riscos/gui.h b/riscos/gui.h
index f402fc925..9077afeab 100644
--- a/riscos/gui.h
+++ b/riscos/gui.h
@@ -159,7 +159,6 @@ bool ro_gui_shift_pressed(void);
bool ro_gui_ctrl_pressed(void);
bool ro_gui_alt_pressed(void);
void gui_window_set_pointer(struct gui_window *g, enum gui_pointer_shape shape);
-void gui_create_form_select_menu(struct gui_window *g, struct form_control *control);
/* in history.c */
void ro_gui_history_init(void);
diff --git a/riscos/window.c b/riscos/window.c
index 1af124901..eafc8145b 100644
--- a/riscos/window.c
+++ b/riscos/window.c
@@ -1358,7 +1358,7 @@ void gui_window_set_extent(struct gui_window *g, int width, int height)
* \param control form control of type GADGET_SELECT
*/
-void gui_create_form_select_menu(struct gui_window *g,
+static void gui_window_create_form_select_menu(struct gui_window *g,
struct form_control *control)
{
os_error *error;
@@ -5044,6 +5044,7 @@ static struct gui_window_table window_table = {
.new_content = gui_window_new_content,
.start_throbber = gui_window_start_throbber,
.stop_throbber = gui_window_stop_throbber,
+ .create_form_select_menu = gui_window_create_form_select_menu,
/* from save */
.drag_save_object = gui_drag_save_object,