aboutsummaryrefslogtreecommitdiff
path: root/src/bw.c
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2010-08-20 23:24:19 +0200
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2010-08-20 23:24:19 +0200
commitf5c598b518d1f906148534d015f50075d3e8242d (patch)
tree21dd70add5b366c3dd80641b77f6b18e0baa009e /src/bw.c
parente98d02a01ffeb18ede86af025e51ae1ec011c75a (diff)
parent5f0fc0e48b8cbee7e1795935da0abff6627fd498 (diff)
merge
Diffstat (limited to 'src/bw.c')
-rw-r--r--src/bw.c45
1 files changed, 43 insertions, 2 deletions
diff --git a/src/bw.c b/src/bw.c
index 27f3066c..7f4785bb 100644
--- a/src/bw.c
+++ b/src/bw.c
@@ -13,6 +13,7 @@
#include "bw.h"
+#include "msg.h"
#include "list.h"
#include "capi.h"
#include "uicmd.hh"
@@ -58,11 +59,14 @@ BrowserWindow *a_Bw_new()
bw->nav_expect_url = NULL;
bw->redirect_level = 0;
+ bw->meta_refresh_status = 0;
+ bw->meta_refresh_url = NULL;
bw->RootClients = dList_new(8);
bw->ImageClients = dList_new(8);
bw->NumImages = 0;
bw->NumImagesGot = 0;
+ bw->NumPendingStyleSheets = 0;
bw->PageUrls = dList_new(8);
bw->Docs = dList_new(8);
@@ -99,6 +103,8 @@ void a_Bw_free(BrowserWindow *bw)
dFree(dList_nth_data(bw->nav_stack, j));
dList_free(bw->nav_stack);
+ a_Url_free(bw->meta_refresh_url);
+
dStr_free(bw->page_bugs, 1);
dFree(bw);
break;
@@ -176,7 +182,7 @@ void a_Bw_stop_clients(BrowserWindow *bw, int flags)
if (flags & BW_Root) {
/* Remove root clients */
while ((data = dList_nth_data(bw->RootClients, 0))) {
- a_Capi_stop_client(VOIDP2INT(data), (flags & Bw_Force));
+ a_Capi_stop_client(VOIDP2INT(data), (flags & BW_Force));
dList_remove_fast(bw->RootClients, data);
}
}
@@ -184,7 +190,7 @@ void a_Bw_stop_clients(BrowserWindow *bw, int flags)
if (flags & BW_Img) {
/* Remove image clients */
while ((data = dList_nth_data(bw->ImageClients, 0))) {
- a_Capi_stop_client(VOIDP2INT(data), (flags & Bw_Force));
+ a_Capi_stop_client(VOIDP2INT(data), (flags & BW_Force));
dList_remove_fast(bw->ImageClients, data);
}
}
@@ -216,6 +222,38 @@ void a_Bw_add_doc(BrowserWindow *bw, void *vdoc)
}
/*
+ * Get current document.
+ */
+void *a_Bw_get_current_doc(BrowserWindow *bw)
+{
+ void *doc = NULL;
+ int len = dList_length(bw->Docs);
+
+ if (len == 1)
+ doc = dList_nth_data(bw->Docs, 0);
+ else if (len > 1)
+ MSG("a_Bw_get_current_doc() multiple docs not implemented\n");
+
+ return doc;
+}
+
+/*
+ * Get document by URL.
+ *
+ * This is currently used by popup menus that need to ensure that the
+ * page has not changed while the menu was popped up.
+ */
+void *a_Bw_get_url_doc(BrowserWindow *bw, const DilloUrl *url)
+{
+ void *doc = NULL;
+
+ if (url && dList_find_custom(bw->PageUrls, url, (dCompareFunc)a_Url_cmp)) {
+ doc = a_Bw_get_current_doc(bw);
+ }
+ return doc;
+}
+
+/*
* Remove a document from the bw's list
*/
void a_Bw_remove_doc(BrowserWindow *bw, void *vdoc)
@@ -253,6 +291,9 @@ void a_Bw_cleanup(BrowserWindow *bw)
/* Zero image-progress data */
bw->NumImages = 0;
bw->NumImagesGot = 0;
+
+ /* Zero stylesheet counter */
+ bw->NumPendingStyleSheets = 0;
}
/*--------------------------------------------------------------------------*/