Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/e44bd09ac3a28823d9947c54949d115619003fe4
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/e44bd09ac3a28823d9947c54949d115619003fe4
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/e44bd09ac3a28823d9947c54949d115619003fe4

The branch, master has been updated
       via  e44bd09ac3a28823d9947c54949d115619003fe4 (commit)
      from  68938664411ac2ee82e39e11fe855a6cd1b32c7c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=e44bd09ac3a28823d9947c54949d115619003fe4
commit e44bd09ac3a28823d9947c54949d115619003fe4
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>

    update windows frontend to not use depricated warn_user API

diff --git a/windows/about.c b/windows/about.c
index 686d350..4716a5c 100644
--- a/windows/about.c
+++ b/windows/about.c
@@ -27,11 +27,12 @@
 
 #include <windows.h>
 
+#include "utils/log.h"
 #include "utils/utils.h"
 #include "utils/messages.h"
 #include "desktop/version.h"
-#include "utils/log.h"
 
+#include "windows/gui.h"
 #include "windows/window.h"
 #include "windows/about.h"
 #include "windows/resourceid.h"
@@ -144,7 +145,7 @@ void nsws_about_dialog_init(HINSTANCE hinst, HWND parent)
        int ret = DialogBox(hinst, MAKEINTRESOURCE(IDD_DLG_ABOUT), parent,
                        nsws_about_event_callback);
        if (ret == -1) {
-               warn_user(messages_get("NoMemory"), 0);
+               win32_warning(messages_get("NoMemory"), 0);
                return;
        }
 }
diff --git a/windows/download.c b/windows/download.c
index c2cda8f..b281ea7 100644
--- a/windows/download.c
+++ b/windows/download.c
@@ -86,14 +86,14 @@ gui_download_window_create(download_context *ctx, struct 
gui_window *gui)
 {
        if (downloading) {
                /* initial implementation */
-               warn_user("1 download at a time please", 0);
+               win32_warning("1 download at a time please", 0);
                return NULL;
        }
        downloading = true;
        struct gui_download_window *w = 
                        malloc(sizeof(struct gui_download_window));
        if (w == NULL) {
-               warn_user(messages_get("NoMemory"), 0);
+               win32_warning(messages_get("NoMemory"), 0);
                return NULL;
        }
        int total_size = download_context_get_total_length(ctx);
@@ -108,7 +108,7 @@ gui_download_window_create(download_context *ctx, struct 
gui_window *gui)
                filename = strdup(messages_get("UnknownFile"));
        }
        if (filename == NULL) {
-               warn_user(messages_get("NoMemory"), 0);
+               win32_warning(messages_get("NoMemory"), 0);
                free(w);
                return NULL;
        }
