78#define INACTIVE_LOCATION (-1)
83#define THROBBER_FRAME_TIME (100)
88#define NSGTK_MIN_STORE_COLUMNS 4
93#define NSGTK_BUTTON_WIDTH 120
99#define NSGTK_BUTTON_HEIGHT 70
104#define NSGTK_WEBSEARCH_WIDTH 150
134 gboolean (*
clicked)(GtkWidget *widget, gpointer data);
266 ret = malloc(len + 1);
270 for (i = 0, ii = 0; i < len; i++) {
273 }
else if (replacespace) {
303 item = gtk_tool_button_new(
304 GTK_WIDGET(gtk_image_new_from_pixbuf(pixbuf)),
307 item = gtk_tool_item_new();
309 image = gtk_image_new_from_pixbuf(pixbuf);
316 gtk_container_add(GTK_CONTAINER(item), image);
319 gtk_widget_set_sensitive(GTK_WIDGET(item), sensitivity);
338 GtkEntryCompletion *completion;
347 "page-info-internal");
350 gtk_entry_set_width_chars(GTK_ENTRY(entry), 9);
352 item = gtk_tool_button_new(NULL,
"URL");
353 gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(item), entry);
355 completion = gtk_entry_completion_new();
356 if (completion != NULL) {
357 gtk_entry_set_completion(GTK_ENTRY(entry), completion);
360 item = gtk_tool_item_new();
365 gtk_container_add(GTK_CONTAINER(item), entry);
366 gtk_tool_item_set_expand(item, TRUE);
369 gtk_widget_set_sensitive(GTK_WIDGET(item), TRUE);
370 gtk_widget_set_sensitive(GTK_WIDGET(entry), sensitivity);
386 GdkPixbuf *pixbuf = NULL;
399 if (pixbuf != NULL) {
403 g_object_unref(pixbuf);
411 gtk_entry_set_width_chars(GTK_ENTRY(entry), 9);
413 item = gtk_tool_button_new(NULL,
"Web Search");
414 gtk_tool_button_set_icon_widget(GTK_TOOL_BUTTON(item),
419 item = gtk_tool_item_new();
424 gtk_container_add(GTK_CONTAINER(item), entry);
426 gtk_widget_set_sensitive(GTK_WIDGET(item), TRUE);
427 gtk_widget_set_sensitive(GTK_WIDGET(entry), sensitivity);
440 const char *msg =
"H";
447 item = gtk_tool_button_new(NULL, label);
451 gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(item),
"local-history");
454 gtk_widget_set_size_request(GTK_WIDGET(item), 20, -1);
455 gtk_widget_set_sensitive(GTK_WIDGET(item), sensitivity);
466 const char *iconname,
475 item = gtk_tool_button_new(NULL, label);
481 gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(item), iconname);
483 gtk_widget_set_sensitive(GTK_WIDGET(item), sensitivity);
503 GtkToolItem *toolitem = NULL;
506#define TOOLBAR_ITEM_y(identifier, label, iconame)
507#define TOOLBAR_ITEM_n(identifier, label, iconame)
508#define TOOLBAR_ITEM_t(identifier, label, iconame) \
510 toolitem = make_toolbar_item_button(#label, iconame, sensitivity, false); \
512#define TOOLBAR_ITEM_b(identifier, label, iconame) \
514 toolitem = make_toolbar_item_button(#label, iconame, sensitivity, false); \
516#define TOOLBAR_ITEM(identifier, name, snstvty, clicked, activate, label, iconame) \
517 TOOLBAR_ITEM_ ## clicked(identifier, label, iconame)
560 GtkToolItem *toolitem = NULL;
563#define TOOLBAR_ITEM_y(identifier, label, iconame)
564#define TOOLBAR_ITEM_n(identifier, label, iconame)
565#define TOOLBAR_ITEM_t(identifier, label, iconame) \
568 toolitem = make_toolbar_item_button(#label, iconame, true, true); \
571#define TOOLBAR_ITEM_b(identifier, label, iconame) \
573 toolitem = make_toolbar_item_button(#label, iconame, true, true); \
575#define TOOLBAR_ITEM(identifier, name, snstvty, clicked, activate, label, iconame) \
576 TOOLBAR_ITEM_ ## clicked(identifier, label, iconame)
614 (
char *)
"nsgtk_button_data",
652 char *choices = NULL;
656 orderlen += strlen(tb->
items[iidx].
name);
666 order = malloc(orderlen);
682 written = snprintf(start,
683 orderlen - (start - order),
687 (written >= orderlen - (start - order))) {
693 if ((start - order) >= orderlen) {
698 order[orderlen - 1] = 0;
704 if (choices != NULL) {
724 gtk_tool_item_set_use_drag_window(tb->
items[itemid].
button, TRUE);
725 gtk_drag_source_set(GTK_WIDGET(tb->
items[itemid].
button),
762 gtk_drag_finish(gdc, TRUE, TRUE, time);
784 gtk_drag_finish(gdc, TRUE, TRUE, time);
825 position = gtk_toolbar_get_drop_index(tbc->
toolbar.
widget, x, y);
835 if (dragitem->
location < position) {
853 GTK_WIDGET(dragitem->
button));
859 if (dragitem->
button == NULL) {
878 gtk_widget_show_all(GTK_WIDGET(dragitem->
button));
921 item = gtk_tool_button_new(NULL, NULL);
922 position = gtk_toolbar_get_drop_index(tb->
widget, x, y);
924 gtk_toolbar_set_drop_highlight_item(tb->
widget, item, position);
941 gtk_toolbar_set_drop_highlight_item(GTK_TOOLBAR(
widget), NULL, 0);
971 addr = NETSURF_HOMEPAGE;
1000 const char *tbitems;
1012 if (tbitems == NULL) {
1019 while ((*end != 0) && (*end !=
'/')) {
1024 if (((ssize_t)strlen(tb->
items[iidx].
name) == (end - start)) &&
1025 (strncmp(tb->
items[iidx].
name, start, end - start) == 0)) {
1036 if (location == 0) {
1058 GtkContainer *container = GTK_CONTAINER(data);
1059 gtk_container_remove(container,
widget);
1075 gtk_container_foreach(GTK_CONTAINER(tb->
widget),
1089 gtk_toolbar_insert(tb->
widget,
1094 gtk_widget_show_all(GTK_WIDGET(tb->
widget));
1112 gtk_container_foreach(GTK_CONTAINER(tb->
widget),
1124 gtk_toolbar_insert(tb->
widget,
1129 gtk_widget_show_all(GTK_WIDGET(tb->
widget));
1169 gtk_widget_set_sensitive(GTK_WIDGET(item->
button),
1188 const char *iconname;
1212 gtk_tool_button_set_label(GTK_TOOL_BUTTON(tb->
items[itemid].
button),
1215 gtk_tool_button_set_icon_name(GTK_TOOL_BUTTON(tb->
items[itemid].
button),
1218 gtk_widget_set_sensitive(GTK_WIDGET(tb->
items[itemid].
button), TRUE);
1220 if (label != NULL) {
1274 GtkFileChooserAction action;
1283 action = GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER;
1285 action = GTK_FILE_CHOOSER_ACTION_SAVE;
1288 fc = gtk_file_chooser_dialog_new(title,
1292 GTK_RESPONSE_CANCEL,
1294 GTK_RESPONSE_ACCEPT,
1302 gtk_widget_destroy(fc);
1307 if ((!folder) || (access(
path, F_OK) != 0)) {
1308 gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(fc),
path);
1313 gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(fc), TRUE);
1316 if (gtk_dialog_run(GTK_DIALOG(fc)) != GTK_RESPONSE_ACCEPT) {
1317 gtk_widget_destroy(fc);
1321 *path_out = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(fc));
1323 gtk_widget_destroy(fc);
1345 g_signal_connect(tb->
widget,
1349 g_signal_connect(tb->
widget,
1350 "drag-data-received",
1353 g_signal_connect(tb->
widget,
1357 g_signal_connect(tb->
widget,
1363 gtk_drag_dest_set(GTK_WIDGET(tb->
widget),
1364 GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP,
1375 GdkRectangle *alloc,
1384 gtk_widget_set_allocation(widget, alloc);
1404 rowbar = GTK_TOOLBAR(gtk_toolbar_new());
1405 if (rowbar == NULL) {
1409 gtk_toolbar_set_style(rowbar, GTK_TOOLBAR_BOTH);
1410 gtk_toolbar_set_icon_size(rowbar, GTK_ICON_SIZE_LARGE_TOOLBAR);
1411 gtk_box_pack_start(tbc->
toolbox, GTK_WIDGET(rowbar), FALSE, FALSE, 0);
1413 for (iidx = startitem; iidx < enditem; iidx++) {
1414 if (tbc->
items[iidx] == NULL) {
1418 gtk_widget_set_size_request(GTK_WIDGET(tbc->
items[iidx]),
1421 gtk_tool_item_set_use_drag_window(tbc->
items[iidx], TRUE);
1422 gtk_drag_source_set(GTK_WIDGET(tbc->
items[iidx]),
1427 g_signal_connect(tbc->
items[iidx],
1431 g_signal_connect(tbc->
items[iidx],
1435 gtk_toolbar_insert(rowbar, tbc->
items[iidx], -1);
1471 if (tbc->
items[iidx] != NULL) {
1582 GtkBuilder *builder;
1583 GtkNotebook *notebook;
1584 GtkAllocation notebook_alloc;
1588 notebook = GTK_NOTEBOOK(gtk_widget_get_ancestor(widget,
1589 GTK_TYPE_NOTEBOOK));
1590 if (notebook == NULL) {
1597 NSLOG(netsurf, INFO,
"Toolbar UI builder init failed");
1600 gtk_builder_connect_signals(builder, NULL);
1608 g_object_unref(builder);
1613 tbc->
container = GTK_WIDGET(gtk_builder_get_object(builder,
"customisation"));
1615 goto cutomize_button_clicked_cb_error;
1619 tbc->
toolbox = GTK_BOX(gtk_builder_get_object(builder,
"toolbox"));
1621 goto cutomize_button_clicked_cb_error;
1625 tbc->
toolbar.
widget = GTK_TOOLBAR(gtk_builder_get_object(builder,
"toolbar"));
1627 goto cutomize_button_clicked_cb_error;
1636 goto cutomize_button_clicked_cb_error;
1642 goto cutomize_button_clicked_cb_error;
1646 gtk_widget_get_allocation(GTK_WIDGET(notebook), ¬ebook_alloc);
1650 goto cutomize_button_clicked_cb_error;
1654 gtk_drag_dest_set(GTK_WIDGET(tbc->
container),
1655 GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_DROP,
1661 g_signal_connect_swapped(GTK_WIDGET(gtk_builder_get_object(builder,
1664 G_CALLBACK(gtk_widget_destroy),
1668 g_signal_connect(GTK_WIDGET(gtk_builder_get_object(builder,
"apply")),
1673 g_signal_connect(GTK_WIDGET(gtk_builder_get_object(builder,
"reset")),
1706 g_object_unref(builder);
1710 cutomize_button_clicked_cb_error:
1712 g_object_unref(builder);
1729 GtkAllocation *alloc,
1747 if (alloc->width == 20) {
1754 tb->
offset = alloc->width - 20;
1760 alloc->width += tb->
offset;
1765 gtk_widget_size_allocate(
widget, alloc);
1919 addr = NETSURF_HOMEPAGE;
2063 gtk_editable_select_region(GTK_EDITABLE(widget), 0, -1);
2064 gtk_widget_grab_focus(GTK_WIDGET(widget));
2125 GtkWidget *toplevel;
2129 toplevel = gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW);
2131 dlgOpen = gtk_file_chooser_dialog_new(
"Open File",
2132 GTK_WINDOW(toplevel),
2133 GTK_FILE_CHOOSER_ACTION_OPEN,
2138 response = gtk_dialog_run(GTK_DIALOG(dlgOpen));
2139 if (response == GTK_RESPONSE_OK) {
2145 filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dlgOpen));
2148 if (urltxt != NULL) {
2173 gtk_widget_destroy(dlgOpen);
2189 GtkWidget *toplevel;
2190 toplevel = gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW);
2191 gtk_widget_destroy(toplevel);
2211 GtkWidget *toplevel;
2214 toplevel = gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW);
2218 GTK_WINDOW(toplevel),
2227 NSLOG(netsurf, INFO,
2228 "Unable to open directory %s for complete save: %s",
2231 if (errno == ENOTDIR) {
2260 GtkWidget *toplevel;
2266 toplevel = gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW);
2270 GTK_WINDOW(toplevel),
2277#ifdef WITH_PDF_EXPORT
2286 (
const char *) filename,
2312 GtkWidget *toplevel;
2318 toplevel = gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW);
2322 GTK_WINDOW(toplevel),
2349 GtkPrintOperation *print_op;
2350 GtkPageSetup *page_setup;
2352 GtkPrintOperationResult res = GTK_PRINT_OPERATION_RESULT_ERROR;
2354 char *settings_fname = NULL;
2355 GtkWidget *toplevel;
2359 toplevel = gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW);
2361 print_op = gtk_print_operation_new();
2362 if (print_op == NULL) {
2369 if (settings_fname != NULL) {
2370 print_settings = gtk_print_settings_new_from_file(settings_fname, NULL);
2372 gtk_print_operation_set_print_settings(print_op,
2382 page_setup = gtk_print_run_page_setup_dialog(GTK_WINDOW(toplevel),
2385 if (page_setup == NULL) {
2387 free(settings_fname);
2388 g_object_unref(print_op);
2391 gtk_print_operation_set_default_page_setup(print_op, page_setup);
2397 g_signal_connect(print_op,
2401 g_signal_connect(print_op,
2405 g_signal_connect(print_op,
2411 res = gtk_print_operation_run(print_op,
2412 GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
2413 GTK_WINDOW(toplevel),
2418 if (settings_fname != NULL) {
2419 if (res == GTK_PRINT_OPERATION_RESULT_APPLY) {
2421 print_settings = gtk_print_operation_get_print_settings(print_op);
2427 free(settings_fname);
2431 g_object_unref(page_setup);
2432 g_object_unref(print_op);
2465 GtkWidget *toplevel;
2467 toplevel = gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW);
2469 focused = gtk_window_get_focus(GTK_WINDOW(toplevel));
2472 if (GTK_IS_EDITABLE(focused)) {
2473 gtk_editable_cut_clipboard(GTK_EDITABLE(focused));
2496 GtkWidget *toplevel;
2498 toplevel = gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW);
2500 focused = gtk_window_get_focus(GTK_WINDOW(toplevel));
2503 if (GTK_IS_EDITABLE(focused)) {
2504 gtk_editable_copy_clipboard(GTK_EDITABLE(focused));
2527 GtkWidget *toplevel;
2529 toplevel = gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW);
2531 focused = gtk_window_get_focus(GTK_WINDOW(toplevel));
2534 if (GTK_IS_EDITABLE(focused)) {
2535 gtk_editable_paste_clipboard(GTK_EDITABLE(focused));
2558 GtkWidget *toplevel;
2560 toplevel = gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW);
2562 focused = gtk_window_get_focus(GTK_WINDOW(toplevel));
2565 if (GTK_IS_EDITABLE(focused)) {
2566 gtk_editable_delete_selection(GTK_EDITABLE(focused));
2589 GtkWidget *toplevel;
2591 toplevel = gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW);
2593 focused = gtk_window_get_focus(GTK_WINDOW(toplevel));
2596 if (GTK_IS_EDITABLE(focused)) {
2597 gtk_editable_select_region(GTK_EDITABLE(focused), 0, -1);
2619 GtkWidget *toplevel;
2620 GtkWidget *wndpreferences;
2624 toplevel = gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW);
2627 if (wndpreferences != NULL) {
2628 gtk_widget_show(wndpreferences);
2709 GtkWindow *gtkwindow;
2710 GdkWindow *gdkwindow;
2711 GdkWindowState state;
2713 gtkwindow = GTK_WINDOW(gtk_widget_get_ancestor(widget,GTK_TYPE_WINDOW));
2714 gdkwindow = gtk_widget_get_window(GTK_WIDGET(gtkwindow));
2715 state = gdk_window_get_state(gdkwindow);
2717 if (state & GDK_WINDOW_STATE_FULLSCREEN) {
2718 gtk_window_unfullscreen(gtkwindow);
2720 gtk_window_fullscreen(gtkwindow);
2739 GtkWindow *gtkwindow;
2743 gtkwindow = GTK_WINDOW(gtk_widget_get_ancestor(widget,GTK_TYPE_WINDOW));
2764 GtkWindow *gtkwindow;
2765 gtkwindow = GTK_WINDOW(gtk_widget_get_ancestor(widget,GTK_TYPE_WINDOW));
2781 GtkWindow *gtkwindow;
2783 char *choices = NULL;
2785 gtkwindow = GTK_WINDOW(gtk_widget_get_ancestor(widget,GTK_TYPE_WINDOW));
2787 gtk_window_get_position(gtkwindow, &
x, &
y);
2788 gtk_window_get_size(gtkwindow, &w, &h);
2796 if (choices != NULL) {
2844 handle = g_file_open_tmp(
"nsgtkboxtreeXXXXXX", &fname, NULL);
2845 if ((handle == -1) || (fname == NULL)) {
2851 f = fopen(fname,
"w");
2854 "Unable to open file for writing.");
2889 handle = g_file_open_tmp(
"nsgtkdomtreeXXXXXX", &fname, NULL);
2890 if ((handle == -1) || (fname == NULL)) {
2896 f = fopen(fname,
"w");
2899 "Unable to open file for writing.");
2932 GtkWidget *toplevel;
2934 toplevel = gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW);
2935 if (toplevel != NULL) {
2940 NSLOG(netsurf, INFO,
2941 "Unable to present local history window.");
2974 NSLOG(netsurf, INFO,
2975 "Unable to initialise global history window.");
3015 NSLOG(netsurf, INFO,
"Unable to initialise bookmark window.");
3034 NSLOG(netsurf, INFO,
"Unable to initialise cookies window.");
3051 GtkToolItem *urltitem;
3054 if (urltitem != NULL) {
3056 entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(urltitem)));
3057 gtk_widget_grab_focus(GTK_WIDGET(entry));
3139 parent = GTK_WINDOW(gtk_widget_get_ancestor(
widget, GTK_TYPE_WINDOW));
3169#define TOOLBAR_ITEM(identifier, name, snstvty, clicked, activate, label, iconame) \
3171nsgtk_toolbar_##name##_data_plus(GtkWidget *widget, \
3172 GdkDragContext *cont, \
3173 GtkSelectionData *selection, \
3178 struct nsgtk_toolbar_customisation *tbc; \
3179 tbc = (struct nsgtk_toolbar_customisation *)data; \
3180 tbc->dragitem = identifier; \
3181 tbc->dragfrom = true; \
3185nsgtk_toolbar_##name##_data_minus(GtkWidget *widget, \
3186 GdkDragContext *cont, \
3187 GtkSelectionData *selection, \
3192 struct nsgtk_toolbar_customisation *tbc; \
3193 tbc = (struct nsgtk_toolbar_customisation *)data; \
3194 tbc->dragitem = identifier; \
3195 tbc->dragfrom = false; \
3216#define TOOLBAR_ITEM_t(name) \
3217 item->clicked = name##_button_clicked_cb;
3218#define TOOLBAR_ITEM_b(name) \
3219 item->clicked = name##_button_clicked_cb;
3220#define TOOLBAR_ITEM_y(name) \
3221 item->clicked = name##_button_clicked_cb;
3222#define TOOLBAR_ITEM_n(name) \
3223 item->clicked = NULL;
3224#define TOOLBAR_ITEM(identifier, iname, snstvty, clicked, activate, label, iconame) \
3226 item->name = #iname; \
3227 item->sensitivity = snstvty; \
3228 item->dataplus = nsgtk_toolbar_##iname##_data_plus; \
3229 item->dataminus = nsgtk_toolbar_##iname##_data_minus; \
3230 TOOLBAR_ITEM_ ## clicked(iname) \
3235#undef TOOLBAR_ITEM_t
3236#undef TOOLBAR_ITEM_y
3237#undef TOOLBAR_ITEM_n
3263 if (toolbar_item == NULL) {
3273 throbber = GTK_IMAGE(gtk_bin_get_child(GTK_BIN(toolbar_item)));
3275 gtk_image_set_from_pixbuf(
throbber, pixbuf);
3319 item = &tb->
items[itemid];
3321 if (item->
button != NULL) {
3322 g_signal_connect(item->
button,
3330 entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(item->
button)));
3332 g_signal_connect(GTK_WIDGET(entry),
3336 g_signal_connect(GTK_WIDGET(entry),
3340 g_signal_connect(GTK_WIDGET(entry),
3352 entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(item->
button)));
3354 g_signal_connect(GTK_WIDGET(entry),
3358 g_signal_connect(GTK_WIDGET(entry),
3359 "button-press-event",
3366 g_signal_connect(item->
button,
3450 bool want_location_focus,
3466 if (want_location_focus) {
3472 tb->
widget = GTK_TOOLBAR(gtk_builder_get_object(builder,
"toolbar"));
3473 gtk_toolbar_set_show_arrow(tb->
widget, TRUE);
3475 g_signal_connect(tb->
widget,
3476 "popup-context-menu",
3481 g_signal_connect(tb->
widget,
3516 gtk_toolbar_set_style(GTK_TOOLBAR(tb->
widget),
3518 gtk_toolbar_set_icon_size(GTK_TOOLBAR(tb->
widget),
3519 GTK_ICON_SIZE_SMALL_TOOLBAR);
3523 gtk_toolbar_set_style(GTK_TOOLBAR(tb->
widget),
3525 gtk_toolbar_set_icon_size(GTK_TOOLBAR(tb->
widget),
3526 GTK_ICON_SIZE_LARGE_TOOLBAR);
3530 gtk_toolbar_set_style(GTK_TOOLBAR(tb->
widget),
3532 gtk_toolbar_set_icon_size(GTK_TOOLBAR(tb->
widget),
3533 GTK_ICON_SIZE_LARGE_TOOLBAR);
3537 gtk_toolbar_set_style(GTK_TOOLBAR(tb->
widget),
3609 GtkEntry *url_entry;
3612 const char *icon_name;
3626 icon_name =
"page-info-internal";
3630 icon_name =
"page-info-local";
3634 icon_name =
"page-info-insecure";
3638 icon_name =
"page-info-warning";
3642 icon_name =
"page-info-warning";
3646 icon_name =
"page-info-secure";
3650 icon_name =
"page-info-internal";
3665 char *idn_url_s = NULL;
3666 const char *url_text = NULL;
3667 GtkEntry *url_entry;
3679 url_text = idn_url_s;
3681 if (url_text == NULL) {
3685 if (strcmp(url_text, gtk_entry_get_text(url_entry)) != 0) {
3687 gint startpos, endpos;
3689 gtk_editable_get_selection_bounds(GTK_EDITABLE(url_entry),
3690 &startpos, &endpos);
3691 was_selected = gtk_widget_is_focus(GTK_WIDGET(url_entry)) &&
3693 endpos == gtk_entry_get_text_length(url_entry);
3694 gtk_entry_set_text(url_entry, url_text);
3696 gtk_widget_grab_focus(GTK_WIDGET(url_entry));
3703 if (idn_url_s != NULL) {
3724 if (pixbuf != NULL) {
3761 widget = GTK_WIDGET(tb->
widget);
3774 gtk_widget_show(GTK_WIDGET(tb->
widget));
3776 gtk_widget_hide(GTK_WIDGET(tb->
widget));
3825 GtkWidget *widget = GTK_WIDGET(item->
button);
3826 GtkAllocation alloc;
3827 gint rootx, rooty, x, y;
3831 widget = GTK_WIDGET(gtk_bin_get_child(GTK_BIN(item->
button)));
3840 if (gtk_widget_translate_coordinates(widget,
3841 gtk_widget_get_toplevel(widget),
3848 gtk_window_get_position(GTK_WINDOW(gtk_widget_get_toplevel(widget)),
3851 *out_x = rootx + x + 4;
3852 *out_y = rooty + y + 4;
static struct BitMap * throbber
nserror browser_window_history_forward(struct browser_window *bw, bool new_window)
Go forward in the history.
bool browser_window_history_forward_available(struct browser_window *bw)
Check whether it is pssible to go forwards in the history.
bool browser_window_history_back_available(struct browser_window *bw)
Check whether it is pssible to go back in the history.
nserror browser_window_history_back(struct browser_window *bw, bool new_window)
Go back in the history.
Interface to browser history operations.
Browser window creation and manipulation interface.
nserror browser_window_navigate(struct browser_window *bw, struct nsurl *url, struct nsurl *referrer, enum browser_window_nav_flags flags, char *post_urlenc, struct fetch_multipart_data *post_multipart, struct hlcache_handle *parent)
Start fetching a page in a browser window.
bool browser_window_has_content(struct browser_window *bw)
Find out if a browser window is currently showing a content.
nserror browser_window_debug(struct browser_window *bw, enum content_debug op)
Set debug options on a window.
nserror browser_window_reload(struct browser_window *bw, bool all)
Reload the page in a browser window.
struct nsurl * browser_window_access_url(const struct browser_window *bw)
Access a browser window's URL.
browser_window_page_info_state
Browser window page information states.
@ PAGE_STATE_INSECURE
Insecure page load.
@ PAGE_STATE_SECURE_ISSUES
Secure load, but has insecure elements.
@ PAGE_STATE_SECURE
Secure load.
@ PAGE_STATE_SECURE_OVERRIDE
Secure load, but had to override.
@ PAGE_STATE_LOCAL
Page loaded from file:/// etc.
@ PAGE_STATE_INTERNAL
Page loaded from internal handler.
nserror browser_window_create(enum browser_window_create_flags flags, struct nsurl *url, struct nsurl *referrer, struct browser_window *existing, struct browser_window **bw)
Create and open a new root browser window with the given page.
void browser_window_stop(struct browser_window *bw)
Stop all fetching activity in a browser window.
nserror browser_window_set_scale(struct browser_window *bw, float scale, bool absolute)
Sets the scale of a browser window.
browser_window_page_info_state browser_window_get_page_info_state(const struct browser_window *bw)
Request the current browser window page info state.
struct hlcache_handle * browser_window_get_content(struct browser_window *bw)
Get a cache handle for the content within a browser window.
nserror browser_window_debug_dump(struct browser_window *bw, FILE *f, enum content_debug op)
Dump debug info concerning the browser window's contents to file.
@ BW_CREATE_HISTORY
this will form a new history node (don't set for back/reload/etc)
@ BW_CREATE_TAB
New gui_window to be tab in same window as "existing" gui_window.
@ BW_CREATE_FOREGROUND
Request foreground opening.
@ BW_CREATE_FOCUS_LOCATION
Request location bar focus.
@ BW_NAVIGATE_HISTORY
this will form a new history node (don't set for back/reload/etc)
void nsgtk_widget_get_allocation(GtkWidget *widget, GtkAllocation *allocation)
void nsgtk_widget_set_margins(GtkWidget *widget, gint hmargin, gint vmargin)
Set the margins of a widget.
void nsgtk_entry_set_icon_from_pixbuf(GtkWidget *entry, GtkEntryIconPosition icon_pos, GdkPixbuf *pixbuf)
void nsgtk_widget_set_alignment(GtkWidget *widget, GtkAlign halign, GtkAlign valign)
Set the alignment of a widget.
void nsgtk_entry_set_icon_from_icon_name(GtkWidget *entry, GtkEntryIconPosition icon_pos, const gchar *id)
Sets the icon shown in the entry at the specified position from an icon name.
GtkWidget * nsgtk_entry_new(void)
Compatibility functions for older GTK versions (interface)
#define NSGTK_STOCK_REFRESH
#define NSGTK_STOCK_CANCEL
gboolean nsgtk_completion_update(GtkEntry *entry)
update completion list store.
nserror nsgtk_completion_connect_signals(GtkEntry *entry, struct browser_window *(*get_bw)(void *ctx), void *get_bw_ctx)
connect signals on entry completion
Interface to url entry completion.
@ CONTENT_TEXTPLAIN
content is plain text
@ CONTENT_DEBUG_REDRAW
Debug redraw operations.
@ CONTENT_DEBUG_RENDER
Debug the contents rendering.
@ CONTENT_DEBUG_DOM
Debug the contents Document Object.
Useful interned string pointers (interface).
#define FILE_SCHEME_PREFIX_LEN
File url prefix length.
#define FILE_SCHEME_PREFIX
File url prefix.
nserror hotlist_add_url(nsurl *url)
Add an entry to the hotlist for given URL.
struct print_settings * print_make_settings(print_configuration configuration, const char *filename, const struct gui_layout_table *font_func)
Generates one of the predefined print settings sets.
bool print_basic_run(hlcache_handle *content, const struct printer *printer, struct print_settings *settings)
This function calls print setup, prints page after page until the whole content is printed calls clea...
Conception: Generalized output-in-pages.
const struct printer pdf_printer
void browser_window_search_clear(struct browser_window *bw)
Clear up a search.
Browseing window text search interface.
nserror search_web_omni(const char *term, enum search_web_omni_flags flags, struct nsurl **url_out)
Generate a nsurl from a search term.
nserror search_web_get_provider_bitmap(struct bitmap **bitmap_out)
obtain the current providers bitmap
nserror
Enumeration of error codes.
@ NSERROR_NOT_FOUND
Requested item not found.
@ NSERROR_BAD_PARAMETER
Bad Parameter.
@ NSERROR_BAD_SIZE
Bad size.
@ NSERROR_UNKNOWN
Unknown error - DO NOT USE.
@ NSERROR_INVALID
Invalid data.
@ NSERROR_NOMEM
Memory exhaustion.
const struct font_functions haru_nsfont
void haru_nsfont_set_scale(float s)
void nsgtk_download_show(GtkWindow *parent)
Show the download window.
nserror nsgtk_global_history_present(void)
make the global history window visible.
Interface to GTK global history manager.
nserror nsgtk_hotlist_present(void)
make the hotlist window visible.
Interface to GTK bookmarks (hotlist).
nserror nsgtk_local_history_hide(void)
hide the local history window from being visible.
void nsgtk_local_history_set_position(int x, int y)
set the local history window position.
nserror nsgtk_local_history_present(GtkWindow *parent, struct browser_window *bw)
make the local history window visible.
Interface to GTK local history manager.
void gtk_print_signal_end_print(GtkPrintOperation *operation, GtkPrintContext *context, gpointer user_data)
Handle the end_print signal from the GtkPrintOperation.
static struct print_settings * settings
struct hlcache_handle * content_to_print
void gtk_print_signal_draw_page(GtkPrintOperation *operation, GtkPrintContext *context, gint page_nr, gpointer user_data)
Handle the draw_page signal from the GtkPrintOperation.
void gtk_print_signal_begin_print(GtkPrintOperation *operation, GtkPrintContext *context, gpointer user_data)
Handle the begin_print signal from the GtkPrintOperation.
GTK printing (interface).
free text page search for gtk interface
GdkPixbuf * nsgdk_pixbuf_get_from_surface(cairo_surface_t *surface, int scwidth, int scheight)
obtain a pixbuf of the specified size from a cairo surface.
GDK support functions for missing interfaces.
void nsgtk_about_dialog_init(GtkWindow *parent)
nserror nsgtk_cookies_present(const char *search_term)
make the cookie window visible.
nserror nsgtk_warning(const char *warning, const char *detail)
Warn the user of an event.
GdkPixbuf * favicon_pixbuf
favicon default pixbuf
char * nsgtk_config_home
Directory where all configuration files are held.
nserror nsgtk_schedule(int t, void(*callback)(void *p), void *cbctx)
nserror nsgtk_throbber_get_frame(int frame, GdkPixbuf **pixbuf)
get the pixbuf of a given frame of the throbber
struct nsgtk_scaffolding * nsgtk_get_scaffold(struct gui_window *g)
get containing nsgtk scaffolding handle from gui window handle
nserror nsgtk_window_update_all(void)
Every window will have its tab, toolbar and drawing area updated.
nserror nsgtk_window_toolbar_update(void)
every window will have its toolbar updated to reflect user settings
Public content interface.
content_type content_get_type(struct hlcache_handle *h)
Retrieve computed type of content.
Interface to key press operations.
bool browser_window_key_press(struct browser_window *bw, uint32_t key)
Handle key presses in a browser window.
struct gui_layout_table * nsgtk_layout_table
Interface to GTK layout handling using pango.
#define NSLOG(catname, level, logmsg, args...)
const char * messages_get_errorcode(nserror code)
lookup of a message by errorcode from the standard Messages hash.
const char * messages_get(const char *key)
Fast lookup of a message by key from the standard Messages hash.
Localised message support (interface).
NetSurf URL handling (interface).
nserror nsurl_get_utf8(const nsurl *url, char **url_s, size_t *url_l)
Get a UTF-8 string (for human readable IDNs) from a NetSurf URL object.
nserror nsurl_create(const char *const url_s, nsurl **url)
Create a NetSurf URL object from a URL string.
void nsurl_unref(nsurl *url)
Drop a reference to a NetSurf URL object.
const char * nsurl_access(const nsurl *url)
Access a NetSurf URL object as a string.
nserror nsurl_nice(const nsurl *url, char **result, bool remove_extensions)
Attempt to find a nice filename for a URL.
struct nsurl nsurl
NetSurf URL object.
void nsgtk_page_info_set_position(struct nsgtk_pi_window *win, int x, int y)
Position the given page information window at the given coordinates.
nserror nsgtk_page_info(struct browser_window *bw)
Page information window.
GtkWidget * nsgtk_preferences(struct browser_window *bw, GtkWindow *parent)
Initialise prefernces window.
nserror nsgtk_builder_new_from_resname(const char *resname, GtkBuilder **builder_out)
Create gtk builder object for the named ui resource.
Interface to gtk builtin resource handling.
nserror save_complete(hlcache_handle *c, const char *path, save_complete_set_type_cb set_type)
Save an HTML page with all dependencies.
Save HTML document with dependencies (interface).
void save_as_text(struct hlcache_handle *c, char *path)
Extract the text from an HTML content and save it as a text file.
Text export of HTML (interface).
nserror nsgtk_scaffolding_toolbar_context_menu(struct nsgtk_scaffolding *gs)
open the toolbar context menu
nserror nsgtk_scaffolding_burger_menu(struct nsgtk_scaffolding *gs)
open the burger menu
nserror nsgtk_scaffolding_destroy_all(void)
causes all scaffolding windows to be destroyed.
core web search facilities interface.
@ SEARCH_WEB_OMNI_NONE
no changes to default operation
@ SEARCH_WEB_OMNI_SEARCHONLY
The search does not attempt to interpret the url as a url before using it as a search term.
Interface to utility string handling.
RISC OS wimp toolkit bitmap.
cairo_surface_t * surface
struct browser_window * bw
Column record for a table.
first entry in window list
GTK certificate viewing window context.
Core scaffolding structure.
Settings for a print - filled in by print_make_settings or 'manually' by the caller.
nserror nsgtk_tab_add_page(GtkNotebook *notebook, GtkWidget *tab_contents, bool background, const char *title, GdkPixbuf *icon_pixbuf)
Add new page to a notebook.
nserror netsurf_mkpath(char **str, size_t *size, size_t nelm,...)
Generate a path from one or more component elemnts.
Default operations table for files.
nserror nsoption_write(const char *path, struct nsoption_s *opts, struct nsoption_s *defs)
Write options that have changed from the defaults to a file.
Option reading and saving interface.
#define nsoption_charp(OPTION)
Get the value of a string option.
#define nsoption_int(OPTION)
Get the value of an integer option.
#define nsoption_set_int(OPTION, VALUE)
set an integer option in the default table
#define nsoption_set_charp(OPTION, VALUE)
set string option in default table
#define nsoption_bool(OPTION)
Get the value of a boolean option.
nserror nsgtk_viewfile(const char *title, const char *leafname, const char *filename)
Display file to a user.
nserror nsgtk_viewsource(GtkWindow *parent, struct browser_window *bw)
static nserror path(const struct redraw_context *ctx, const plot_style_t *pstyle, const float *p, unsigned int n, const float transform[6])
Plots a path.
static nserror bitmap(const struct redraw_context *ctx, struct bitmap *bitmap, int x, int y, int width, int height, colour bg, bitmap_flags_t flags)
Plot a bitmap.