diff options
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/browser.c | 11 | ||||
-rw-r--r-- | desktop/hotlist.c | 19 | ||||
-rw-r--r-- | desktop/save_complete.c | 20 | ||||
-rw-r--r-- | desktop/scrollbar.h | 6 | ||||
-rw-r--r-- | desktop/tree.c | 20 |
5 files changed, 42 insertions, 34 deletions
diff --git a/desktop/browser.c b/desktop/browser.c index 9316b771d..4cd017d57 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -1205,7 +1205,7 @@ browser_window_callback_errorcode(hlcache_handle *c, /* Only warn the user about errors in top-level windows */ if (bw->browser_window_type == BROWSER_WINDOW_NORMAL) { - warn_user(message, 0); + guit->misc->warning(message, NULL); } if (c == bw->loading_content) { @@ -1459,8 +1459,9 @@ static nserror browser_window_callback(hlcache_handle *c, browser_window_set_status(bw, event->data.error); /* Only warn the user about errors in top-level windows */ - if (bw->browser_window_type == BROWSER_WINDOW_NORMAL) - warn_user(event->data.error, 0); + if (bw->browser_window_type == BROWSER_WINDOW_NORMAL) { + guit->misc->warning(event->data.error, NULL); + } if (c == bw->loading_content) bw->loading_content = NULL; @@ -2073,7 +2074,7 @@ nserror browser_window_navigate(struct browser_window *bw, default: /* report error to user */ browser_window_set_status(bw, messages_get_errorcode(error)); /** @todo should the caller report the error? */ - warn_user(messages_get_errorcode(error), 0); + guit->misc->warning(messages_get_errorcode(error), NULL); break; } @@ -2814,7 +2815,7 @@ struct browser_window *browser_window_find_target(struct browser_window *bw, if (target[0] != '_') { bw_target->name = strdup(target); if (!bw_target->name) - warn_user("NoMemory", 0); + guit->misc->warning("NoMemory", NULL); } return bw_target; } diff --git a/desktop/hotlist.c b/desktop/hotlist.c index e6e11e4ba..98d5f9c19 100644 --- a/desktop/hotlist.c +++ b/desktop/hotlist.c @@ -25,16 +25,19 @@ #include <dom/dom.h> #include <dom/bindings/hubbub/parser.h> -#include "content/urldb.h" -#include "desktop/hotlist.h" -#include "desktop/treeview.h" -#include "desktop/browser.h" #include "utils/corestrings.h" #include "utils/messages.h" #include "utils/utils.h" #include "utils/utf8.h" #include "utils/libdom.h" #include "utils/log.h" +#include "content/urldb.h" + +#include "desktop/gui_misc.h" +#include "desktop/gui_internal.h" +#include "desktop/hotlist.h" +#include "desktop/treeview.h" +#include "desktop/browser.h" #define N_DAYS 28 #define N_SEC_PER_DAY (60 * 60 * 24) @@ -799,7 +802,7 @@ static nserror hotlist_load(const char *path, bool *loaded) corestring_lwc_html); if (html == NULL) { dom_node_unref(document); - warn_user("TreeLoadError", "(<html> not found)"); + guit->misc->warning("TreeLoadError", "(<html> not found)"); return NSERROR_OK; } @@ -808,7 +811,7 @@ static nserror hotlist_load(const char *path, bool *loaded) if (body == NULL) { dom_node_unref(html); dom_node_unref(document); - warn_user("TreeLoadError", "(<html>...<body> not found)"); + guit->misc->warning("TreeLoadError", "(<html>...<body> not found)"); return NSERROR_OK; } @@ -818,7 +821,7 @@ static nserror hotlist_load(const char *path, bool *loaded) dom_node_unref(body); dom_node_unref(html); dom_node_unref(document); - warn_user("TreeLoadError", + guit->misc->warning("TreeLoadError", "(<html>...<body>...<ul> not found.)"); return NSERROR_OK; } @@ -843,7 +846,7 @@ static nserror hotlist_load(const char *path, bool *loaded) dom_node_unref(document); if (err != NSERROR_OK) { - warn_user("TreeLoadError", "(Failed building tree.)"); + guit->misc->warning("TreeLoadError", "(Failed building tree.)"); return NSERROR_OK; } diff --git a/desktop/save_complete.c b/desktop/save_complete.c index 635161dfb..98b0304f8 100644 --- a/desktop/save_complete.c +++ b/desktop/save_complete.c @@ -45,6 +45,8 @@ #include "render/box.h" #include "render/html.h" +#include "desktop/gui_misc.h" +#include "desktop/gui_internal.h" #include "desktop/save_complete.h" regex_t save_complete_import_re; @@ -150,7 +152,7 @@ static bool save_complete_save_buffer(save_complete_ctx *ctx, ret = netsurf_mkpath(&fname, NULL, 2, ctx->path, leafname); if (ret != NSERROR_OK) { - warn_user(messages_get_errorcode(ret), 0); + guit->misc->warning(messages_get_errorcode(ret), 0); return false; } @@ -158,7 +160,7 @@ static bool save_complete_save_buffer(save_complete_ctx *ctx, if (fp == NULL) { free(fname); LOG("fopen(): errno = %i", errno); - warn_user("SaveError", strerror(errno)); + guit->misc->warning("SaveError", strerror(errno)); return false; } @@ -316,7 +318,7 @@ static bool save_complete_save_stylesheet(save_complete_ctx *ctx, return true; if (save_complete_ctx_add_content(ctx, css) == false) { - warn_user("NoMemory", 0); + guit->misc->warning("NoMemory", 0); return false; } @@ -329,7 +331,7 @@ static bool save_complete_save_stylesheet(save_complete_ctx *ctx, source = save_complete_rewrite_stylesheet_urls(ctx, css_data, css_size, hlcache_handle_get_url(css), &source_len); if (source == NULL) { - warn_user("NoMemory", 0); + guit->misc->warning("NoMemory", 0); return false; } @@ -412,7 +414,7 @@ static bool save_complete_save_html_object(save_complete_ctx *ctx, return true; if (save_complete_ctx_add_content(ctx, obj) == false) { - warn_user("NoMemory", 0); + guit->misc->warning("NoMemory", 0); return false; } @@ -1056,7 +1058,7 @@ static bool save_complete_save_html_document(save_complete_ctx *ctx, ret = netsurf_mkpath(&fname, NULL, 2, ctx->path, filename); if (ret != NSERROR_OK) { - warn_user(messages_get_errorcode(ret), NULL); + guit->misc->warning(messages_get_errorcode(ret), NULL); return false; } @@ -1064,7 +1066,7 @@ static bool save_complete_save_html_document(save_complete_ctx *ctx, if (fp == NULL) { free(fname); LOG("fopen(): errno = %i", errno); - warn_user("SaveError", strerror(errno)); + guit->misc->warning("SaveError", strerror(errno)); return false; } @@ -1077,7 +1079,7 @@ static bool save_complete_save_html_document(save_complete_ctx *ctx, if (save_complete_libdom_treewalk((dom_node *) doc, save_complete_node_handler, ctx) == false) { free(fname); - warn_user("NoMemory", 0); + guit->misc->warning("NoMemory", 0); fclose(fp); return false; } @@ -1143,7 +1145,7 @@ static bool save_complete_inventory(save_complete_ctx *ctx) free(fname); if (fp == NULL) { LOG("fopen(): errno = %i", errno); - warn_user("SaveError", strerror(errno)); + guit->misc->warning("SaveError", strerror(errno)); return false; } diff --git a/desktop/scrollbar.h b/desktop/scrollbar.h index bfe90d9b5..d277be26c 100644 --- a/desktop/scrollbar.h +++ b/desktop/scrollbar.h @@ -73,10 +73,10 @@ typedef void(*scrollbar_client_callback)(void *client_data, * \param client_data data for the client callback * \param client_callback client callback for scrollbar events * \param s updated to point at the newly created scrollbar - * \return true if scrollbar has been created succesfully or false on - * memory exhaustion + * \return NSERROR_OK and s updated if scrollbar has been created + * succesfully or eror code and s set to NULL on faliure; */ -bool scrollbar_create(bool horizontal, int length, int full_size, +nserror scrollbar_create(bool horizontal, int length, int full_size, int visible_size, void *client_data, scrollbar_client_callback client_callback, struct scrollbar **s); diff --git a/desktop/tree.c b/desktop/tree.c index eac9201cf..c5bca61da 100644 --- a/desktop/tree.c +++ b/desktop/tree.c @@ -45,6 +45,8 @@ struct tree { void *client_data; /* User assigned data for the callbacks */ }; +#include "desktop/gui_misc.h" +#include "desktop/gui_internal.h" #include "desktop/treeview.h" #include "desktop/hotlist.h" #include "desktop/cookie_manager.h" @@ -139,24 +141,24 @@ static bool treeview_test_init(struct tree *tree) "sslcert viewers"); err = cookie_manager_init(&cw_t, (struct core_window *)tree); if (err != NSERROR_OK) - warn_user("Couldn't init new cookie manager.", 0); + guit->misc->warning("Couldn't init new cookie manager.", 0); break; case TREE_HISTORY: err = global_history_init(&cw_t, (struct core_window *)tree); if (err != NSERROR_OK) - warn_user("Couldn't init new global history.", 0); + guit->misc->warning("Couldn't init new global history.", 0); break; case TREE_HOTLIST: err = hotlist_init(&cw_t, (struct core_window *)tree, tree_hotlist_path); if (err != NSERROR_OK) - warn_user("Couldn't init new hotlist.", 0); + guit->misc->warning("Couldn't init new hotlist.", 0); break; case TREE_SSLCERT: err = sslcert_viewer_init(&cw_t, (struct core_window *)tree, ssl_current_session); if (err != NSERROR_OK) - warn_user("Couldn't init new sslcert viewer.", 0); + guit->misc->warning("Couldn't init new sslcert viewer.", 0); break; } @@ -171,17 +173,17 @@ static bool treeview_test_fini(struct tree *tree) case TREE_COOKIES: err = cookie_manager_fini(); if (err != NSERROR_OK) - warn_user("Couldn't finalise cookie manager.", 0); + guit->misc->warning("Couldn't finalise cookie manager.", 0); break; case TREE_HISTORY: err = global_history_fini(); if (err != NSERROR_OK) - warn_user("Couldn't finalise cookie manager.", 0); + guit->misc->warning("Couldn't finalise cookie manager.", 0); break; case TREE_HOTLIST: err = hotlist_fini(tree_hotlist_path); if (err != NSERROR_OK) - warn_user("Couldn't finalise hotlist.", 0); + guit->misc->warning("Couldn't finalise hotlist.", 0); break; case TREE_SSLCERT: assert(ssl_current_session != NULL && @@ -189,7 +191,7 @@ static bool treeview_test_fini(struct tree *tree) err = sslcert_viewer_fini(ssl_current_session); ssl_current_session = NULL; if (err != NSERROR_OK) - warn_user("Couldn't finalise sslcert viewer.", 0); + guit->misc->warning("Couldn't finalise sslcert viewer.", 0); break; } @@ -287,7 +289,7 @@ struct tree *tree_create(unsigned int flags, tree = calloc(sizeof(struct tree), 1); if (tree == NULL) { LOG("calloc failed"); - warn_user(messages_get_errorcode(NSERROR_NOMEM), 0); + guit->misc->warning(messages_get_errorcode(NSERROR_NOMEM), 0); return NULL; } |