summaryrefslogtreecommitdiff
path: root/gtk
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2014-01-12 17:07:34 +0000
committerVincent Sanders <vince@kyllikki.org>2014-01-12 17:07:34 +0000
commitb7736bae2f37675be55b1c89d33b03e8603b2946 (patch)
tree31d4c9aa165b71ff33d181b0d2b4982812963100 /gtk
parent56bb9582b16dfd45bbd1665adaf87c6c5986aed3 (diff)
downloadnetsurf-b7736bae2f37675be55b1c89d33b03e8603b2946.tar.gz
netsurf-b7736bae2f37675be55b1c89d33b03e8603b2946.tar.bz2
split gui operations into core and window and move more operations into tables
Diffstat (limited to 'gtk')
-rw-r--r--gtk/dialogs/preferences.c4
-rw-r--r--gtk/gui.c18
-rw-r--r--gtk/scaffolding.c5
-rw-r--r--gtk/scaffolding.h2
-rw-r--r--gtk/toolbar.c4
-rw-r--r--gtk/window.c26
-rw-r--r--gtk/window.h5
7 files changed, 30 insertions, 34 deletions
diff --git a/gtk/dialogs/preferences.c b/gtk/dialogs/preferences.c
index 0669f8d9f..18c8d7b6c 100644
--- a/gtk/dialogs/preferences.c
+++ b/gtk/dialogs/preferences.c
@@ -944,9 +944,7 @@ nsgtk_preferences_comboSearch_changed(GtkComboBox *widget, struct ppref *priv)
search_web_retrieve_ico(false);
/* callback may handle changing gui */
- if (search_web_ico() != NULL) {
- gui_window_set_search_ico(search_web_ico());
- }
+ gui_set_search_ico(search_web_ico());
/* set entry */
name = search_web_provider_name();
diff --git a/gtk/gui.c b/gtk/gui.c
index 1905f20dc..0a89f0ee3 100644
--- a/gtk/gui.c
+++ b/gtk/gui.c
@@ -676,11 +676,6 @@ void gui_create_form_select_menu(struct browser_window *bw,
}
-void gui_window_save_link(struct gui_window *g, const char *url,
- const char *title)
-{
-}
-
void gui_launch_url(const char *url)
{
gboolean ok;
@@ -1132,17 +1127,11 @@ 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,
+ .set_search_ico = gui_set_search_ico,
};
/**
@@ -1181,6 +1170,9 @@ int main(int argc, char** argv)
/* common initialisation */
messages = filepath_find(respaths, "Messages");
+
+ nsgtk_gui_table.window = nsgtk_gui_window_table;
+
ret = netsurf_init(messages, &nsgtk_gui_table);
free(messages);
if (ret != NSERROR_OK) {
diff --git a/gtk/scaffolding.c b/gtk/scaffolding.c
index b39283cc6..098d5e121 100644
--- a/gtk/scaffolding.c
+++ b/gtk/scaffolding.c
@@ -2147,8 +2147,7 @@ nsgtk_scaffolding *nsgtk_new_scaffolding(struct gui_window *toplevel)
nsgtk_theme_implement(g);
/* set web search ico */
- if (search_web_ico() != NULL)
- gui_window_set_search_ico(search_web_ico());
+ gui_set_search_ico(search_web_ico());
/* finally, show the window. */
gtk_widget_show(GTK_WIDGET(g->window));
@@ -2261,7 +2260,7 @@ nsgtk_scaffolding_set_icon(struct gui_window *gw)
gtk_widget_show_all(GTK_WIDGET(sc->buttons[URL_BAR_ITEM]->button));
}
-void gui_window_set_search_ico(hlcache_handle *ico)
+void gui_set_search_ico(hlcache_handle *ico)
{
struct bitmap *srch_bitmap;
nsgtk_scaffolding *current;
diff --git a/gtk/scaffolding.h b/gtk/scaffolding.h
index b1f11bbdf..43eb41b19 100644
--- a/gtk/scaffolding.h
+++ b/gtk/scaffolding.h
@@ -182,6 +182,6 @@ 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);
-
+void gui_set_search_ico(hlcache_handle *ico);
#endif /* NETSURF_GTK_SCAFFOLDING_H */
diff --git a/gtk/toolbar.c b/gtk/toolbar.c
index d543ca5fd..8453f4e27 100644
--- a/gtk/toolbar.c
+++ b/gtk/toolbar.c
@@ -449,8 +449,8 @@ void nsgtk_toolbar_close(nsgtk_scaffolding *g)
TRUE);
/* update favicon etc */
nsgtk_scaffolding_set_top_level(nsgtk_scaffolding_top_level(g));
- if (search_web_ico())
- gui_window_set_search_ico(search_web_ico());
+
+ gui_set_search_ico(search_web_ico());
}
/**
diff --git a/gtk/window.c b/gtk/window.c
index aabaacbb8..075678cb0 100644
--- a/gtk/window.c
+++ b/gtk/window.c
@@ -656,7 +656,7 @@ static void window_destroy(GtkWidget *widget, gpointer data)
}
/* Core interface documented in desktop/gui.h to create a gui_window */
-struct gui_window *
+static struct gui_window *
gui_window_create(struct browser_window *bw,
struct browser_window *clone,
bool new_tab)
@@ -838,7 +838,7 @@ void nsgtk_window_destroy_browser(struct gui_window *gw)
gtk_widget_destroy(gw->container);
}
-void gui_window_destroy(struct gui_window *g)
+static void gui_window_destroy(struct gui_window *g)
{
LOG(("gui_window: %p", g));
assert(g != NULL);
@@ -861,7 +861,7 @@ void gui_window_destroy(struct gui_window *g)
/**
* set favicon
*/
-void gui_window_set_icon(struct gui_window *gw, hlcache_handle *icon)
+static void gui_window_set_icon(struct gui_window *gw, hlcache_handle *icon)
{
struct bitmap *icon_bitmap = NULL;
@@ -1128,11 +1128,6 @@ bool gui_window_scroll_start(struct gui_window *g)
return true;
}
-bool gui_window_drag_start(struct gui_window *g, gui_drag_type type,
- const struct rect *rect)
-{
- return true;
-}
void gui_drag_save_object(gui_save_type type, hlcache_handle *c,
struct gui_window *g)
@@ -1195,3 +1190,18 @@ void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
gtk_widget_destroy(dialog);
}
+
+static struct gui_window_table gui_window_table = {
+ .create = gui_window_create,
+ .destroy = gui_window_destroy,
+
+ .set_icon = gui_window_set_icon,
+
+ /* from scaffold */
+ .set_title = gui_window_set_title,
+ .set_url = gui_window_set_url,
+ .start_throbber = gui_window_start_throbber,
+ .stop_throbber = gui_window_stop_throbber,
+};
+
+struct gui_window_table *nsgtk_gui_window_table = &gui_window_table;
diff --git a/gtk/window.h b/gtk/window.h
index 9ff036e85..b6953a99e 100644
--- a/gtk/window.h
+++ b/gtk/window.h
@@ -32,7 +32,7 @@ typedef enum nsgtk_window_signals {
extern struct gui_window *window_list;
extern int temp_open_background;
-
+extern struct gui_window_table *nsgtk_gui_window_table;
struct browser_window *nsgtk_get_browser_window(struct gui_window *g);
nsgtk_scaffolding *nsgtk_get_scaffold(struct gui_window *g);
@@ -48,7 +48,4 @@ struct gui_window *nsgtk_window_iterate(struct gui_window *g);
GtkWidget *nsgtk_window_get_tab(struct gui_window *g);
void nsgtk_window_set_tab(struct gui_window *g, GtkWidget *w);
-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);
-
#endif /* NETSURF_GTK_WINDOW_H */