@@ -119,14 +119,14 @@ gui_download_window_create(download_context *ctx, struct 
gui_window *gui)
                domain = strdup(messages_get("UnknownHost"));
        }
        if (domain == NULL) {
-               warn_user(messages_get("NoMemory"), 0);
+               win32_warning(messages_get("NoMemory"), 0);
                free(filename);
                free(w);
                return NULL;
        }
        destination = malloc(PATH_MAX);
        if (destination == NULL) {
-               warn_user(messages_get("NoMemory"), 0);
+               win32_warning(messages_get("NoMemory"), 0);
                free(domain);
                free(filename);
                free(w);
@@ -144,7 +144,7 @@ gui_download_window_create(download_context *ctx, struct 
gui_window *gui)
        w->size = total_size;
        w->total_size = strdup(size);
        if (w->total_size == NULL) {
-               warn_user(messages_get("NoMemory"), 0);
+               win32_warning(messages_get("NoMemory"), 0);
                free(destination);
                free(domain);
                free(filename);
@@ -163,7 +163,7 @@ gui_download_window_create(download_context *ctx, struct 
gui_window *gui)
        w->window = gui;
        w->file = fopen(destination, "wb");
        if (w->file == NULL) {
-               warn_user(messages_get("FileOpenWriteError"), destination);
+               win32_warning(messages_get("FileOpenWriteError"), destination);
                free(destination);
                free(domain);
                free(filename);
@@ -175,7 +175,7 @@ gui_download_window_create(download_context *ctx, struct 
gui_window *gui)
        download1 = w;
 
        if (nsws_download_window_up(w) == false) {
-               warn_user(messages_get("NoMemory"), 0);
+               win32_warning(messages_get("NoMemory"), 0);
                free(destination);
                free(domain);
                free(filename);
diff --git a/windows/gui.c b/windows/gui.c
index f9aca5a..9923ecf 100644
--- a/windows/gui.c
+++ b/windows/gui.c
@@ -30,6 +30,7 @@
 #include "utils/corestrings.h"
 #include "utils/url.h"
 #include "utils/file.h"
+#include "utils/messages.h"
 #include "desktop/browser.h"
 #include "desktop/gui_clipboard.h"
 
@@ -90,8 +91,17 @@ void win32_run(void)
 }
 
 
+/* exported function documented in windows/gui.h */
+nserror win32_warning(const char *warning, const char *detail)
+{
+       size_t len = 1 + ((warning != NULL) ? strlen(messages_get(warning)) :
+                       0) + ((detail != 0) ? strlen(detail) : 0);
+       char message[len];
+       snprintf(message, len, messages_get(warning), detail);
+       MessageBox(NULL, message, "Warning", MB_ICONWARNING);
 
-
+       return NSERROR_OK;
+}
 
 
 /**
diff --git a/windows/gui.h b/windows/gui.h
index f72cb2c..4c3f360 100644
--- a/windows/gui.h
+++ b/windows/gui.h
@@ -25,6 +25,8 @@ struct gui_clipboard_table *win32_clipboard_table;
 
 extern HINSTANCE hInstance;
 
+extern char *options_file_location;
+
 /* bounding box */
 typedef struct bbox_s {
         int x0;
@@ -33,19 +35,24 @@ typedef struct bbox_s {
         int y1;
 } bbox_t;
 
-
-
-extern char *options_file_location;
-
-
-
-
 /**
  * Run the win32 message loop with scheduling
  */
 void win32_run(void);
 
-/** cause the main message loop to exit */
+/**
+ * cause the main message loop to exit
+ */
 void win32_set_quit(bool q);
 
+/**
+ * Warn the user of an event.
+ *
+ * \param[in] message A warning looked up in the message translation table
+ * \param[in] detail Additional text to be displayed or NULL.
+ * \return NSERROR_OK on success or error code if there was a
+ *           faliure displaying the message to the user.
+ */
+nserror win32_warning(const char *warning, const char *detail);
+
 #endif 
diff --git a/windows/main.c b/windows/main.c
index 869907d..df64e48 100644
--- a/windows/main.c
+++ b/windows/main.c
@@ -65,25 +65,6 @@ static void die(const char *error)
 }
 
 
-/**
- * Warn the user of an event.
- *
- * \param[in] message A warning looked up in the message translation table
- * \param[in] detail Additional text to be displayed or NULL.
- * \return NSERROR_OK on success or error code if there was a
- *           faliure displaying the message to the user.
- */
-static nserror win32_warn_user(const char *warning, const char *detail)
-{
-       size_t len = 1 + ((warning != NULL) ? strlen(messages_get(warning)) :
-                       0) + ((detail != 0) ? strlen(detail) : 0);
-       char message[len];
-       snprintf(message, len, messages_get(warning), detail);
-       MessageBox(NULL, message, "Warning", MB_ICONWARNING);
-
-       return NSERROR_OK;
-}
-
 static nsurl *gui_get_resource_url(const char *path)
 {
        char buf[PATH_MAX];
@@ -155,7 +136,7 @@ static nserror set_defaults(struct nsoption_s *defaults)
 
 static struct gui_misc_table win32_misc_table = {
        .schedule = win32_schedule,
-       .warning = win32_warn_user,
+       .warning = win32_warning,
 };
 
 
@@ -277,7 +258,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR 
lpcli, int ncmd)
 
        }
        if (ret != NSERROR_OK) {
-               win32_warn_user(messages_get_errorcode(ret), 0);
+               win32_warning(messages_get_errorcode(ret), 0);
        } else {
                win32_run();
        }
diff --git a/windows/prefs.c b/windows/prefs.c
index 1f8dfc9..adc0101 100644
--- a/windows/prefs.c
+++ b/windows/prefs.c
@@ -37,12 +37,12 @@ static CHOOSEFONT *nsws_prefs_font_prepare(int fontfamily, 
HWND parent)
 {
        CHOOSEFONT *cf = malloc(sizeof(CHOOSEFONT));
        if (cf == NULL) {
-               warn_user(messages_get("NoMemory"),0);
+               win32_warning(messages_get("NoMemory"),0);
                return NULL;
        }
        LOGFONT *lf = malloc(sizeof(LOGFONT));
        if (lf == NULL) {
-               warn_user(messages_get("NoMemory"),0);
+               win32_warning(messages_get("NoMemory"),0);
                free(cf);
                return NULL;
        }
diff --git a/windows/window.c b/windows/window.c
index 1dd2bfd..f5f13fe 100644
--- a/windows/window.c
+++ b/windows/window.c
@@ -921,7 +921,7 @@ nsws_window_command(HWND hwnd,
        case IDM_FILE_OPEN_WINDOW:
                ret = win32_open_new_window(gw);
                if (ret != NSERROR_OK) {
-                       warn_user(messages_get_errorcode(ret), 0);
+                       win32_warning(messages_get_errorcode(ret), 0);
                }
                break;
 
@@ -1027,7 +1027,7 @@ nsws_window_command(HWND hwnd,
                nsurl *url;
 
                if (nsurl_create(nsoption_charp(homepage_url), &url) != 
NSERROR_OK) {
-                       warn_user("NoMemory", 0);
+                       win32_warning("NoMemory", 0);
                } else {
                        browser_window_navigate(gw->bw,
                                                url,
@@ -1110,7 +1110,7 @@ nsws_window_command(HWND hwnd,
                        gw->fullscreen = malloc(sizeof(RECT));
                        if ((desktop == NULL) ||
                            (gw->fullscreen == NULL)) {
-                               warn_user("NoMemory", 0);
+                               win32_warning("NoMemory", 0);
                                break;
                        }
                        GetWindowRect(desktop, &rdesk);
@@ -1191,7 +1191,7 @@ nsws_window_command(HWND hwnd,
                LOG("launching %s\n", addr);
 
                if (nsurl_create(addr, &url) != NSERROR_OK) {
-                       warn_user("NoMemory", 0);
+                       win32_warning("NoMemory", 0);
                } else {
                        browser_window_navigate(gw->bw,
                                                url,
@@ -1522,7 +1522,7 @@ static void win32_window_set_title(struct gui_window *w, 
const char *title)
        char *fulltitle = malloc(strlen(title) +
                                 SLEN("  -  NetSurf") + 1);
        if (fulltitle == NULL) {
-               warn_user("NoMemory", 0);
+               win32_warning("NoMemory", 0);
                return;
        }
        strcpy(fulltitle, title);
@@ -1707,7 +1707,7 @@ bool nsws_window_go(HWND hwnd, const char *urltxt)
                return false;
 
        if (nsurl_create(urltxt, &url) != NSERROR_OK) {
-               warn_user("NoMemory", 0);
+               win32_warning("NoMemory", 0);
        } else {
                browser_window_navigate(gw->bw,
                                        url,


-----------------------------------------------------------------------

Summary of changes:
 windows/about.c    |    5 +++--
 windows/download.c |   16 ++++++++--------
 windows/gui.c      |   12 +++++++++++-
 windows/gui.h      |   23 +++++++++++++++--------
 windows/main.c     |   23 ++---------------------
 windows/prefs.c    |    4 ++--
 windows/window.c   |   12 ++++++------
 7 files changed, 47 insertions(+), 48 deletions(-)

diff --git a/windows/about.c b/windows/about.c
index 686d350..4716a5c 100644
--- a/windows/about.c
+++ b/windows/about.c
@@ -27,11 +27,12 @@
 
 #include <windows.h>
 
+#include "utils/log.h"
 #include "utils/utils.h"
 #include "utils/messages.h"
 #include "desktop/version.h"
-#include "utils/log.h"
 
+#include "windows/gui.h"
 #include "windows/window.h"
 #include "windows/about.h"
 #include "windows/resourceid.h"
@@ -144,7 +145,7 @@ void nsws_about_dialog_init(HINSTANCE hinst, HWND parent)
        int ret = DialogBox(hinst, MAKEINTRESOURCE(IDD_DLG_ABOUT), parent,
                        nsws_about_event_callback);
        if (ret == -1) {
-               warn_user(messages_get("NoMemory"), 0);
+               win32_warning(messages_get("NoMemory"), 0);
                return;
        }
 }
diff --git a/windows/download.c b/windows/download.c
index c2cda8f..b281ea7 100644
--- a/windows/download.c
+++ b/windows/download.c
@@ -86,14 +86,14 @@ gui_download_window_create(download_context *ctx, struct 
gui_window *gui)
 {
        if (downloading) {
                /* initial implementation */
-               warn_user("1 download at a time please", 0);
+               win32_warning("1 download at a time please", 0);
                return NULL;
        }
        downloading = true;
        struct gui_download_window *w = 
                        malloc(sizeof(struct gui_download_window));
        if (w == NULL) {
-               warn_user(messages_get("NoMemory"), 0);
+               win32_warning(messages_get("NoMemory"), 0);
                return NULL;
        }
        int total_size = download_context_get_total_length(ctx);
@@ -108,7 +108,7 @@ gui_download_window_create(download_context *ctx, struct 
gui_window *gui)
                filename = strdup(messages_get("UnknownFile"));
        }
        if (filename == NULL) {
-               warn_user(messages_get("NoMemory"), 0);
+               win32_warning(messages_get("NoMemory"), 0);
                free(w);
                return NULL;
        }
@@ -119,14 +119,14 @@ gui_download_window_create(download_context *ctx, struct 
gui_window *gui)
                domain = strdup(messages_get("UnknownHost"));
        }
        if (domain == NULL) {
-               warn_user(messages_get("NoMemory"), 0);
+               win32_warning(messages_get("NoMemory"), 0);
                free(filename);
                free(w);
                return NULL;
        }
        destination = malloc(PATH_MAX);
        if (destination == NULL) {
-               warn_user(messages_get("NoMemory"), 0);
+               win32_warning(messages_get("NoMemory"), 0);
                free(domain);
                free(filename);
                free(w);
@@ -144,7 +144,7 @@ gui_download_window_create(download_context *ctx, struct 
gui_window *gui)
        w->size = total_size;
        w->total_size = strdup(size);
        if (w->total_size == NULL) {
-               warn_user(messages_get("NoMemory"), 0);
+               win32_warning(messages_get("NoMemory"), 0);
                free(destination);
                free(domain);
                free(filename);
@@ -163,7 +163,7 @@ gui_download_window_create(download_context *ctx, struct 
gui_window *gui)
        w->window = gui;
        w->file = fopen(destination, "wb");
        if (w->file == NULL) {
-               warn_user(messages_get("FileOpenWriteError"), destination);
+               win32_warning(messages_get("FileOpenWriteError"), destination);
                free(destination);
                free(domain);
                free(filename);
@@ -175,7 +175,7 @@ gui_download_window_create(download_context *ctx, struct 
gui_window *gui)
        download1 = w;
 
        if (nsws_download_window_up(w) == false) {
-               warn_user(messages_get("NoMemory"), 0);
+               win32_warning(messages_get("NoMemory"), 0);
                free(destination);
                free(domain);
                free(filename);
diff --git a/windows/gui.c b/windows/gui.c
index f9aca5a..9923ecf 100644
--- a/windows/gui.c
+++ b/windows/gui.c
@@ -30,6 +30,7 @@
 #include "utils/corestrings.h"
 #include "utils/url.h"
 #include "utils/file.h"
+#include "utils/messages.h"
 #include "desktop/browser.h"
 #include "desktop/gui_clipboard.h"
 
@@ -90,8 +91,17 @@ void win32_run(void)
 }
 
 
+/* exported function documented in windows/gui.h */
+nserror win32_warning(const char *warning, const char *detail)
+{
+       size_t len = 1 + ((warning != NULL) ? strlen(messages_get(warning)) :
+                       0) + ((detail != 0) ? strlen(detail) : 0);
+       char message[len];
+       snprintf(message, len, messages_get(warning), detail);
+       MessageBox(NULL, message, "Warning", MB_ICONWARNING);
 
-
+       return NSERROR_OK;
+}
 
 
 /**
diff --git a/windows/gui.h b/windows/gui.h
index f72cb2c..4c3f360 100644
--- a/windows/gui.h
+++ b/windows/gui.h
@@ -25,6 +25,8 @@ struct gui_clipboard_table *win32_clipboard_table;
 
 extern HINSTANCE hInstance;
 
+extern char *options_file_location;
+
 /* bounding box */
 typedef struct bbox_s {
         int x0;
@@ -33,19 +35,24 @@ typedef struct bbox_s {
         int y1;
 } bbox_t;
 
-
-
-extern char *options_file_location;
-
-
-
-
 /**
  * Run the win32 message loop with scheduling
  */
 void win32_run(void);
 
-/** cause the main message loop to exit */
+/**
+ * cause the main message loop to exit
+ */
 void win32_set_quit(bool q);
 
+/**
+ * Warn the user of an event.
+ *
+ * \param[in] message A warning looked up in the message translation table
+ * \param[in] detail Additional text to be displayed or NULL.
+ * \return NSERROR_OK on success or error code if there was a
+ *           faliure displaying the message to the user.
+ */
+nserror win32_warning(const char *warning, const char *detail);
+
 #endif 
diff --git a/windows/main.c b/windows/main.c
index 869907d..df64e48 100644
--- a/windows/main.c
+++ b/windows/main.c
@@ -65,25 +65,6 @@ static void die(const char *error)
 }
 
 
-/**
- * Warn the user of an event.
- *
- * \param[in] message A warning looked up in the message translation table
- * \param[in] detail Additional text to be displayed or NULL.
- * \return NSERROR_OK on success or error code if there was a
- *           faliure displaying the message to the user.
- */
-static nserror win32_warn_user(const char *warning, const char *detail)
-{
-       size_t len = 1 + ((warning != NULL) ? strlen(messages_get(warning)) :
-                       0) + ((detail != 0) ? strlen(detail) : 0);
-       char message[len];
-       snprintf(message, len, messages_get(warning), detail);
-       MessageBox(NULL, message, "Warning", MB_ICONWARNING);
-
-       return NSERROR_OK;
-}
-
 static nsurl *gui_get_resource_url(const char *path)
 {
        char buf[PATH_MAX];
@@ -155,7 +136,7 @@ static nserror set_defaults(struct nsoption_s *defaults)
 
 static struct gui_misc_table win32_misc_table = {
        .schedule = win32_schedule,
-       .warning = win32_warn_user,
+       .warning = win32_warning,
 };
 
 
@@ -277,7 +258,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR 
lpcli, int ncmd)
 
        }
        if (ret != NSERROR_OK) {
-               win32_warn_user(messages_get_errorcode(ret), 0);
+               win32_warning(messages_get_errorcode(ret), 0);
        } else {
                win32_run();
        }
diff --git a/windows/prefs.c b/windows/prefs.c
index 1f8dfc9..adc0101 100644
--- a/windows/prefs.c
+++ b/windows/prefs.c
@@ -37,12 +37,12 @@ static CHOOSEFONT *nsws_prefs_font_prepare(int fontfamily, 
HWND parent)
 {
        CHOOSEFONT *cf = malloc(sizeof(CHOOSEFONT));
        if (cf == NULL) {
-               warn_user(messages_get("NoMemory"),0);
+               win32_warning(messages_get("NoMemory"),0);
                return NULL;
        }
        LOGFONT *lf = malloc(sizeof(LOGFONT));
        if (lf == NULL) {
-               warn_user(messages_get("NoMemory"),0);
+               win32_warning(messages_get("NoMemory"),0);
                free(cf);
                return NULL;
        }
diff --git a/windows/window.c b/windows/window.c
index 1dd2bfd..f5f13fe 100644
--- a/windows/window.c
+++ b/windows/window.c
@@ -921,7 +921,7 @@ nsws_window_command(HWND hwnd,
        case IDM_FILE_OPEN_WINDOW:
                ret = win32_open_new_window(gw);
                if (ret != NSERROR_OK) {
-                       warn_user(messages_get_errorcode(ret), 0);
+                       win32_warning(messages_get_errorcode(ret), 0);
                }
                break;
 
@@ -1027,7 +1027,7 @@ nsws_window_command(HWND hwnd,
                nsurl *url;
 
                if (nsurl_create(nsoption_charp(homepage_url), &url) != 
NSERROR_OK) {
-                       warn_user("NoMemory", 0);
+                       win32_warning("NoMemory", 0);
                } else {
                        browser_window_navigate(gw->bw,
                                                url,
@@ -1110,7 +1110,7 @@ nsws_window_command(HWND hwnd,
                        gw->fullscreen = malloc(sizeof(RECT));
                        if ((desktop == NULL) ||
                            (gw->fullscreen == NULL)) {
-                               warn_user("NoMemory", 0);
+                               win32_warning("NoMemory", 0);
                                break;
                        }
                        GetWindowRect(desktop, &rdesk);
@@ -1191,7 +1191,7 @@ nsws_window_command(HWND hwnd,
                LOG("launching %s\n", addr);
 
                if (nsurl_create(addr, &url) != NSERROR_OK) {
-                       warn_user("NoMemory", 0);
+                       win32_warning("NoMemory", 0);
                } else {
                        browser_window_navigate(gw->bw,
                                                url,
@@ -1522,7 +1522,7 @@ static void win32_window_set_title(struct gui_window *w, 
const char *title)
        char *fulltitle = malloc(strlen(title) +
                                 SLEN("  -  NetSurf") + 1);
        if (fulltitle == NULL) {
-               warn_user("NoMemory", 0);
+               win32_warning("NoMemory", 0);
                return;
        }
        strcpy(fulltitle, title);
@@ -1707,7 +1707,7 @@ bool nsws_window_go(HWND hwnd, const char *urltxt)
                return false;
 
        if (nsurl_create(urltxt, &url) != NSERROR_OK) {
-               warn_user("NoMemory", 0);
+               win32_warning("NoMemory", 0);
        } else {
                browser_window_navigate(gw->bw,
                                        url,


-- 
NetSurf Browser

_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to