netsurf: branch master updated. release/3.0-356-g5382387
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/5382387c7ddabadf964b6...
...commit http://git.netsurf-browser.org/netsurf.git/commit/5382387c7ddabadf964b688...
...tree http://git.netsurf-browser.org/netsurf.git/tree/5382387c7ddabadf964b6883d...
The branch, master has been updated
via 5382387c7ddabadf964b6883d6b9dca031a6c132 (commit)
from 2381ee1f7e0508b78eaadf33efb8e98fdc31e481 (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=5382387c7ddabadf964...
commit 5382387c7ddabadf964b6883d6b9dca031a6c132
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Ensure we get the correct Messages files
diff --git a/amiga/Makefile.target b/amiga/Makefile.target
index 33ce41e..2359449 100644
--- a/amiga/Makefile.target
+++ b/amiga/Makefile.target
@@ -120,7 +120,7 @@ netsurf.lha: $(EXETARGET)
$(Q)mkdir -p $(AMIGA_INSTALL_TARGET_DIR)/NetSurf
$(Q)cp -p $(EXETARGET) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf
$(Q)mkdir $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources
- $(call split_install_messages, ami, $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/)
+# $(call split_install_messages, ami, $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/)
$(Q)cp -r $(AMIGA_RESOURCES) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources
$(Q)cp -r $(AMIGA_DISTRIBUTION_FILES) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf
$(Q)cp \!NetSurf/Resources/AdBlock,f79 $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/adblock.css
@@ -137,6 +137,7 @@ netsurf.lha: $(EXETARGET)
# $(Q)mkdir $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/SObjs
# $(Q)cp --preserve=timestamps $(AMIGA_SOBJS) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/SObjs
endif
+ $(call split_install_messages, ami, $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/)
$(Q)cd $(AMIGA_INSTALL_TARGET_DIR); \
lha a netsurf.lha NetSurf NetSurf.info AutoInstall
-----------------------------------------------------------------------
Summary of changes:
amiga/Makefile.target | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/amiga/Makefile.target b/amiga/Makefile.target
index 33ce41e..2359449 100644
--- a/amiga/Makefile.target
+++ b/amiga/Makefile.target
@@ -120,7 +120,7 @@ netsurf.lha: $(EXETARGET)
$(Q)mkdir -p $(AMIGA_INSTALL_TARGET_DIR)/NetSurf
$(Q)cp -p $(EXETARGET) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf
$(Q)mkdir $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources
- $(call split_install_messages, ami, $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/)
+# $(call split_install_messages, ami, $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/)
$(Q)cp -r $(AMIGA_RESOURCES) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources
$(Q)cp -r $(AMIGA_DISTRIBUTION_FILES) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf
$(Q)cp \!NetSurf/Resources/AdBlock,f79 $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/adblock.css
@@ -137,6 +137,7 @@ netsurf.lha: $(EXETARGET)
# $(Q)mkdir $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/SObjs
# $(Q)cp --preserve=timestamps $(AMIGA_SOBJS) $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/SObjs
endif
+ $(call split_install_messages, ami, $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/)
$(Q)cd $(AMIGA_INSTALL_TARGET_DIR); \
lha a netsurf.lha NetSurf NetSurf.info AutoInstall
--
NetSurf Browser
10 years, 1 month
netsurf: branch master updated. release/3.0-354-gfad6e0b
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/fad6e0b3b12c6b4fb3368...
...commit http://git.netsurf-browser.org/netsurf.git/commit/fad6e0b3b12c6b4fb336885...
...tree http://git.netsurf-browser.org/netsurf.git/tree/fad6e0b3b12c6b4fb336885d6...
The branch, master has been updated
via fad6e0b3b12c6b4fb336885d6b1e5e62a570b3a2 (commit)
via 344bcc87aea099643b443b5eb8705ddf4c372f33 (commit)
via 7d9af63c16c951b96baa95b49d1c4696d5513a12 (commit)
via 2d33665b693feca2093e5f1d78e254724f0e489e (commit)
via 17c4201fb80a283b2e64cc65948eeeb6ffb4b121 (commit)
via ff78c7cf2ee35d48786ae7b10a354315fe6476b7 (commit)
from b770130a8befc69994c63aa25d884f29658ec4c5 (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=fad6e0b3b12c6b4fb33...
commit fad6e0b3b12c6b4fb336885d6b1e5e62a570b3a2
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Make some RISC OS menu+shortcut strings RISC OS specific, as I believe they aren't used or useful elsewhere.
diff --git a/resources/FatMessages b/resources/FatMessages
index 253ca5e..283c76c 100644
--- a/resources/FatMessages
+++ b/resources/FatMessages
@@ -63,11 +63,11 @@ de.all.Info:Info
fr.all.Info:Info
it.all.Info:Info
nl.all.Info:Informatie
-en.all.AppHelp:Help... F1
-de.all.AppHelp:Hilfe... F1
-fr.all.AppHelp:Aide... F1
-it.all.AppHelp:Aiuto... F1
-nl.all.AppHelp:Hulp... F1
+en.ro.AppHelp:Help... F1
+de.ro.AppHelp:Hilfe... F1
+fr.ro.AppHelp:Aide... F1
+it.ro.AppHelp:Aiuto... F1
+nl.ro.AppHelp:Hulp... F1
en.all.Open:Open
de.all.Open:Öffnen
fr.all.Open:Ouvrir
@@ -88,7 +88,7 @@ nl.all.Quit:Stop
#
en.all.OpenURL:Open URL
de.all.OpenURL:Öffne URL
-fr.all.OpenURL:Ouvrir l'URL...
+fr.all.OpenURL:Ouvrir l'URL
it.all.OpenURL:Apri URL
nl.all.OpenURL:Open URL
@@ -127,21 +127,21 @@ nl.ro.Help:Hulp
# Main -> Page menu
#
-en.all.PageInfo:Info ^F1
-de.all.PageInfo:Info ^F1
-fr.all.PageInfo:Info ^F1
-it.all.PageInfo:Info ^F1
-nl.all.PageInfo:Informatie ^F1
-en.all.Save:Save F3
-de.all.Save:Speichern F3
-fr.all.Save:Sauver F3
-it.all.Save:Salva F3
-nl.all.Save:Bewaar F3
-en.all.SaveComp:Full save ⇑F3
-de.all.SaveComp:Alles speichern ⇑F3
-fr.all.SaveComp:Sauvegarde Complète ⇑F3
-it.all.SaveComp:Salva Tutto ⇑F3
-nl.all.SaveComp:Bewaar alles ⇑F3
+en.ro.PageInfo:Info ^F1
+de.ro.PageInfo:Info ^F1
+fr.ro.PageInfo:Info ^F1
+it.ro.PageInfo:Info ^F1
+nl.ro.PageInfo:Informatie ^F1
+en.ro.Save:Save F3
+de.ro.Save:Speichern F3
+fr.ro.Save:Sauver F3
+it.ro.Save:Salva F3
+nl.ro.Save:Bewaar F3
+en.ro.SaveComp:Full save ⇑F3
+de.ro.SaveComp:Alles speichern ⇑F3
+fr.ro.SaveComp:Sauvegarde Complète ⇑F3
+it.ro.SaveComp:Salva Tutto ⇑F3
+nl.ro.SaveComp:Bewaar alles ⇑F3
en.all.Export:Export
de.all.Export:Exportieren
fr.all.Export:Exporter
@@ -152,39 +152,39 @@ de.all.SaveURL:URL speichern
fr.all.SaveURL:Sauver le lieu
it.all.SaveURL:Salva indirizzo
nl.all.SaveURL:Bewaar adres
-en.all.Print:Print PRINT
-de.all.Print:Drucken DRUCK
-fr.all.Print:Imprimer PRINT
-it.all.Print:Stampa STAMPA
-nl.all.Print:Afdrukken PRINT
-en.all.NewWindow:New window ^N
-de.all.NewWindow:Neues Fenster ^N
-fr.all.NewWindow:Nouvelle fenêtre ^N
-it.all.NewWindow:Nuova finestra ^N
-nl.all.NewWindow:Nieuw venster ^N
-en.all.ViewSrc:View source... F8
-de.all.ViewSrc:Quellcode... F8
-fr.all.ViewSrc:Voir le source... F8
-it.all.ViewSrc:Mostra sorgente... F8
-nl.all.ViewSrc:Bekijk HTML... F8
+en.ro.Print:Print PRINT
+de.ro.Print:Drucken DRUCK
+fr.ro.Print:Imprimer PRINT
+it.ro.Print:Stampa STAMPA
+nl.ro.Print:Afdrukken PRINT
+en.ro.NewWindow:New window ^N
+de.ro.NewWindow:Neues Fenster ^N
+fr.ro.NewWindow:Nouvelle fenêtre ^N
+it.ro.NewWindow:Nuova finestra ^N
+nl.ro.NewWindow:Nieuw venster ^N
+en.ro.ViewSrc:View source... F8
+de.ro.ViewSrc:Quellcode... F8
+fr.ro.ViewSrc:Voir le source... F8
+it.ro.ViewSrc:Mostra sorgente... F8
+nl.ro.ViewSrc:Bekijk HTML... F8
# Main -> Page -> Export menu
#
-en.all.Draw:Draw ⇑^F3
-de.all.Draw:Draw ⇑^F3
-fr.all.Draw:Draw ⇑^F3
-it.all.Draw:Draw ⇑^F3
-nl.all.Draw:Draw ⇑^F3
+en.ro.Draw:Draw ⇑^F3
+de.ro.Draw:Draw ⇑^F3
+fr.ro.Draw:Draw ⇑^F3
+it.ro.Draw:Draw ⇑^F3
+nl.ro.Draw:Draw ⇑^F3
en.all.PDF:PDF
de.all.PDF:PDF
fr.all.PDF:PDF
it.all.PDF:PDF
nl.all.PDF:PDF
-en.all.Text:Text ^F3
-de.all.Text:Text ^F3
-fr.all.Text:Texte ^F3
-it.all.Text:Testo ^F3
-nl.all.Text:Tekst ^F3
+en.ro.Text:Text ^F3
+de.ro.Text:Text ^F3
+fr.ro.Text:Texte ^F3
+it.ro.Text:Testo ^F3
+nl.ro.Text:Tekst ^F3
# Main -> Page -> Save location menu
#
@@ -286,11 +286,11 @@ de.all.UpLevel:Eine Ebene hoch
fr.all.UpLevel:Remonter d'un niveau
it.all.UpLevel:Livello superiore
nl.all.UpLevel:Een niveau omhoog
-en.all.Reload:Reload this page ^F5
-de.all.Reload:Seite erneut laden ^F5
-fr.all.Reload:Recharger cette page ^F5
-it.all.Reload:Ricarica
-nl.all.Reload:Pagina opnieuw laden ^F5
+en.ro.Reload:Reload this page ^F5
+de.ro.Reload:Seite erneut laden ^F5
+fr.ro.Reload:Recharger cette page ^F5
+it.ro.Reload:Ricarica ^F5
+nl.ro.Reload:Pagina opnieuw laden ^F5
en.all.Stop:Stop loading this page
de.all.Stop:Ladevorgang abbrechen
fr.all.Stop:Arrêter le chargement de la page
@@ -299,11 +299,11 @@ nl.all.Stop:Pagina ophalen afbreken
# Main -> Display menu
#
-en.all.ScaleView:Scale view F11
-de.all.ScaleView:Vergrößerung F11
-fr.all.ScaleView:Ajuster la vue F11
-it.all.ScaleView:Visualizzazione graduale F11
-nl.all.ScaleView:Pagina schalen F11
+en.ro.ScaleView:Scale view F11
+de.ro.ScaleView:Vergrößerung F11
+fr.ro.ScaleView:Ajuster la vue F11
+it.ro.ScaleView:Visualizzazione graduale F11
+nl.ro.ScaleView:Pagina schalen F11
en.all.Images:Images
de.all.Images:Bilder
fr.all.Images:Images
@@ -391,11 +391,11 @@ de.all.Cookies:Cookies
fr.all.Cookies:Cookies
it.all.Cookies:Cookie
nl.all.Cookies:Cookies
-en.all.FindText:Find text F4
-de.all.FindText:Text suchen F4
-fr.all.FindText:Recherche de texte F4
-it.all.FindText:Trova testo F4
-nl.all.FindText:Tekst zoeken F4
+en.ro.FindText:Find text F4
+de.ro.FindText:Text suchen F4
+fr.ro.FindText:Recherche de texte F4
+it.ro.FindText:Trova testo F4
+nl.ro.FindText:Tekst zoeken F4
en.all.Window:Window
de.all.Window:Fenster
fr.all.Window:Fenêtre
@@ -409,24 +409,24 @@ de.all.HotlistAdd:Eintrag hinzufügen
fr.all.HotlistAdd:Ajouter aux favoris
it.all.HotlistAdd:Aggiungi
nl.all.HotlistAdd:Toevoegen aan bladwijzers
-en.all.HotlistShow:Show hotlist... F6
-de.all.HotlistShow:Hotlist zeigen... F6
-fr.all.HotlistShow:Montrer les favoris... F6
-it.all.HotlistShow:Mostra... F6
-nl.all.HotlistShow:Toon bladwijzers F6
+en.ro.HotlistShow:Show hotlist... F6
+de.ro.HotlistShow:Hotlist zeigen... F6
+fr.ro.HotlistShow:Montrer les favoris... F6
+it.ro.HotlistShow:Mostra... F6
+nl.ro.HotlistShow:Toon bladwijzers F6
# Main -> Utilities -> History menu
#
-en.all.HistLocal:Show local history... F7
-de.all.HistLocal:History (lokal) zeigen... F7
-fr.all.HistLocal:Montrer l'historique local... F7
-it.all.HistLocal:Mostra cronologia locale... F7
-nl.all.HistLocal:Toon historie (lokaal)... F7
-en.all.HistGlobal:Show global history... ^F7
-de.all.HistGlobal:History (global) zeigen... ^F7
-fr.all.HistGlobal:Montrer l'historique global... ^F7
-it.all.HistGlobal:Mostra cronologia globale... ^F7
-nl.all.HistGlobal:Toon historie (globaal)... ^F7
+en.ro.HistLocal:Show local history... F7
+de.ro.HistLocal:History (lokal) zeigen... F7
+fr.ro.HistLocal:Montrer l'historique local... F7
+it.ro.HistLocal:Mostra cronologia locale... F7
+nl.ro.HistLocal:Toon historie (lokaal)... F7
+en.ro.HistGlobal:Show global history... ^F7
+de.ro.HistGlobal:History (global) zeigen... ^F7
+fr.ro.HistGlobal:Montrer l'historique global... ^F7
+it.ro.HistGlobal:Mostra cronologia globale... ^F7
+nl.ro.HistGlobal:Toon historie (globaal)... ^F7
# Main -> Utilities -> Cookies menu
en.all.ShowCookies:Show cookies...
@@ -516,31 +516,31 @@ de.all.Selection:Auswahl
fr.all.Selection:Sélection
it.all.Selection:Seleziona
nl.all.Selection:Selectie
-en.all.SelectAll:Select all ^A
-de.all.SelectAll:Alles auswählen ^A
-fr.all.SelectAll:Tout sélectionner ^A
-it.all.SelectAll:Seleziona Tutto ^A
-nl.all.SelectAll:Selecteer alles ^A
-en.all.Clear:Clear selection ^Z
-de.all.Clear:Auswahl aufheben ^Z
-fr.all.Clear:Effacer la sélection ^Z
-it.all.Clear:Cancella selezione ^Z
-nl.all.Clear:Selectie opheffen ^Z
-en.all.Copy:Copy to clipboard ^C
-de.all.Copy:Auswahl kopieren ^C
-fr.all.Copy:Copier vers le presse-papier ^C
-it.all.Copy:Copia nella clipboard ^C
-nl.all.Copy:Copieer naar prikbord ^C
-en.all.Cut:Cut to clipboard ^X
-de.all.Cut:Ausschneiden ^X
-fr.all.Cut:Cut to clipboard ^X
-it.all.Cut:Taglia dalla clipboard ^X
-nl.all.Cut:Cut to clipboard ^X
-en.all.Paste:Paste from clipboard ^V
-de.all.Paste:Einfügen ^V
-fr.all.Paste:Paste from clipboard ^V
-it.all.Paste:Incolla sulla clipboard ^V
-nl.all.Paste:Paste from clipboard ^V
+en.ro.SelectAll:Select all ^A
+de.ro.SelectAll:Alles auswählen ^A
+fr.ro.SelectAll:Tout sélectionner ^A
+it.ro.SelectAll:Seleziona Tutto ^A
+nl.ro.SelectAll:Selecteer alles ^A
+en.ro.Clear:Clear selection ^Z
+de.ro.Clear:Auswahl aufheben ^Z
+fr.ro.Clear:Effacer la sélection ^Z
+it.ro.Clear:Cancella selezione ^Z
+nl.ro.Clear:Selectie opheffen ^Z
+en.ro.Copy:Copy to clipboard ^C
+de.ro.Copy:Auswahl kopieren ^C
+fr.ro.Copy:Copier vers le presse-papier ^C
+it.ro.Copy:Copia nella clipboard ^C
+nl.ro.Copy:Copieer naar prikbord ^C
+en.ro.Cut:Cut to clipboard ^X
+de.ro.Cut:Ausschneiden ^X
+fr.ro.Cut:Cut to clipboard ^X
+it.ro.Cut:Taglia dalla clipboard ^X
+nl.ro.Cut:Cut to clipboard ^X
+en.ro.Paste:Paste from clipboard ^V
+de.ro.Paste:Einfügen ^V
+fr.ro.Paste:Paste from clipboard ^V
+it.ro.Paste:Incolla sulla clipboard ^V
+nl.ro.Paste:Paste from clipboard ^V
# Selection Menu
#
@@ -549,16 +549,16 @@ de.all.Edit:Bearbeiten
fr.all.Edit:Éditer
it.all.Edit:Modifica
nl.all.Edit:Bewerken
-en.all.Launch:Launch RETURN
-de.all.Launch:Öffnen RETURN
-fr.all.Launch:Lancer RETURN
-it.all.Launch:Avvia INVIO
-nl.all.Launch:Openen RETURN
-en.all.Delete:Delete ^X
-de.all.Delete:Löschen ^X
-fr.all.Delete:Supprimer ^X
-it.all.Delete:Cancella ^X
-nl.all.Delete:Verwijderen ^X
+en.ro.Launch:Launch RETURN
+de.ro.Launch:Öffnen RETURN
+fr.ro.Launch:Lancer RETURN
+it.ro.Launch:Avvia INVIO
+nl.ro.Launch:Openen RETURN
+en.ro.Delete:Delete ^X
+de.ro.Delete:Löschen ^X
+fr.ro.Delete:Supprimer ^X
+it.ro.Delete:Cancella ^X
+nl.ro.Delete:Verwijderen ^X
en.all.ResetUsage:Reset statistics
de.all.ResetUsage:Statistik zurücksetzen
fr.all.ResetUsage:RAZ des statistiques
@@ -762,7 +762,7 @@ nl.all.TextNS:Text...
en.all.SaveCompNS:Complete...
de.all.SaveCompNS:Komplett...
fr.all.SaveCompNS:Complete...
-it.all.SaveCompNS:HTML...
+it.all.SaveCompNS:Complete...
nl.all.SaveCompNS:Complete...
en.all.PDFNS:PDF...
de.all.PDFNS:PDF...
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=344bcc87aea099643b4...
commit 344bcc87aea099643b443b5eb8705ddf4c372f33
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Show iconified windows when quitting (horrible flickery workaround for a recoverable alert)
diff --git a/amiga/download.c b/amiga/download.c
index 6b0e3c8..bd6b773 100644
--- a/amiga/download.c
+++ b/amiga/download.c
@@ -39,6 +39,7 @@
#include "amiga/iff_dr2d.h"
#include "amiga/file.h"
#include "amiga/misc.h"
+#include "amiga/schedule.h"
#include "amiga/theme.h"
#include "amiga/utf8.h"
@@ -295,7 +296,6 @@ void gui_download_window_done(struct gui_download_window *dw)
nsurl_unref(url);
}
}
-
}
BOOL ami_download_window_event(struct gui_download_window *dw)
diff --git a/amiga/gui.c b/amiga/gui.c
index 20f524d..fae06f1 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -2688,7 +2688,7 @@ void ami_quit_netsurf(void)
break;
case AMINS_WINDOW:
- ami_gui_appicon_remove(gwin);
+ ShowWindow(gwin->win, WINDOW_BACKMOST);
ami_close_all_tabs(gwin);
break;
}
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=7d9af63c16c951b96ba...
commit 7d9af63c16c951b96baa95b49d1c4696d5513a12
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Localise the description, mark it Amiga-only
diff --git a/amiga/gui.c b/amiga/gui.c
index f63b41e..20f524d 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -958,7 +958,7 @@ static void gui_init2(int argc, char** argv)
REGAPP_HasPrefsWindow, TRUE,
REGAPP_CanCreateNewDocs, TRUE,
REGAPP_UniqueApplication, TRUE,
- desc, "Small as a mouse, fast as a cheetah and available for free. NetSurf is a multi-platform web browser.",
+ desc, messages_get("NetSurfDesc"),
TAG_DONE);
}
else
@@ -971,7 +971,7 @@ static void gui_init2(int argc, char** argv)
REGAPP_HasPrefsWindow, TRUE,
REGAPP_CanCreateNewDocs, TRUE,
REGAPP_UniqueApplication, TRUE,
- desc, "Small as a mouse, fast as a cheetah and available for free. NetSurf is a multi-platform web browser.",
+ desc, messages_get("NetSurfDesc"),
TAG_DONE);
}
diff --git a/resources/FatMessages b/resources/FatMessages
index 18cfef9..253ca5e 100644
--- a/resources/FatMessages
+++ b/resources/FatMessages
@@ -44,6 +44,11 @@ de.all.NetSurfCopyright:Copyright © 2003 - 2013 The NetSurf Developers
fr.all.NetSurfCopyright:Copyright © 2003 - 2013 The NetSurf Developers
it.all.NetSurfCopyright:Copyright © 2003 - 2013 The NetSurf Developers
nl.all.NetSurfCopyright:Copyright © 2003 - 2013 The NetSurf Developers
+en.ami.NetSurfDesc:Small as a mouse, fast as a cheetah and available for free. NetSurf is a multi-platform web browser.
+de.ami.NetSurfDesc:Small as a mouse, fast as a cheetah and available for free. NetSurf is a multi-platform web browser.
+fr.ami.NetSurfDesc:Small as a mouse, fast as a cheetah and available for free. NetSurf is a multi-platform web browser.
+it.ami.NetSurfDesc:Small as a mouse, fast as a cheetah and available for free. NetSurf is a multi-platform web browser.
+nl.ami.NetSurfDesc:Small as a mouse, fast as a cheetah and available for free. NetSurf is a multi-platform web browser.
# Menus
# =====
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=2d33665b693feca2093...
commit 2d33665b693feca2093e5f1d78e254724f0e489e
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Remove any AppIcons on quit
diff --git a/amiga/gui.c b/amiga/gui.c
index 2bcf216..f63b41e 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -2688,7 +2688,8 @@ void ami_quit_netsurf(void)
break;
case AMINS_WINDOW:
- ami_close_all_tabs(gwin);
+ ami_gui_appicon_remove(gwin);
+ ami_close_all_tabs(gwin);
break;
}
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=17c4201fb80a283b2e6...
commit 17c4201fb80a283b2e64cc65948eeeb6ffb4b121
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
When receiving a "To Front" message, don't open a window if none are active.
diff --git a/amiga/gui.c b/amiga/gui.c
index bbc4268..2bcf216 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -2478,24 +2478,6 @@ void ami_handle_applib(void)
WindowToFront(curbw->window->shared->win);
ActivateWindow(curbw->window->shared->win);
}
- else
- {
- error = nsurl_create(nsoption_charp(homepage_url), &url);
- if (error == NSERROR_OK) {
- error = browser_window_create(BROWSER_WINDOW_VERIFIABLE |
- BROWSER_WINDOW_HISTORY,
- url,
- NULL,
- NULL,
- &bw);
- nsurl_unref(url);
- }
- if (error != NSERROR_OK) {
- warn_user(messages_get_errorcode(error), 0);
- }
-
-
- }
break;
case APPLIBMT_OpenPrefs:
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=ff78c7cf2ee35d48786...
commit ff78c7cf2ee35d48786ae7b10a354315fe6476b7
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Missed an ellipsis removal. Split this one out as RISC OS uses it.
diff --git a/amiga/menu.c b/amiga/menu.c
index ef1338c..1a4fdce 100644
--- a/amiga/menu.c
+++ b/amiga/menu.c
@@ -235,7 +235,7 @@ void ami_init_menulabs(struct gui_window_2 *gwin)
ami_menu_alloc_item(gwin, M_HISTGLBL, NM_ITEM, "HistGlobalNS", 0, NULL,
ami_menu_item_browser_globalhistory, NULL);
ami_menu_alloc_item(gwin, M_BAR_B2, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL);
- ami_menu_alloc_item(gwin, M_COOKIES, NM_ITEM, "ShowCookies", 0, NULL,
+ ami_menu_alloc_item(gwin, M_COOKIES, NM_ITEM, "ShowCookiesNS", 0, NULL,
ami_menu_item_browser_cookies, NULL);
ami_menu_alloc_item(gwin, M_BAR_B3, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL);
ami_menu_alloc_item(gwin, M_SCALE, NM_ITEM, "ScaleNS", 0, NULL, NULL, NULL);
diff --git a/resources/FatMessages b/resources/FatMessages
index 49486b5..18cfef9 100644
--- a/resources/FatMessages
+++ b/resources/FatMessages
@@ -425,7 +425,7 @@ nl.all.HistGlobal:Toon historie (globaal)... ^F7
# Main -> Utilities -> Cookies menu
en.all.ShowCookies:Show cookies...
-de.all.ShowCookies:Cookies verwalten
+de.all.ShowCookies:Cookies verwalten...
fr.all.ShowCookies:Montrer les cookies...
it.all.ShowCookies:Mostra cookie...
nl.all.ShowCookies:Toon cookies...
@@ -830,6 +830,11 @@ de.all.HistLocalNS:Zeige lokale History
fr.all.HistLocalNS:Show local history
it.all.HistLocalNS:Mostra cronologia locale
nl.all.HistLocalNS:Show local history
+en.ami.ShowCookiesNS:Show cookies
+de.ami.ShowCookiesNS:Cookies verwalten
+fr.ami.ShowCookiesNS:Montrer les cookies
+it.ami.ShowCookiesNS:Mostra cookie
+nl.ami.ShowCookiesNS:Toon cookies
en.all.FindTextNS:Find text...
de.all.FindTextNS:Suchen...
fr.all.FindTextNS:Find text...
-----------------------------------------------------------------------
Summary of changes:
amiga/download.c | 2 +-
amiga/gui.c | 25 +-----
amiga/menu.c | 2 +-
resources/FatMessages | 236 +++++++++++++++++++++++++-----------------------
4 files changed, 129 insertions(+), 136 deletions(-)
diff --git a/amiga/download.c b/amiga/download.c
index 6b0e3c8..bd6b773 100644
--- a/amiga/download.c
+++ b/amiga/download.c
@@ -39,6 +39,7 @@
#include "amiga/iff_dr2d.h"
#include "amiga/file.h"
#include "amiga/misc.h"
+#include "amiga/schedule.h"
#include "amiga/theme.h"
#include "amiga/utf8.h"
@@ -295,7 +296,6 @@ void gui_download_window_done(struct gui_download_window *dw)
nsurl_unref(url);
}
}
-
}
BOOL ami_download_window_event(struct gui_download_window *dw)
diff --git a/amiga/gui.c b/amiga/gui.c
index bbc4268..fae06f1 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -958,7 +958,7 @@ static void gui_init2(int argc, char** argv)
REGAPP_HasPrefsWindow, TRUE,
REGAPP_CanCreateNewDocs, TRUE,
REGAPP_UniqueApplication, TRUE,
- desc, "Small as a mouse, fast as a cheetah and available for free. NetSurf is a multi-platform web browser.",
+ desc, messages_get("NetSurfDesc"),
TAG_DONE);
}
else
@@ -971,7 +971,7 @@ static void gui_init2(int argc, char** argv)
REGAPP_HasPrefsWindow, TRUE,
REGAPP_CanCreateNewDocs, TRUE,
REGAPP_UniqueApplication, TRUE,
- desc, "Small as a mouse, fast as a cheetah and available for free. NetSurf is a multi-platform web browser.",
+ desc, messages_get("NetSurfDesc"),
TAG_DONE);
}
@@ -2478,24 +2478,6 @@ void ami_handle_applib(void)
WindowToFront(curbw->window->shared->win);
ActivateWindow(curbw->window->shared->win);
}
- else
- {
- error = nsurl_create(nsoption_charp(homepage_url), &url);
- if (error == NSERROR_OK) {
- error = browser_window_create(BROWSER_WINDOW_VERIFIABLE |
- BROWSER_WINDOW_HISTORY,
- url,
- NULL,
- NULL,
- &bw);
- nsurl_unref(url);
- }
- if (error != NSERROR_OK) {
- warn_user(messages_get_errorcode(error), 0);
- }
-
-
- }
break;
case APPLIBMT_OpenPrefs:
@@ -2706,7 +2688,8 @@ void ami_quit_netsurf(void)
break;
case AMINS_WINDOW:
- ami_close_all_tabs(gwin);
+ ShowWindow(gwin->win, WINDOW_BACKMOST);
+ ami_close_all_tabs(gwin);
break;
}
diff --git a/amiga/menu.c b/amiga/menu.c
index ef1338c..1a4fdce 100644
--- a/amiga/menu.c
+++ b/amiga/menu.c
@@ -235,7 +235,7 @@ void ami_init_menulabs(struct gui_window_2 *gwin)
ami_menu_alloc_item(gwin, M_HISTGLBL, NM_ITEM, "HistGlobalNS", 0, NULL,
ami_menu_item_browser_globalhistory, NULL);
ami_menu_alloc_item(gwin, M_BAR_B2, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL);
- ami_menu_alloc_item(gwin, M_COOKIES, NM_ITEM, "ShowCookies", 0, NULL,
+ ami_menu_alloc_item(gwin, M_COOKIES, NM_ITEM, "ShowCookiesNS", 0, NULL,
ami_menu_item_browser_cookies, NULL);
ami_menu_alloc_item(gwin, M_BAR_B3, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL);
ami_menu_alloc_item(gwin, M_SCALE, NM_ITEM, "ScaleNS", 0, NULL, NULL, NULL);
diff --git a/resources/FatMessages b/resources/FatMessages
index 49486b5..283c76c 100644
--- a/resources/FatMessages
+++ b/resources/FatMessages
@@ -44,6 +44,11 @@ de.all.NetSurfCopyright:Copyright © 2003 - 2013 The NetSurf Developers
fr.all.NetSurfCopyright:Copyright © 2003 - 2013 The NetSurf Developers
it.all.NetSurfCopyright:Copyright © 2003 - 2013 The NetSurf Developers
nl.all.NetSurfCopyright:Copyright © 2003 - 2013 The NetSurf Developers
+en.ami.NetSurfDesc:Small as a mouse, fast as a cheetah and available for free. NetSurf is a multi-platform web browser.
+de.ami.NetSurfDesc:Small as a mouse, fast as a cheetah and available for free. NetSurf is a multi-platform web browser.
+fr.ami.NetSurfDesc:Small as a mouse, fast as a cheetah and available for free. NetSurf is a multi-platform web browser.
+it.ami.NetSurfDesc:Small as a mouse, fast as a cheetah and available for free. NetSurf is a multi-platform web browser.
+nl.ami.NetSurfDesc:Small as a mouse, fast as a cheetah and available for free. NetSurf is a multi-platform web browser.
# Menus
# =====
@@ -58,11 +63,11 @@ de.all.Info:Info
fr.all.Info:Info
it.all.Info:Info
nl.all.Info:Informatie
-en.all.AppHelp:Help... F1
-de.all.AppHelp:Hilfe... F1
-fr.all.AppHelp:Aide... F1
-it.all.AppHelp:Aiuto... F1
-nl.all.AppHelp:Hulp... F1
+en.ro.AppHelp:Help... F1
+de.ro.AppHelp:Hilfe... F1
+fr.ro.AppHelp:Aide... F1
+it.ro.AppHelp:Aiuto... F1
+nl.ro.AppHelp:Hulp... F1
en.all.Open:Open
de.all.Open:Öffnen
fr.all.Open:Ouvrir
@@ -83,7 +88,7 @@ nl.all.Quit:Stop
#
en.all.OpenURL:Open URL
de.all.OpenURL:Öffne URL
-fr.all.OpenURL:Ouvrir l'URL...
+fr.all.OpenURL:Ouvrir l'URL
it.all.OpenURL:Apri URL
nl.all.OpenURL:Open URL
@@ -122,21 +127,21 @@ nl.ro.Help:Hulp
# Main -> Page menu
#
-en.all.PageInfo:Info ^F1
-de.all.PageInfo:Info ^F1
-fr.all.PageInfo:Info ^F1
-it.all.PageInfo:Info ^F1
-nl.all.PageInfo:Informatie ^F1
-en.all.Save:Save F3
-de.all.Save:Speichern F3
-fr.all.Save:Sauver F3
-it.all.Save:Salva F3
-nl.all.Save:Bewaar F3
-en.all.SaveComp:Full save ⇑F3
-de.all.SaveComp:Alles speichern ⇑F3
-fr.all.SaveComp:Sauvegarde Complète ⇑F3
-it.all.SaveComp:Salva Tutto ⇑F3
-nl.all.SaveComp:Bewaar alles ⇑F3
+en.ro.PageInfo:Info ^F1
+de.ro.PageInfo:Info ^F1
+fr.ro.PageInfo:Info ^F1
+it.ro.PageInfo:Info ^F1
+nl.ro.PageInfo:Informatie ^F1
+en.ro.Save:Save F3
+de.ro.Save:Speichern F3
+fr.ro.Save:Sauver F3
+it.ro.Save:Salva F3
+nl.ro.Save:Bewaar F3
+en.ro.SaveComp:Full save ⇑F3
+de.ro.SaveComp:Alles speichern ⇑F3
+fr.ro.SaveComp:Sauvegarde Complète ⇑F3
+it.ro.SaveComp:Salva Tutto ⇑F3
+nl.ro.SaveComp:Bewaar alles ⇑F3
en.all.Export:Export
de.all.Export:Exportieren
fr.all.Export:Exporter
@@ -147,39 +152,39 @@ de.all.SaveURL:URL speichern
fr.all.SaveURL:Sauver le lieu
it.all.SaveURL:Salva indirizzo
nl.all.SaveURL:Bewaar adres
-en.all.Print:Print PRINT
-de.all.Print:Drucken DRUCK
-fr.all.Print:Imprimer PRINT
-it.all.Print:Stampa STAMPA
-nl.all.Print:Afdrukken PRINT
-en.all.NewWindow:New window ^N
-de.all.NewWindow:Neues Fenster ^N
-fr.all.NewWindow:Nouvelle fenêtre ^N
-it.all.NewWindow:Nuova finestra ^N
-nl.all.NewWindow:Nieuw venster ^N
-en.all.ViewSrc:View source... F8
-de.all.ViewSrc:Quellcode... F8
-fr.all.ViewSrc:Voir le source... F8
-it.all.ViewSrc:Mostra sorgente... F8
-nl.all.ViewSrc:Bekijk HTML... F8
+en.ro.Print:Print PRINT
+de.ro.Print:Drucken DRUCK
+fr.ro.Print:Imprimer PRINT
+it.ro.Print:Stampa STAMPA
+nl.ro.Print:Afdrukken PRINT
+en.ro.NewWindow:New window ^N
+de.ro.NewWindow:Neues Fenster ^N
+fr.ro.NewWindow:Nouvelle fenêtre ^N
+it.ro.NewWindow:Nuova finestra ^N
+nl.ro.NewWindow:Nieuw venster ^N
+en.ro.ViewSrc:View source... F8
+de.ro.ViewSrc:Quellcode... F8
+fr.ro.ViewSrc:Voir le source... F8
+it.ro.ViewSrc:Mostra sorgente... F8
+nl.ro.ViewSrc:Bekijk HTML... F8
# Main -> Page -> Export menu
#
-en.all.Draw:Draw ⇑^F3
-de.all.Draw:Draw ⇑^F3
-fr.all.Draw:Draw ⇑^F3
-it.all.Draw:Draw ⇑^F3
-nl.all.Draw:Draw ⇑^F3
+en.ro.Draw:Draw ⇑^F3
+de.ro.Draw:Draw ⇑^F3
+fr.ro.Draw:Draw ⇑^F3
+it.ro.Draw:Draw ⇑^F3
+nl.ro.Draw:Draw ⇑^F3
en.all.PDF:PDF
de.all.PDF:PDF
fr.all.PDF:PDF
it.all.PDF:PDF
nl.all.PDF:PDF
-en.all.Text:Text ^F3
-de.all.Text:Text ^F3
-fr.all.Text:Texte ^F3
-it.all.Text:Testo ^F3
-nl.all.Text:Tekst ^F3
+en.ro.Text:Text ^F3
+de.ro.Text:Text ^F3
+fr.ro.Text:Texte ^F3
+it.ro.Text:Testo ^F3
+nl.ro.Text:Tekst ^F3
# Main -> Page -> Save location menu
#
@@ -281,11 +286,11 @@ de.all.UpLevel:Eine Ebene hoch
fr.all.UpLevel:Remonter d'un niveau
it.all.UpLevel:Livello superiore
nl.all.UpLevel:Een niveau omhoog
-en.all.Reload:Reload this page ^F5
-de.all.Reload:Seite erneut laden ^F5
-fr.all.Reload:Recharger cette page ^F5
-it.all.Reload:Ricarica
-nl.all.Reload:Pagina opnieuw laden ^F5
+en.ro.Reload:Reload this page ^F5
+de.ro.Reload:Seite erneut laden ^F5
+fr.ro.Reload:Recharger cette page ^F5
+it.ro.Reload:Ricarica ^F5
+nl.ro.Reload:Pagina opnieuw laden ^F5
en.all.Stop:Stop loading this page
de.all.Stop:Ladevorgang abbrechen
fr.all.Stop:Arrêter le chargement de la page
@@ -294,11 +299,11 @@ nl.all.Stop:Pagina ophalen afbreken
# Main -> Display menu
#
-en.all.ScaleView:Scale view F11
-de.all.ScaleView:Vergrößerung F11
-fr.all.ScaleView:Ajuster la vue F11
-it.all.ScaleView:Visualizzazione graduale F11
-nl.all.ScaleView:Pagina schalen F11
+en.ro.ScaleView:Scale view F11
+de.ro.ScaleView:Vergrößerung F11
+fr.ro.ScaleView:Ajuster la vue F11
+it.ro.ScaleView:Visualizzazione graduale F11
+nl.ro.ScaleView:Pagina schalen F11
en.all.Images:Images
de.all.Images:Bilder
fr.all.Images:Images
@@ -386,11 +391,11 @@ de.all.Cookies:Cookies
fr.all.Cookies:Cookies
it.all.Cookies:Cookie
nl.all.Cookies:Cookies
-en.all.FindText:Find text F4
-de.all.FindText:Text suchen F4
-fr.all.FindText:Recherche de texte F4
-it.all.FindText:Trova testo F4
-nl.all.FindText:Tekst zoeken F4
+en.ro.FindText:Find text F4
+de.ro.FindText:Text suchen F4
+fr.ro.FindText:Recherche de texte F4
+it.ro.FindText:Trova testo F4
+nl.ro.FindText:Tekst zoeken F4
en.all.Window:Window
de.all.Window:Fenster
fr.all.Window:Fenêtre
@@ -404,28 +409,28 @@ de.all.HotlistAdd:Eintrag hinzufügen
fr.all.HotlistAdd:Ajouter aux favoris
it.all.HotlistAdd:Aggiungi
nl.all.HotlistAdd:Toevoegen aan bladwijzers
-en.all.HotlistShow:Show hotlist... F6
-de.all.HotlistShow:Hotlist zeigen... F6
-fr.all.HotlistShow:Montrer les favoris... F6
-it.all.HotlistShow:Mostra... F6
-nl.all.HotlistShow:Toon bladwijzers F6
+en.ro.HotlistShow:Show hotlist... F6
+de.ro.HotlistShow:Hotlist zeigen... F6
+fr.ro.HotlistShow:Montrer les favoris... F6
+it.ro.HotlistShow:Mostra... F6
+nl.ro.HotlistShow:Toon bladwijzers F6
# Main -> Utilities -> History menu
#
-en.all.HistLocal:Show local history... F7
-de.all.HistLocal:History (lokal) zeigen... F7
-fr.all.HistLocal:Montrer l'historique local... F7
-it.all.HistLocal:Mostra cronologia locale... F7
-nl.all.HistLocal:Toon historie (lokaal)... F7
-en.all.HistGlobal:Show global history... ^F7
-de.all.HistGlobal:History (global) zeigen... ^F7
-fr.all.HistGlobal:Montrer l'historique global... ^F7
-it.all.HistGlobal:Mostra cronologia globale... ^F7
-nl.all.HistGlobal:Toon historie (globaal)... ^F7
+en.ro.HistLocal:Show local history... F7
+de.ro.HistLocal:History (lokal) zeigen... F7
+fr.ro.HistLocal:Montrer l'historique local... F7
+it.ro.HistLocal:Mostra cronologia locale... F7
+nl.ro.HistLocal:Toon historie (lokaal)... F7
+en.ro.HistGlobal:Show global history... ^F7
+de.ro.HistGlobal:History (global) zeigen... ^F7
+fr.ro.HistGlobal:Montrer l'historique global... ^F7
+it.ro.HistGlobal:Mostra cronologia globale... ^F7
+nl.ro.HistGlobal:Toon historie (globaal)... ^F7
# Main -> Utilities -> Cookies menu
en.all.ShowCookies:Show cookies...
-de.all.ShowCookies:Cookies verwalten
+de.all.ShowCookies:Cookies verwalten...
fr.all.ShowCookies:Montrer les cookies...
it.all.ShowCookies:Mostra cookie...
nl.all.ShowCookies:Toon cookies...
@@ -511,31 +516,31 @@ de.all.Selection:Auswahl
fr.all.Selection:Sélection
it.all.Selection:Seleziona
nl.all.Selection:Selectie
-en.all.SelectAll:Select all ^A
-de.all.SelectAll:Alles auswählen ^A
-fr.all.SelectAll:Tout sélectionner ^A
-it.all.SelectAll:Seleziona Tutto ^A
-nl.all.SelectAll:Selecteer alles ^A
-en.all.Clear:Clear selection ^Z
-de.all.Clear:Auswahl aufheben ^Z
-fr.all.Clear:Effacer la sélection ^Z
-it.all.Clear:Cancella selezione ^Z
-nl.all.Clear:Selectie opheffen ^Z
-en.all.Copy:Copy to clipboard ^C
-de.all.Copy:Auswahl kopieren ^C
-fr.all.Copy:Copier vers le presse-papier ^C
-it.all.Copy:Copia nella clipboard ^C
-nl.all.Copy:Copieer naar prikbord ^C
-en.all.Cut:Cut to clipboard ^X
-de.all.Cut:Ausschneiden ^X
-fr.all.Cut:Cut to clipboard ^X
-it.all.Cut:Taglia dalla clipboard ^X
-nl.all.Cut:Cut to clipboard ^X
-en.all.Paste:Paste from clipboard ^V
-de.all.Paste:Einfügen ^V
-fr.all.Paste:Paste from clipboard ^V
-it.all.Paste:Incolla sulla clipboard ^V
-nl.all.Paste:Paste from clipboard ^V
+en.ro.SelectAll:Select all ^A
+de.ro.SelectAll:Alles auswählen ^A
+fr.ro.SelectAll:Tout sélectionner ^A
+it.ro.SelectAll:Seleziona Tutto ^A
+nl.ro.SelectAll:Selecteer alles ^A
+en.ro.Clear:Clear selection ^Z
+de.ro.Clear:Auswahl aufheben ^Z
+fr.ro.Clear:Effacer la sélection ^Z
+it.ro.Clear:Cancella selezione ^Z
+nl.ro.Clear:Selectie opheffen ^Z
+en.ro.Copy:Copy to clipboard ^C
+de.ro.Copy:Auswahl kopieren ^C
+fr.ro.Copy:Copier vers le presse-papier ^C
+it.ro.Copy:Copia nella clipboard ^C
+nl.ro.Copy:Copieer naar prikbord ^C
+en.ro.Cut:Cut to clipboard ^X
+de.ro.Cut:Ausschneiden ^X
+fr.ro.Cut:Cut to clipboard ^X
+it.ro.Cut:Taglia dalla clipboard ^X
+nl.ro.Cut:Cut to clipboard ^X
+en.ro.Paste:Paste from clipboard ^V
+de.ro.Paste:Einfügen ^V
+fr.ro.Paste:Paste from clipboard ^V
+it.ro.Paste:Incolla sulla clipboard ^V
+nl.ro.Paste:Paste from clipboard ^V
# Selection Menu
#
@@ -544,16 +549,16 @@ de.all.Edit:Bearbeiten
fr.all.Edit:Éditer
it.all.Edit:Modifica
nl.all.Edit:Bewerken
-en.all.Launch:Launch RETURN
-de.all.Launch:Öffnen RETURN
-fr.all.Launch:Lancer RETURN
-it.all.Launch:Avvia INVIO
-nl.all.Launch:Openen RETURN
-en.all.Delete:Delete ^X
-de.all.Delete:Löschen ^X
-fr.all.Delete:Supprimer ^X
-it.all.Delete:Cancella ^X
-nl.all.Delete:Verwijderen ^X
+en.ro.Launch:Launch RETURN
+de.ro.Launch:Öffnen RETURN
+fr.ro.Launch:Lancer RETURN
+it.ro.Launch:Avvia INVIO
+nl.ro.Launch:Openen RETURN
+en.ro.Delete:Delete ^X
+de.ro.Delete:Löschen ^X
+fr.ro.Delete:Supprimer ^X
+it.ro.Delete:Cancella ^X
+nl.ro.Delete:Verwijderen ^X
en.all.ResetUsage:Reset statistics
de.all.ResetUsage:Statistik zurücksetzen
fr.all.ResetUsage:RAZ des statistiques
@@ -757,7 +762,7 @@ nl.all.TextNS:Text...
en.all.SaveCompNS:Complete...
de.all.SaveCompNS:Komplett...
fr.all.SaveCompNS:Complete...
-it.all.SaveCompNS:HTML...
+it.all.SaveCompNS:Complete...
nl.all.SaveCompNS:Complete...
en.all.PDFNS:PDF...
de.all.PDFNS:PDF...
@@ -830,6 +835,11 @@ de.all.HistLocalNS:Zeige lokale History
fr.all.HistLocalNS:Show local history
it.all.HistLocalNS:Mostra cronologia locale
nl.all.HistLocalNS:Show local history
+en.ami.ShowCookiesNS:Show cookies
+de.ami.ShowCookiesNS:Cookies verwalten
+fr.ami.ShowCookiesNS:Montrer les cookies
+it.ami.ShowCookiesNS:Mostra cookie
+nl.ami.ShowCookiesNS:Toon cookies
en.all.FindTextNS:Find text...
de.all.FindTextNS:Suchen...
fr.all.FindTextNS:Find text...
--
NetSurf Browser
10 years, 1 month
netsurf: branch master updated. release/3.0-348-gb770130
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/b770130a8befc69994c63...
...commit http://git.netsurf-browser.org/netsurf.git/commit/b770130a8befc69994c63aa...
...tree http://git.netsurf-browser.org/netsurf.git/tree/b770130a8befc69994c63aa25...
The branch, master has been updated
via b770130a8befc69994c63aa25d884f29658ec4c5 (commit)
from 2bd587add5912c02db71746e83eda47b66fb80af (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=b770130a8befc69994c...
commit b770130a8befc69994c63aa25d884f29658ec4c5
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Improve namespacing of enum values.
diff --git a/desktop/cookie_manager.c b/desktop/cookie_manager.c
index c35251e..7c2b4a4 100644
--- a/desktop/cookie_manager.c
+++ b/desktop/cookie_manager.c
@@ -32,30 +32,30 @@
#include "utils/log.h"
enum cookie_manager_field {
- CM_NAME,
- CM_CONTENT,
- CM_DOMAIN,
- CM_PATH,
- CM_EXPIRES,
- CM_LAST_USED,
- CM_RESTRICTIONS,
- CM_VERSION,
- CM_PERSISTENT,
- CM_DOMAIN_FOLDER,
- N_FIELDS
+ COOKIE_M_NAME,
+ COOKIE_M_CONTENT,
+ COOKIE_M_DOMAIN,
+ COOKIE_M_PATH,
+ COOKIE_M_EXPIRES,
+ COOKIE_M_LAST_USED,
+ COOKIE_M_RESTRICTIONS,
+ COOKIE_M_VERSION,
+ COOKIE_M_PERSISTENT,
+ COOKIE_M_DOMAIN_FOLDER,
+ COOKIE_M_N_FIELDS
};
enum cookie_manager_value {
- CM_HTTPS,
- CM_SECURE,
- CM_HTTP,
- CM_NONE,
- CM_NETSCAPE,
- CM_RFC2109,
- CM_RFC2965,
- CM_YES,
- CM_NO,
- N_VALUES
+ COOKIE_M_HTTPS,
+ COOKIE_M_SECURE,
+ COOKIE_M_HTTP,
+ COOKIE_M_NONE,
+ COOKIE_M_NETSCAPE,
+ COOKIE_M_RFC2109,
+ COOKIE_M_RFC2965,
+ COOKIE_M_YES,
+ COOKIE_M_NO,
+ COOKIE_M_N_VALUES
};
struct cookie_manager_folder {
@@ -65,8 +65,8 @@ struct cookie_manager_folder {
struct cookie_manager_ctx {
treeview *tree;
- struct treeview_field_desc fields[N_FIELDS];
- struct treeview_field_data values[N_VALUES];
+ struct treeview_field_desc fields[COOKIE_M_N_FIELDS];
+ struct treeview_field_data values[COOKIE_M_N_VALUES];
bool built;
};
struct cookie_manager_ctx cm_ctx;
@@ -76,7 +76,7 @@ struct cookie_manager_entry {
treeview_node *entry;
- struct treeview_field_data data[N_FIELDS - 1];
+ struct treeview_field_data data[COOKIE_M_N_FIELDS - 1];
};
@@ -95,9 +95,9 @@ static nserror cookie_manager_walk_cb(void *ctx, void *node_data,
if (type == TREE_NODE_ENTRY) {
struct cookie_manager_entry *entry = node_data;
- if (entry->data[CM_NAME].value_len == tw->title_len &&
+ if (entry->data[COOKIE_M_NAME].value_len == tw->title_len &&
strcmp(tw->title,
- entry->data[CM_NAME].value) == 0) {
+ entry->data[COOKIE_M_NAME].value) == 0) {
/* Found what we're looking for */
tw->entry = entry;
*abort = true;
@@ -187,12 +187,12 @@ static void cookie_manager_free_treeview_field_data(
struct cookie_manager_entry *e)
{
/* Eww */
- free((void *)e->data[CM_NAME].value);
- free((void *)e->data[CM_CONTENT].value);
- free((void *)e->data[CM_DOMAIN].value);
- free((void *)e->data[CM_PATH].value);
- free((void *)e->data[CM_EXPIRES].value);
- free((void *)e->data[CM_LAST_USED].value);
+ free((void *)e->data[COOKIE_M_NAME].value);
+ free((void *)e->data[COOKIE_M_CONTENT].value);
+ free((void *)e->data[COOKIE_M_DOMAIN].value);
+ free((void *)e->data[COOKIE_M_PATH].value);
+ free((void *)e->data[COOKIE_M_EXPIRES].value);
+ free((void *)e->data[COOKIE_M_LAST_USED].value);
}
@@ -235,14 +235,14 @@ static nserror cookie_manager_set_treeview_field_data(
assert(data != NULL);
/* Set the fields up */
- cookie_manager_field_builder(CM_NAME,
- &e->data[CM_NAME], strdup(data->name));
- cookie_manager_field_builder(CM_CONTENT,
- &e->data[CM_CONTENT], strdup(data->value));
- cookie_manager_field_builder(CM_DOMAIN,
- &e->data[CM_DOMAIN], strdup(data->domain));
- cookie_manager_field_builder(CM_PATH,
- &e->data[CM_PATH], strdup(data->path));
+ cookie_manager_field_builder(COOKIE_M_NAME,
+ &e->data[COOKIE_M_NAME], strdup(data->name));
+ cookie_manager_field_builder(COOKIE_M_CONTENT,
+ &e->data[COOKIE_M_CONTENT], strdup(data->value));
+ cookie_manager_field_builder(COOKIE_M_DOMAIN,
+ &e->data[COOKIE_M_DOMAIN], strdup(data->domain));
+ cookie_manager_field_builder(COOKIE_M_PATH,
+ &e->data[COOKIE_M_PATH], strdup(data->path));
/* Set the Expires date field */
date = ctime(&data->expires);
@@ -251,8 +251,8 @@ static nserror cookie_manager_set_treeview_field_data(
assert(date2[24] == '\n');
date2[24] = '\0';
}
- cookie_manager_field_builder(CM_EXPIRES,
- &e->data[CM_EXPIRES], date2);
+ cookie_manager_field_builder(COOKIE_M_EXPIRES,
+ &e->data[COOKIE_M_EXPIRES], date2);
/* Set the Last used date field */
date = ctime(&data->last_used);
@@ -261,37 +261,37 @@ static nserror cookie_manager_set_treeview_field_data(
assert(date2[24] == '\n');
date2[24] = '\0';
}
- cookie_manager_field_builder(CM_LAST_USED,
- &e->data[CM_LAST_USED], date2);
+ cookie_manager_field_builder(COOKIE_M_LAST_USED,
+ &e->data[COOKIE_M_LAST_USED], date2);
/* Set the Restrictions text */
if (data->secure && data->http_only)
- e->data[CM_RESTRICTIONS] = cm_ctx.values[CM_HTTPS];
+ e->data[COOKIE_M_RESTRICTIONS] = cm_ctx.values[COOKIE_M_HTTPS];
else if (data->secure)
- e->data[CM_RESTRICTIONS] = cm_ctx.values[CM_SECURE];
+ e->data[COOKIE_M_RESTRICTIONS] = cm_ctx.values[COOKIE_M_SECURE];
else if (data->http_only)
- e->data[CM_RESTRICTIONS] = cm_ctx.values[CM_HTTP];
+ e->data[COOKIE_M_RESTRICTIONS] = cm_ctx.values[COOKIE_M_HTTP];
else
- e->data[CM_RESTRICTIONS] = cm_ctx.values[CM_NONE];
+ e->data[COOKIE_M_RESTRICTIONS] = cm_ctx.values[COOKIE_M_NONE];
/* Set the Version text */
switch (data->version) {
case COOKIE_NETSCAPE:
- e->data[CM_VERSION] = cm_ctx.values[CM_NETSCAPE];
+ e->data[COOKIE_M_VERSION] = cm_ctx.values[COOKIE_M_NETSCAPE];
break;
case COOKIE_RFC2109:
- e->data[CM_VERSION] = cm_ctx.values[CM_RFC2109];
+ e->data[COOKIE_M_VERSION] = cm_ctx.values[COOKIE_M_RFC2109];
break;
case COOKIE_RFC2965:
- e->data[CM_VERSION] = cm_ctx.values[CM_RFC2965];
+ e->data[COOKIE_M_VERSION] = cm_ctx.values[COOKIE_M_RFC2965];
break;
}
/* Set the Persistent text */
if (data->no_destroy)
- e->data[CM_PERSISTENT] = cm_ctx.values[CM_YES];
+ e->data[COOKIE_M_PERSISTENT] = cm_ctx.values[COOKIE_M_YES];
else
- e->data[CM_PERSISTENT] = cm_ctx.values[CM_NO];
+ e->data[COOKIE_M_PERSISTENT] = cm_ctx.values[COOKIE_M_NO];
return NSERROR_OK;
}
@@ -404,7 +404,7 @@ static nserror cookie_manager_create_domain_folder(
return NSERROR_NOMEM;
}
- f->data.field = cm_ctx.fields[N_FIELDS - 1].field;
+ f->data.field = cm_ctx.fields[COOKIE_M_N_FIELDS - 1].field;
f->data.value = strdup(data->domain);
f->data.value_len = (f->data.value != NULL) ?
strlen(data->domain) : 0;
@@ -511,95 +511,95 @@ static nserror cookie_manager_init_entry_fields(void)
int i;
const char *label;
- for (i = 0; i < N_FIELDS; i++)
+ for (i = 0; i < COOKIE_M_N_FIELDS; i++)
cm_ctx.fields[i].field = NULL;
- cm_ctx.fields[CM_NAME].flags = TREE_FLAG_DEFAULT;
+ cm_ctx.fields[COOKIE_M_NAME].flags = TREE_FLAG_DEFAULT;
label = "TreeviewLabelName";
label = messages_get(label);
if (lwc_intern_string(label, strlen(label),
- &cm_ctx.fields[CM_NAME].field) !=
+ &cm_ctx.fields[COOKIE_M_NAME].field) !=
lwc_error_ok) {
goto error;
}
- cm_ctx.fields[CM_CONTENT].flags = TREE_FLAG_SHOW_NAME;
+ cm_ctx.fields[COOKIE_M_CONTENT].flags = TREE_FLAG_SHOW_NAME;
label = "TreeviewLabelContent";
label = messages_get(label);
if (lwc_intern_string(label, strlen(label),
- &cm_ctx.fields[CM_CONTENT].field) !=
+ &cm_ctx.fields[COOKIE_M_CONTENT].field) !=
lwc_error_ok) {
goto error;
}
- cm_ctx.fields[CM_DOMAIN].flags = TREE_FLAG_SHOW_NAME;
+ cm_ctx.fields[COOKIE_M_DOMAIN].flags = TREE_FLAG_SHOW_NAME;
label = "TreeviewLabelDomain";
label = messages_get(label);
if (lwc_intern_string(label, strlen(label),
- &cm_ctx.fields[CM_DOMAIN].field) !=
+ &cm_ctx.fields[COOKIE_M_DOMAIN].field) !=
lwc_error_ok) {
goto error;
}
- cm_ctx.fields[CM_PATH].flags = TREE_FLAG_SHOW_NAME;
+ cm_ctx.fields[COOKIE_M_PATH].flags = TREE_FLAG_SHOW_NAME;
label = "TreeviewLabelPath";
label = messages_get(label);
if (lwc_intern_string(label, strlen(label),
- &cm_ctx.fields[CM_PATH].field) !=
+ &cm_ctx.fields[COOKIE_M_PATH].field) !=
lwc_error_ok) {
goto error;
}
- cm_ctx.fields[CM_EXPIRES].flags = TREE_FLAG_SHOW_NAME;
+ cm_ctx.fields[COOKIE_M_EXPIRES].flags = TREE_FLAG_SHOW_NAME;
label = "TreeviewLabelExpires";
label = messages_get(label);
if (lwc_intern_string(label, strlen(label),
- &cm_ctx.fields[CM_EXPIRES].field) !=
+ &cm_ctx.fields[COOKIE_M_EXPIRES].field) !=
lwc_error_ok) {
goto error;
}
- cm_ctx.fields[CM_LAST_USED].flags = TREE_FLAG_SHOW_NAME;
+ cm_ctx.fields[COOKIE_M_LAST_USED].flags = TREE_FLAG_SHOW_NAME;
label = "TreeviewLabelLastUsed";
label = messages_get(label);
if (lwc_intern_string(label, strlen(label),
- &cm_ctx.fields[CM_LAST_USED].field) !=
+ &cm_ctx.fields[COOKIE_M_LAST_USED].field) !=
lwc_error_ok) {
goto error;
}
- cm_ctx.fields[CM_RESTRICTIONS].flags = TREE_FLAG_SHOW_NAME;
+ cm_ctx.fields[COOKIE_M_RESTRICTIONS].flags = TREE_FLAG_SHOW_NAME;
label = "TreeviewLabelRestrictions";
label = messages_get(label);
if (lwc_intern_string(label, strlen(label),
- &cm_ctx.fields[CM_RESTRICTIONS].field) !=
+ &cm_ctx.fields[COOKIE_M_RESTRICTIONS].field) !=
lwc_error_ok) {
goto error;
}
- cm_ctx.fields[CM_VERSION].flags = TREE_FLAG_SHOW_NAME;
+ cm_ctx.fields[COOKIE_M_VERSION].flags = TREE_FLAG_SHOW_NAME;
label = "TreeviewLabelVersion";
label = messages_get(label);
if (lwc_intern_string(label, strlen(label),
- &cm_ctx.fields[CM_VERSION].field) !=
+ &cm_ctx.fields[COOKIE_M_VERSION].field) !=
lwc_error_ok) {
goto error;
}
- cm_ctx.fields[CM_PERSISTENT].flags = TREE_FLAG_SHOW_NAME;
+ cm_ctx.fields[COOKIE_M_PERSISTENT].flags = TREE_FLAG_SHOW_NAME;
label = "TreeviewLabelPersistent";
label = messages_get(label);
if (lwc_intern_string(label, strlen(label),
- &cm_ctx.fields[CM_PERSISTENT].field) !=
+ &cm_ctx.fields[COOKIE_M_PERSISTENT].field) !=
lwc_error_ok) {
goto error;
}
- cm_ctx.fields[CM_DOMAIN_FOLDER].flags = TREE_FLAG_DEFAULT;
+ cm_ctx.fields[COOKIE_M_DOMAIN_FOLDER].flags = TREE_FLAG_DEFAULT;
label = "TreeviewLabelDomainFolder";
label = messages_get(label);
if (lwc_intern_string(label, strlen(label),
- &cm_ctx.fields[CM_DOMAIN_FOLDER].field) !=
+ &cm_ctx.fields[COOKIE_M_DOMAIN_FOLDER].field) !=
lwc_error_ok) {
return false;
}
@@ -607,7 +607,7 @@ static nserror cookie_manager_init_entry_fields(void)
return NSERROR_OK;
error:
- for (i = 0; i < N_FIELDS; i++)
+ for (i = 0; i < COOKIE_M_N_FIELDS; i++)
if (cm_ctx.fields[i].field != NULL)
lwc_string_unref(cm_ctx.fields[i].field);
@@ -627,45 +627,45 @@ static nserror cookie_manager_init_common_values(void)
/* Set the Restrictions text */
temp = messages_get("CookieManagerHTTPS");
- cookie_manager_field_builder(CM_RESTRICTIONS,
- &cm_ctx.values[CM_HTTPS], strdup(temp));
+ cookie_manager_field_builder(COOKIE_M_RESTRICTIONS,
+ &cm_ctx.values[COOKIE_M_HTTPS], strdup(temp));
temp = messages_get("CookieManagerSecure");
- cookie_manager_field_builder(CM_RESTRICTIONS,
- &cm_ctx.values[CM_SECURE], strdup(temp));
+ cookie_manager_field_builder(COOKIE_M_RESTRICTIONS,
+ &cm_ctx.values[COOKIE_M_SECURE], strdup(temp));
temp = messages_get("CookieManagerHTTP");
- cookie_manager_field_builder(CM_RESTRICTIONS,
- &cm_ctx.values[CM_HTTP], strdup(temp));
+ cookie_manager_field_builder(COOKIE_M_RESTRICTIONS,
+ &cm_ctx.values[COOKIE_M_HTTP], strdup(temp));
temp = messages_get("None");
- cookie_manager_field_builder(CM_RESTRICTIONS,
- &cm_ctx.values[CM_NONE], strdup(temp));
+ cookie_manager_field_builder(COOKIE_M_RESTRICTIONS,
+ &cm_ctx.values[COOKIE_M_NONE], strdup(temp));
/* Set the Cookie version text */
assert(COOKIE_NETSCAPE == 0);
temp = messages_get("TreeVersion0");
- cookie_manager_field_builder(CM_VERSION,
- &cm_ctx.values[CM_NETSCAPE], strdup(temp));
+ cookie_manager_field_builder(COOKIE_M_VERSION,
+ &cm_ctx.values[COOKIE_M_NETSCAPE], strdup(temp));
assert(COOKIE_RFC2109 == 1);
temp = messages_get("TreeVersion1");
- cookie_manager_field_builder(CM_VERSION,
- &cm_ctx.values[CM_RFC2109], strdup(temp));
+ cookie_manager_field_builder(COOKIE_M_VERSION,
+ &cm_ctx.values[COOKIE_M_RFC2109], strdup(temp));
assert(COOKIE_RFC2965 == 2);
temp = messages_get("TreeVersion2");
- cookie_manager_field_builder(CM_VERSION,
- &cm_ctx.values[CM_RFC2965], strdup(temp));
+ cookie_manager_field_builder(COOKIE_M_VERSION,
+ &cm_ctx.values[COOKIE_M_RFC2965], strdup(temp));
/* Set the Persistent value text */
temp = messages_get("Yes");
- cookie_manager_field_builder(CM_PERSISTENT,
- &cm_ctx.values[CM_YES], strdup(temp));
+ cookie_manager_field_builder(COOKIE_M_PERSISTENT,
+ &cm_ctx.values[COOKIE_M_YES], strdup(temp));
temp = messages_get("No");
- cookie_manager_field_builder(CM_PERSISTENT,
- &cm_ctx.values[CM_NO], strdup(temp));
+ cookie_manager_field_builder(COOKIE_M_PERSISTENT,
+ &cm_ctx.values[COOKIE_M_NO], strdup(temp));
return NSERROR_OK;
}
@@ -684,9 +684,9 @@ static void cookie_manager_delete_entry(struct cookie_manager_entry *e)
if (e->user_delete) {
/* Delete the cookie from URLdb */
- domain = e->data[CM_DOMAIN].value;
- path = e->data[CM_PATH].value;
- name = e->data[CM_NAME].value;
+ domain = e->data[COOKIE_M_DOMAIN].value;
+ path = e->data[COOKIE_M_PATH].value;
+ name = e->data[COOKIE_M_NAME].value;
if ((domain != NULL) && (path != NULL) && (name != NULL)) {
@@ -772,7 +772,7 @@ nserror cookie_manager_init(struct core_window_callback_table *cw_t,
/* Create the cookie manager treeview */
err = treeview_create(&cm_ctx.tree, &cm_tree_cb_t,
- N_FIELDS, cm_ctx.fields,
+ COOKIE_M_N_FIELDS, cm_ctx.fields,
cw_t, core_window_handle,
TREEVIEW_NO_MOVES | TREEVIEW_DEL_EMPTY_DIRS);
if (err != NSERROR_OK) {
@@ -808,12 +808,12 @@ nserror cookie_manager_fini(void)
err = treeview_destroy(cm_ctx.tree);
/* Free cookie manager treeview entry fields */
- for (i = 0; i < N_FIELDS; i++)
+ for (i = 0; i < COOKIE_M_N_FIELDS; i++)
if (cm_ctx.fields[i].field != NULL)
lwc_string_unref(cm_ctx.fields[i].field);
/* Free cookie manager treeview common entry values */
- for (i = 0; i < N_VALUES; i++)
+ for (i = 0; i < COOKIE_M_N_VALUES; i++)
if (cm_ctx.values[i].value != NULL)
free((void *) cm_ctx.values[i].value);
-----------------------------------------------------------------------
Summary of changes:
desktop/cookie_manager.c | 200 +++++++++++++++++++++++-----------------------
1 files changed, 100 insertions(+), 100 deletions(-)
diff --git a/desktop/cookie_manager.c b/desktop/cookie_manager.c
index c35251e..7c2b4a4 100644
--- a/desktop/cookie_manager.c
+++ b/desktop/cookie_manager.c
@@ -32,30 +32,30 @@
#include "utils/log.h"
enum cookie_manager_field {
- CM_NAME,
- CM_CONTENT,
- CM_DOMAIN,
- CM_PATH,
- CM_EXPIRES,
- CM_LAST_USED,
- CM_RESTRICTIONS,
- CM_VERSION,
- CM_PERSISTENT,
- CM_DOMAIN_FOLDER,
- N_FIELDS
+ COOKIE_M_NAME,
+ COOKIE_M_CONTENT,
+ COOKIE_M_DOMAIN,
+ COOKIE_M_PATH,
+ COOKIE_M_EXPIRES,
+ COOKIE_M_LAST_USED,
+ COOKIE_M_RESTRICTIONS,
+ COOKIE_M_VERSION,
+ COOKIE_M_PERSISTENT,
+ COOKIE_M_DOMAIN_FOLDER,
+ COOKIE_M_N_FIELDS
};
enum cookie_manager_value {
- CM_HTTPS,
- CM_SECURE,
- CM_HTTP,
- CM_NONE,
- CM_NETSCAPE,
- CM_RFC2109,
- CM_RFC2965,
- CM_YES,
- CM_NO,
- N_VALUES
+ COOKIE_M_HTTPS,
+ COOKIE_M_SECURE,
+ COOKIE_M_HTTP,
+ COOKIE_M_NONE,
+ COOKIE_M_NETSCAPE,
+ COOKIE_M_RFC2109,
+ COOKIE_M_RFC2965,
+ COOKIE_M_YES,
+ COOKIE_M_NO,
+ COOKIE_M_N_VALUES
};
struct cookie_manager_folder {
@@ -65,8 +65,8 @@ struct cookie_manager_folder {
struct cookie_manager_ctx {
treeview *tree;
- struct treeview_field_desc fields[N_FIELDS];
- struct treeview_field_data values[N_VALUES];
+ struct treeview_field_desc fields[COOKIE_M_N_FIELDS];
+ struct treeview_field_data values[COOKIE_M_N_VALUES];
bool built;
};
struct cookie_manager_ctx cm_ctx;
@@ -76,7 +76,7 @@ struct cookie_manager_entry {
treeview_node *entry;
- struct treeview_field_data data[N_FIELDS - 1];
+ struct treeview_field_data data[COOKIE_M_N_FIELDS - 1];
};
@@ -95,9 +95,9 @@ static nserror cookie_manager_walk_cb(void *ctx, void *node_data,
if (type == TREE_NODE_ENTRY) {
struct cookie_manager_entry *entry = node_data;
- if (entry->data[CM_NAME].value_len == tw->title_len &&
+ if (entry->data[COOKIE_M_NAME].value_len == tw->title_len &&
strcmp(tw->title,
- entry->data[CM_NAME].value) == 0) {
+ entry->data[COOKIE_M_NAME].value) == 0) {
/* Found what we're looking for */
tw->entry = entry;
*abort = true;
@@ -187,12 +187,12 @@ static void cookie_manager_free_treeview_field_data(
struct cookie_manager_entry *e)
{
/* Eww */
- free((void *)e->data[CM_NAME].value);
- free((void *)e->data[CM_CONTENT].value);
- free((void *)e->data[CM_DOMAIN].value);
- free((void *)e->data[CM_PATH].value);
- free((void *)e->data[CM_EXPIRES].value);
- free((void *)e->data[CM_LAST_USED].value);
+ free((void *)e->data[COOKIE_M_NAME].value);
+ free((void *)e->data[COOKIE_M_CONTENT].value);
+ free((void *)e->data[COOKIE_M_DOMAIN].value);
+ free((void *)e->data[COOKIE_M_PATH].value);
+ free((void *)e->data[COOKIE_M_EXPIRES].value);
+ free((void *)e->data[COOKIE_M_LAST_USED].value);
}
@@ -235,14 +235,14 @@ static nserror cookie_manager_set_treeview_field_data(
assert(data != NULL);
/* Set the fields up */
- cookie_manager_field_builder(CM_NAME,
- &e->data[CM_NAME], strdup(data->name));
- cookie_manager_field_builder(CM_CONTENT,
- &e->data[CM_CONTENT], strdup(data->value));
- cookie_manager_field_builder(CM_DOMAIN,
- &e->data[CM_DOMAIN], strdup(data->domain));
- cookie_manager_field_builder(CM_PATH,
- &e->data[CM_PATH], strdup(data->path));
+ cookie_manager_field_builder(COOKIE_M_NAME,
+ &e->data[COOKIE_M_NAME], strdup(data->name));
+ cookie_manager_field_builder(COOKIE_M_CONTENT,
+ &e->data[COOKIE_M_CONTENT], strdup(data->value));
+ cookie_manager_field_builder(COOKIE_M_DOMAIN,
+ &e->data[COOKIE_M_DOMAIN], strdup(data->domain));
+ cookie_manager_field_builder(COOKIE_M_PATH,
+ &e->data[COOKIE_M_PATH], strdup(data->path));
/* Set the Expires date field */
date = ctime(&data->expires);
@@ -251,8 +251,8 @@ static nserror cookie_manager_set_treeview_field_data(
assert(date2[24] == '\n');
date2[24] = '\0';
}
- cookie_manager_field_builder(CM_EXPIRES,
- &e->data[CM_EXPIRES], date2);
+ cookie_manager_field_builder(COOKIE_M_EXPIRES,
+ &e->data[COOKIE_M_EXPIRES], date2);
/* Set the Last used date field */
date = ctime(&data->last_used);
@@ -261,37 +261,37 @@ static nserror cookie_manager_set_treeview_field_data(
assert(date2[24] == '\n');
date2[24] = '\0';
}
- cookie_manager_field_builder(CM_LAST_USED,
- &e->data[CM_LAST_USED], date2);
+ cookie_manager_field_builder(COOKIE_M_LAST_USED,
+ &e->data[COOKIE_M_LAST_USED], date2);
/* Set the Restrictions text */
if (data->secure && data->http_only)
- e->data[CM_RESTRICTIONS] = cm_ctx.values[CM_HTTPS];
+ e->data[COOKIE_M_RESTRICTIONS] = cm_ctx.values[COOKIE_M_HTTPS];
else if (data->secure)
- e->data[CM_RESTRICTIONS] = cm_ctx.values[CM_SECURE];
+ e->data[COOKIE_M_RESTRICTIONS] = cm_ctx.values[COOKIE_M_SECURE];
else if (data->http_only)
- e->data[CM_RESTRICTIONS] = cm_ctx.values[CM_HTTP];
+ e->data[COOKIE_M_RESTRICTIONS] = cm_ctx.values[COOKIE_M_HTTP];
else
- e->data[CM_RESTRICTIONS] = cm_ctx.values[CM_NONE];
+ e->data[COOKIE_M_RESTRICTIONS] = cm_ctx.values[COOKIE_M_NONE];
/* Set the Version text */
switch (data->version) {
case COOKIE_NETSCAPE:
- e->data[CM_VERSION] = cm_ctx.values[CM_NETSCAPE];
+ e->data[COOKIE_M_VERSION] = cm_ctx.values[COOKIE_M_NETSCAPE];
break;
case COOKIE_RFC2109:
- e->data[CM_VERSION] = cm_ctx.values[CM_RFC2109];
+ e->data[COOKIE_M_VERSION] = cm_ctx.values[COOKIE_M_RFC2109];
break;
case COOKIE_RFC2965:
- e->data[CM_VERSION] = cm_ctx.values[CM_RFC2965];
+ e->data[COOKIE_M_VERSION] = cm_ctx.values[COOKIE_M_RFC2965];
break;
}
/* Set the Persistent text */
if (data->no_destroy)
- e->data[CM_PERSISTENT] = cm_ctx.values[CM_YES];
+ e->data[COOKIE_M_PERSISTENT] = cm_ctx.values[COOKIE_M_YES];
else
- e->data[CM_PERSISTENT] = cm_ctx.values[CM_NO];
+ e->data[COOKIE_M_PERSISTENT] = cm_ctx.values[COOKIE_M_NO];
return NSERROR_OK;
}
@@ -404,7 +404,7 @@ static nserror cookie_manager_create_domain_folder(
return NSERROR_NOMEM;
}
- f->data.field = cm_ctx.fields[N_FIELDS - 1].field;
+ f->data.field = cm_ctx.fields[COOKIE_M_N_FIELDS - 1].field;
f->data.value = strdup(data->domain);
f->data.value_len = (f->data.value != NULL) ?
strlen(data->domain) : 0;
@@ -511,95 +511,95 @@ static nserror cookie_manager_init_entry_fields(void)
int i;
const char *label;
- for (i = 0; i < N_FIELDS; i++)
+ for (i = 0; i < COOKIE_M_N_FIELDS; i++)
cm_ctx.fields[i].field = NULL;
- cm_ctx.fields[CM_NAME].flags = TREE_FLAG_DEFAULT;
+ cm_ctx.fields[COOKIE_M_NAME].flags = TREE_FLAG_DEFAULT;
label = "TreeviewLabelName";
label = messages_get(label);
if (lwc_intern_string(label, strlen(label),
- &cm_ctx.fields[CM_NAME].field) !=
+ &cm_ctx.fields[COOKIE_M_NAME].field) !=
lwc_error_ok) {
goto error;
}
- cm_ctx.fields[CM_CONTENT].flags = TREE_FLAG_SHOW_NAME;
+ cm_ctx.fields[COOKIE_M_CONTENT].flags = TREE_FLAG_SHOW_NAME;
label = "TreeviewLabelContent";
label = messages_get(label);
if (lwc_intern_string(label, strlen(label),
- &cm_ctx.fields[CM_CONTENT].field) !=
+ &cm_ctx.fields[COOKIE_M_CONTENT].field) !=
lwc_error_ok) {
goto error;
}
- cm_ctx.fields[CM_DOMAIN].flags = TREE_FLAG_SHOW_NAME;
+ cm_ctx.fields[COOKIE_M_DOMAIN].flags = TREE_FLAG_SHOW_NAME;
label = "TreeviewLabelDomain";
label = messages_get(label);
if (lwc_intern_string(label, strlen(label),
- &cm_ctx.fields[CM_DOMAIN].field) !=
+ &cm_ctx.fields[COOKIE_M_DOMAIN].field) !=
lwc_error_ok) {
goto error;
}
- cm_ctx.fields[CM_PATH].flags = TREE_FLAG_SHOW_NAME;
+ cm_ctx.fields[COOKIE_M_PATH].flags = TREE_FLAG_SHOW_NAME;
label = "TreeviewLabelPath";
label = messages_get(label);
if (lwc_intern_string(label, strlen(label),
- &cm_ctx.fields[CM_PATH].field) !=
+ &cm_ctx.fields[COOKIE_M_PATH].field) !=
lwc_error_ok) {
goto error;
}
- cm_ctx.fields[CM_EXPIRES].flags = TREE_FLAG_SHOW_NAME;
+ cm_ctx.fields[COOKIE_M_EXPIRES].flags = TREE_FLAG_SHOW_NAME;
label = "TreeviewLabelExpires";
label = messages_get(label);
if (lwc_intern_string(label, strlen(label),
- &cm_ctx.fields[CM_EXPIRES].field) !=
+ &cm_ctx.fields[COOKIE_M_EXPIRES].field) !=
lwc_error_ok) {
goto error;
}
- cm_ctx.fields[CM_LAST_USED].flags = TREE_FLAG_SHOW_NAME;
+ cm_ctx.fields[COOKIE_M_LAST_USED].flags = TREE_FLAG_SHOW_NAME;
label = "TreeviewLabelLastUsed";
label = messages_get(label);
if (lwc_intern_string(label, strlen(label),
- &cm_ctx.fields[CM_LAST_USED].field) !=
+ &cm_ctx.fields[COOKIE_M_LAST_USED].field) !=
lwc_error_ok) {
goto error;
}
- cm_ctx.fields[CM_RESTRICTIONS].flags = TREE_FLAG_SHOW_NAME;
+ cm_ctx.fields[COOKIE_M_RESTRICTIONS].flags = TREE_FLAG_SHOW_NAME;
label = "TreeviewLabelRestrictions";
label = messages_get(label);
if (lwc_intern_string(label, strlen(label),
- &cm_ctx.fields[CM_RESTRICTIONS].field) !=
+ &cm_ctx.fields[COOKIE_M_RESTRICTIONS].field) !=
lwc_error_ok) {
goto error;
}
- cm_ctx.fields[CM_VERSION].flags = TREE_FLAG_SHOW_NAME;
+ cm_ctx.fields[COOKIE_M_VERSION].flags = TREE_FLAG_SHOW_NAME;
label = "TreeviewLabelVersion";
label = messages_get(label);
if (lwc_intern_string(label, strlen(label),
- &cm_ctx.fields[CM_VERSION].field) !=
+ &cm_ctx.fields[COOKIE_M_VERSION].field) !=
lwc_error_ok) {
goto error;
}
- cm_ctx.fields[CM_PERSISTENT].flags = TREE_FLAG_SHOW_NAME;
+ cm_ctx.fields[COOKIE_M_PERSISTENT].flags = TREE_FLAG_SHOW_NAME;
label = "TreeviewLabelPersistent";
label = messages_get(label);
if (lwc_intern_string(label, strlen(label),
- &cm_ctx.fields[CM_PERSISTENT].field) !=
+ &cm_ctx.fields[COOKIE_M_PERSISTENT].field) !=
lwc_error_ok) {
goto error;
}
- cm_ctx.fields[CM_DOMAIN_FOLDER].flags = TREE_FLAG_DEFAULT;
+ cm_ctx.fields[COOKIE_M_DOMAIN_FOLDER].flags = TREE_FLAG_DEFAULT;
label = "TreeviewLabelDomainFolder";
label = messages_get(label);
if (lwc_intern_string(label, strlen(label),
- &cm_ctx.fields[CM_DOMAIN_FOLDER].field) !=
+ &cm_ctx.fields[COOKIE_M_DOMAIN_FOLDER].field) !=
lwc_error_ok) {
return false;
}
@@ -607,7 +607,7 @@ static nserror cookie_manager_init_entry_fields(void)
return NSERROR_OK;
error:
- for (i = 0; i < N_FIELDS; i++)
+ for (i = 0; i < COOKIE_M_N_FIELDS; i++)
if (cm_ctx.fields[i].field != NULL)
lwc_string_unref(cm_ctx.fields[i].field);
@@ -627,45 +627,45 @@ static nserror cookie_manager_init_common_values(void)
/* Set the Restrictions text */
temp = messages_get("CookieManagerHTTPS");
- cookie_manager_field_builder(CM_RESTRICTIONS,
- &cm_ctx.values[CM_HTTPS], strdup(temp));
+ cookie_manager_field_builder(COOKIE_M_RESTRICTIONS,
+ &cm_ctx.values[COOKIE_M_HTTPS], strdup(temp));
temp = messages_get("CookieManagerSecure");
- cookie_manager_field_builder(CM_RESTRICTIONS,
- &cm_ctx.values[CM_SECURE], strdup(temp));
+ cookie_manager_field_builder(COOKIE_M_RESTRICTIONS,
+ &cm_ctx.values[COOKIE_M_SECURE], strdup(temp));
temp = messages_get("CookieManagerHTTP");
- cookie_manager_field_builder(CM_RESTRICTIONS,
- &cm_ctx.values[CM_HTTP], strdup(temp));
+ cookie_manager_field_builder(COOKIE_M_RESTRICTIONS,
+ &cm_ctx.values[COOKIE_M_HTTP], strdup(temp));
temp = messages_get("None");
- cookie_manager_field_builder(CM_RESTRICTIONS,
- &cm_ctx.values[CM_NONE], strdup(temp));
+ cookie_manager_field_builder(COOKIE_M_RESTRICTIONS,
+ &cm_ctx.values[COOKIE_M_NONE], strdup(temp));
/* Set the Cookie version text */
assert(COOKIE_NETSCAPE == 0);
temp = messages_get("TreeVersion0");
- cookie_manager_field_builder(CM_VERSION,
- &cm_ctx.values[CM_NETSCAPE], strdup(temp));
+ cookie_manager_field_builder(COOKIE_M_VERSION,
+ &cm_ctx.values[COOKIE_M_NETSCAPE], strdup(temp));
assert(COOKIE_RFC2109 == 1);
temp = messages_get("TreeVersion1");
- cookie_manager_field_builder(CM_VERSION,
- &cm_ctx.values[CM_RFC2109], strdup(temp));
+ cookie_manager_field_builder(COOKIE_M_VERSION,
+ &cm_ctx.values[COOKIE_M_RFC2109], strdup(temp));
assert(COOKIE_RFC2965 == 2);
temp = messages_get("TreeVersion2");
- cookie_manager_field_builder(CM_VERSION,
- &cm_ctx.values[CM_RFC2965], strdup(temp));
+ cookie_manager_field_builder(COOKIE_M_VERSION,
+ &cm_ctx.values[COOKIE_M_RFC2965], strdup(temp));
/* Set the Persistent value text */
temp = messages_get("Yes");
- cookie_manager_field_builder(CM_PERSISTENT,
- &cm_ctx.values[CM_YES], strdup(temp));
+ cookie_manager_field_builder(COOKIE_M_PERSISTENT,
+ &cm_ctx.values[COOKIE_M_YES], strdup(temp));
temp = messages_get("No");
- cookie_manager_field_builder(CM_PERSISTENT,
- &cm_ctx.values[CM_NO], strdup(temp));
+ cookie_manager_field_builder(COOKIE_M_PERSISTENT,
+ &cm_ctx.values[COOKIE_M_NO], strdup(temp));
return NSERROR_OK;
}
@@ -684,9 +684,9 @@ static void cookie_manager_delete_entry(struct cookie_manager_entry *e)
if (e->user_delete) {
/* Delete the cookie from URLdb */
- domain = e->data[CM_DOMAIN].value;
- path = e->data[CM_PATH].value;
- name = e->data[CM_NAME].value;
+ domain = e->data[COOKIE_M_DOMAIN].value;
+ path = e->data[COOKIE_M_PATH].value;
+ name = e->data[COOKIE_M_NAME].value;
if ((domain != NULL) && (path != NULL) && (name != NULL)) {
@@ -772,7 +772,7 @@ nserror cookie_manager_init(struct core_window_callback_table *cw_t,
/* Create the cookie manager treeview */
err = treeview_create(&cm_ctx.tree, &cm_tree_cb_t,
- N_FIELDS, cm_ctx.fields,
+ COOKIE_M_N_FIELDS, cm_ctx.fields,
cw_t, core_window_handle,
TREEVIEW_NO_MOVES | TREEVIEW_DEL_EMPTY_DIRS);
if (err != NSERROR_OK) {
@@ -808,12 +808,12 @@ nserror cookie_manager_fini(void)
err = treeview_destroy(cm_ctx.tree);
/* Free cookie manager treeview entry fields */
- for (i = 0; i < N_FIELDS; i++)
+ for (i = 0; i < COOKIE_M_N_FIELDS; i++)
if (cm_ctx.fields[i].field != NULL)
lwc_string_unref(cm_ctx.fields[i].field);
/* Free cookie manager treeview common entry values */
- for (i = 0; i < N_VALUES; i++)
+ for (i = 0; i < COOKIE_M_N_VALUES; i++)
if (cm_ctx.values[i].value != NULL)
free((void *) cm_ctx.values[i].value);
--
NetSurf Browser
10 years, 2 months
netsurf: branch master updated. release/3.0-347-g2bd587a
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/2bd587add5912c02db717...
...commit http://git.netsurf-browser.org/netsurf.git/commit/2bd587add5912c02db71746...
...tree http://git.netsurf-browser.org/netsurf.git/tree/2bd587add5912c02db71746e8...
The branch, master has been updated
via 2bd587add5912c02db71746e83eda47b66fb80af (commit)
via bb870de150eb3c38a76daa802c82a6383a483a1d (commit)
via f2476a1e208ee86484bafc79b93ba35386e55075 (commit)
via b0baa839e82f93223b3480f0c2d6ecfd27d819f8 (commit)
via 7bbcec90c42371c55ac2fe0601a94b605ff85bb7 (commit)
via 0d681fb38e72634dead365f6768dc7d21db758ae (commit)
via 44fa2a9b918ba93228f50b53a3366259da9d3886 (commit)
via 3f0e70706d3d4a28ec52d3b815f0a98125767848 (commit)
via f3a3272dd3f94c6c1b9e993dfe856c686d6960a0 (commit)
via 034d907a381e0d41c1879ffe6d8b5a931617dcd6 (commit)
via 92ee6e953ca205e4e7dc3848951ba50226cf7951 (commit)
via 219f5dac32ac2c4ca158785514cdcc35cb3f18bf (commit)
via 4697d1ccc1d6190788b931352b1e3a931dd0a0f7 (commit)
via 17abee0045e51b72a1dda9de0c187c71c252fc56 (commit)
via ba576ad5d6c7aa808dee631643a8ac878d3205cc (commit)
via a399e5aa703420854175d14a62b6a8edb3ba0c18 (commit)
via a4b5a8aed72aa8424749d905774056c761414150 (commit)
via ef05c2f6e696f7038b343283db7574d7f1c167e6 (commit)
via c6820e840236615c9253ce9e2e49b71b783404bf (commit)
via 81b4c61ae3ea36751ff7de240e50020c054f3ecb (commit)
via df2efd03c47f9604861991a820753d359ac00e93 (commit)
via 68078d7ea7bfe19320404b98cbdfc8f4585d6824 (commit)
via 01159ff5896f9ac2410832c1516bbbd5ff57ae0d (commit)
from dce3c8c170a7394e1114f19fc5aa68007eb61324 (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=2bd587add5912c02db7...
commit 2bd587add5912c02db71746e83eda47b66fb80af
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Make the parasitic hack of the old tree code more robust. Now if the temp_treeview_test option is set, the global history and cookie manager will be replaced with their respective new implementations.
diff --git a/content/urldb.c b/content/urldb.c
index f2f9c0a..feb7c6f 100644
--- a/content/urldb.c
+++ b/content/urldb.c
@@ -101,6 +101,7 @@
#include "content/content.h"
#include "content/urldb.h"
#include "desktop/cookies_old.h"
+#include "desktop/cookie_manager.h"
#include "utils/nsoption.h"
#include "utils/log.h"
#include "utils/corestrings.h"
@@ -2540,7 +2541,13 @@ char *urldb_get_cookie(nsurl *url, bool include_http_only)
version = c->version;
c->last_used = now;
- cookies_schedule_update((struct cookie_data *)c);
+
+ if (nsoption_bool(temp_treeview_test) == false)
+ cookies_schedule_update(
+ (struct cookie_data *)c);
+ else
+ cookie_manager_add(
+ (struct cookie_data *)c);
}
}
}
@@ -2575,7 +2582,13 @@ char *urldb_get_cookie(nsurl *url, bool include_http_only)
version = c->version;
c->last_used = now;
- cookies_schedule_update((struct cookie_data *)c);
+
+ if (nsoption_bool(temp_treeview_test) == false)
+ cookies_schedule_update(
+ (struct cookie_data *)c);
+ else
+ cookie_manager_add(
+ (struct cookie_data *)c);
}
}
@@ -2618,7 +2631,12 @@ char *urldb_get_cookie(nsurl *url, bool include_http_only)
version = c->version;
c->last_used = now;
- cookies_schedule_update((struct cookie_data *)c);
+
+ if (nsoption_bool(temp_treeview_test) == false)
+ cookies_schedule_update(
+ (struct cookie_data *)c);
+ else
+ cookie_manager_add((struct cookie_data *)c);
}
}
@@ -2651,7 +2669,12 @@ char *urldb_get_cookie(nsurl *url, bool include_http_only)
version = c->version;
c->last_used = now;
- cookies_schedule_update((struct cookie_data *)c);
+
+ if (nsoption_bool(temp_treeview_test) == false)
+ cookies_schedule_update(
+ (struct cookie_data *)c);
+ else
+ cookie_manager_add((struct cookie_data *)c);
}
}
@@ -3405,8 +3428,12 @@ bool urldb_insert_cookie(struct cookie_internal_data *c, lwc_string *scheme,
d->prev->next = d->next;
else
p->cookies = d->next;
-
- cookies_remove((struct cookie_data *)d);
+
+ if (nsoption_bool(temp_treeview_test) == false)
+ cookies_remove((struct cookie_data *)d);
+ else
+ cookie_manager_remove((struct cookie_data *)d);
+
urldb_free_cookie(d);
urldb_free_cookie(c);
} else {
@@ -3421,11 +3448,18 @@ bool urldb_insert_cookie(struct cookie_internal_data *c, lwc_string *scheme,
c->prev->next = c;
else
p->cookies = c;
-
- cookies_remove((struct cookie_data *)d);
+
+ if (nsoption_bool(temp_treeview_test) == false)
+ cookies_remove((struct cookie_data *)d);
+ else
+ cookie_manager_remove((struct cookie_data *)d);
urldb_free_cookie(d);
-
- cookies_schedule_update((struct cookie_data *)c);
+
+ if (nsoption_bool(temp_treeview_test) == false)
+ cookies_schedule_update(
+ (struct cookie_data *)c);
+ else
+ cookie_manager_add((struct cookie_data *)c);
}
} else {
c->prev = p->cookies_end;
@@ -3436,7 +3470,10 @@ bool urldb_insert_cookie(struct cookie_internal_data *c, lwc_string *scheme,
p->cookies = c;
p->cookies_end = c;
- cookies_schedule_update((struct cookie_data *)c);
+ if (nsoption_bool(temp_treeview_test) == false)
+ cookies_schedule_update((struct cookie_data *)c);
+ else
+ cookie_manager_add((struct cookie_data *)c);
}
return true;
diff --git a/desktop/cookies_old.c b/desktop/cookies_old.c
index 864fef6..0aaf61f 100644
--- a/desktop/cookies_old.c
+++ b/desktop/cookies_old.c
@@ -392,7 +392,7 @@ bool cookies_initialise(struct tree *tree, const char* folder_icon_name, const c
*/
unsigned int cookies_get_tree_flags(void)
{
- return TREE_DELETE_EMPTY_DIRS;
+ return TREE_DELETE_EMPTY_DIRS | TREE_COOKIES;
}
diff --git a/desktop/history_global_core.c b/desktop/history_global_core.c
index ce43830..b03485a 100644
--- a/desktop/history_global_core.c
+++ b/desktop/history_global_core.c
@@ -297,7 +297,7 @@ bool history_global_initialise(struct tree *tree, const char* folder_icon_name)
*/
unsigned int history_global_get_tree_flags(void)
{
- return TREE_NO_FLAGS;
+ return TREE_NO_FLAGS | TREE_HISTORY;
}
diff --git a/desktop/hotlist.c b/desktop/hotlist.c
index 055de3a..adc9e5f 100644
--- a/desktop/hotlist.c
+++ b/desktop/hotlist.c
@@ -189,7 +189,7 @@ bool hotlist_initialise(struct tree *tree, const char *hotlist_path,
*/
unsigned int hotlist_get_tree_flags(void)
{
- return TREE_MOVABLE;
+ return TREE_MOVABLE | TREE_HOTLIST;
}
diff --git a/desktop/sslcert.c b/desktop/sslcert.c
index 2b4d726..d5e7f6f 100644
--- a/desktop/sslcert.c
+++ b/desktop/sslcert.c
@@ -73,7 +73,7 @@ void sslcert_init(const char* icon_name)
*/
unsigned int sslcert_get_tree_flags(void)
{
- return TREE_NO_DRAGS | TREE_NO_SELECT;
+ return TREE_NO_DRAGS | TREE_NO_SELECT | TREE_SSLCERT;
}
diff --git a/desktop/tree.c b/desktop/tree.c
index 46910e7..7cac1cb 100644
--- a/desktop/tree.c
+++ b/desktop/tree.c
@@ -177,8 +177,11 @@ struct tree {
#include "desktop/treeview.h"
+#include "desktop/cookie_manager.h"
#include "desktop/global_history.h"
+int treeview_inits;
+
static void treeview_test_redraw_request(struct core_window *cw, struct rect r)
{
struct tree *tree = (struct tree *)cw;
@@ -238,10 +241,22 @@ static bool treeview_test_init(struct tree *tree)
if (nsoption_bool(temp_treeview_test) == false)
return false;
- treeview_init();
- err = global_history_init(&cw_t, (struct core_window *)tree);
- if (err != NSERROR_OK) {
- warn_user("Duffed it.", 0);
+ treeview_inits++;
+
+ if (treeview_inits == 1)
+ treeview_init();
+
+ if (tree->flags & TREE_COOKIES) {
+ err = cookie_manager_init(&cw_t, (struct core_window *)tree);
+ if (err != NSERROR_OK) {
+ warn_user("Couldn't init new cookie manager.", 0);
+ }
+ }
+ if (tree->flags & 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);
+ }
}
return true;
@@ -254,12 +269,23 @@ static bool treeview_test_fini(struct tree *tree)
if (nsoption_bool(temp_treeview_test) == false)
return false;
- err = global_history_fini();
- treeview_fini();
- if (err != NSERROR_OK) {
- warn_user("Duffed it.", 0);
+ if (tree->flags & TREE_COOKIES) {
+ err = cookie_manager_fini();
+ if (err != NSERROR_OK) {
+ warn_user("Couldn't finalise cookie manager.", 0);
+ }
+ }
+ if (tree->flags & TREE_HISTORY) {
+ err = global_history_fini();
+ if (err != NSERROR_OK) {
+ warn_user("Couldn't finalise cookie manager.", 0);
+ }
}
+ if (treeview_inits == 1)
+ treeview_fini();
+ treeview_inits--;
+
return true;
}
@@ -277,9 +303,16 @@ static bool treeview_test_redraw(struct tree *tree, int x, int y,
clip.x1 = clip_x + clip_width;
clip.y1 = clip_y + clip_height;
- global_history_redraw(x, y, &clip, ctx);
+ if (tree->flags & TREE_COOKIES) {
+ cookie_manager_redraw(x, y, &clip, ctx);
+ return true;
+ }
+ if (tree->flags & TREE_HISTORY) {
+ global_history_redraw(x, y, &clip, ctx);
+ return true;
+ }
- return true;
+ return false;
}
static bool treeview_test_mouse_action(struct tree *tree,
@@ -288,9 +321,16 @@ static bool treeview_test_mouse_action(struct tree *tree,
if (nsoption_bool(temp_treeview_test) == false)
return false;
- global_history_mouse_action(mouse, x, y);
+ if (tree->flags & TREE_COOKIES) {
+ cookie_manager_mouse_action(mouse, x, y);
+ return true;
+ }
+ if (tree->flags & TREE_HISTORY) {
+ global_history_mouse_action(mouse, x, y);
+ return true;
+ }
- return true;
+ return false;
}
static bool treeview_test_keypress(struct tree *tree, uint32_t key)
@@ -298,9 +338,16 @@ static bool treeview_test_keypress(struct tree *tree, uint32_t key)
if (nsoption_bool(temp_treeview_test) == false)
return false;
- global_history_keypress(key);
+ if (tree->flags & TREE_COOKIES) {
+ cookie_manager_keypress(key);
+ return true;
+ }
+ if (tree->flags & TREE_HISTORY) {
+ global_history_keypress(key);
+ return true;
+ }
- return true;
+ return false;
}
@@ -420,9 +467,7 @@ struct tree *tree_create(unsigned int flags,
tree_setup_colours();
- if (flags == TREE_MOVABLE) {
- treeview_test_init(tree);
- }
+ treeview_test_init(tree);
return tree;
}
@@ -1267,9 +1312,7 @@ void tree_delete(struct tree *tree)
{
tree->redraw = false;
- if (tree->flags == TREE_MOVABLE) {
- treeview_test_fini(tree);
- }
+ treeview_test_fini(tree);
if (tree->root->child != NULL)
tree_delete_node_internal(tree, tree->root->child, true);
@@ -2196,11 +2239,9 @@ void tree_draw(struct tree *tree, int x, int y,
assert(tree != NULL);
assert(tree->root != NULL);
- if (tree->flags == TREE_MOVABLE) {
- if (treeview_test_redraw(tree, x, y, clip_x, clip_y,
- clip_width, clip_height, ctx)) {
- return;
- }
+ if (treeview_test_redraw(tree, x, y, clip_x, clip_y,
+ clip_width, clip_height, ctx)) {
+ return;
}
/* Start knockout rendering if it's available for this plotter */
@@ -2567,10 +2608,8 @@ bool tree_mouse_action(struct tree *tree, browser_mouse_state mouse, int x,
assert(tree != NULL);
assert(tree->root != NULL);
- if (tree->flags == TREE_MOVABLE) {
- if (treeview_test_mouse_action(tree, mouse, x, y)) {
- return true;
- }
+ if (treeview_test_mouse_action(tree, mouse, x, y)) {
+ return true;
}
if (tree->root->child == NULL)
@@ -3026,10 +3065,8 @@ void tree_drag_end(struct tree *tree, browser_mouse_state mouse, int x0, int y0,
*/
bool tree_keypress(struct tree *tree, uint32_t key)
{
- if (tree->flags == TREE_MOVABLE) {
- if (treeview_test_keypress(tree, key)) {
- return true;
- }
+ if (treeview_test_keypress(tree, key)) {
+ return true;
}
if (tree->editing != NULL)
diff --git a/desktop/tree.h b/desktop/tree.h
index 20ade30..7074f60 100644
--- a/desktop/tree.h
+++ b/desktop/tree.h
@@ -45,6 +45,11 @@ enum tree_flags {
* directory will be deleted
* too.
*/
+ /* The following are to aid transition to new treeviews */
+ TREE_HISTORY = 64,
+ TREE_COOKIES = 128,
+ TREE_SSLCERT = 256,
+ TREE_HOTLIST = 512
};
/** A "flag" value to indicate the element data contains title
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=bb870de150eb3c38a76...
commit bb870de150eb3c38a76daa802c82a6383a483a1d
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Move remaining string literals over to FatMessages.
diff --git a/desktop/cookie_manager.c b/desktop/cookie_manager.c
index a38cafb..c35251e 100644
--- a/desktop/cookie_manager.c
+++ b/desktop/cookie_manager.c
@@ -626,20 +626,19 @@ static nserror cookie_manager_init_common_values(void)
const char *temp;
/* Set the Restrictions text */
- /* TODO: use messages */
- temp = "Secure hosts via https only";
+ temp = messages_get("CookieManagerHTTPS");
cookie_manager_field_builder(CM_RESTRICTIONS,
&cm_ctx.values[CM_HTTPS], strdup(temp));
- temp = "Secure hosts only";
+ temp = messages_get("CookieManagerSecure");
cookie_manager_field_builder(CM_RESTRICTIONS,
&cm_ctx.values[CM_SECURE], strdup(temp));
- temp = "HTTP connections only";
+ temp = messages_get("CookieManagerHTTP");
cookie_manager_field_builder(CM_RESTRICTIONS,
&cm_ctx.values[CM_HTTP], strdup(temp));
- temp = "None";
+ temp = messages_get("None");
cookie_manager_field_builder(CM_RESTRICTIONS,
&cm_ctx.values[CM_NONE], strdup(temp));
diff --git a/resources/FatMessages b/resources/FatMessages
index 25c53a7..49486b5 100644
--- a/resources/FatMessages
+++ b/resources/FatMessages
@@ -1214,6 +1214,25 @@ it.all.TreeviewLabelDomainFolder:Domain folder
nl.all.TreeviewLabelDomainFolder:Domain folder
+# Cookie Manager field values
+#
+en.all.CookieManagerHTTPS:Secure hosts via https only
+de.all.CookieManagerHTTPS:Secure hosts via https only
+fr.all.CookieManagerHTTPS:Secure hosts via https only
+it.all.CookieManagerHTTPS:Secure hosts via https only
+nl.all.CookieManagerHTTPS:Secure hosts via https only
+en.all.CookieManagerSecure:Secure hosts only
+de.all.CookieManagerSecure:Secure hosts only
+fr.all.CookieManagerSecure:Secure hosts only
+it.all.CookieManagerSecure:Secure hosts only
+nl.all.CookieManagerSecure:Secure hosts only
+en.all.CookieManagerHTTP:HTTP connections only
+de.all.CookieManagerHTTP:HTTP connections only
+fr.all.CookieManagerHTTP:HTTP connections only
+it.all.CookieManagerHTTP:HTTP connections only
+nl.all.CookieManagerHTTP:HTTP connections only
+
+
# Tree export
#
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=f2476a1e208ee86484b...
commit f2476a1e208ee86484bafc79b93ba35386e55075
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Yield ownership of value to field builder, since date strings were already allocated.
diff --git a/desktop/cookie_manager.c b/desktop/cookie_manager.c
index 6772d72..a38cafb 100644
--- a/desktop/cookie_manager.c
+++ b/desktop/cookie_manager.c
@@ -201,7 +201,7 @@ static void cookie_manager_free_treeview_field_data(
*
* \param field Cookie manager treeview field to build
* \param data Cookie manager entry field data to set
- * \param value Text to set in field
+ * \param value Text to set in field, ownership yielded
* \return NSERROR_OK on success, appropriate error otherwise
*/
static inline nserror cookie_manager_field_builder(
@@ -210,7 +210,7 @@ static inline nserror cookie_manager_field_builder(
const char *value)
{
data->field = cm_ctx.fields[field].field;
- data->value = strdup(value);
+ data->value = value;
data->value_len = (value != NULL) ? strlen(value) : 0;
return NSERROR_OK;
@@ -236,13 +236,13 @@ static nserror cookie_manager_set_treeview_field_data(
/* Set the fields up */
cookie_manager_field_builder(CM_NAME,
- &e->data[CM_NAME], data->name);
+ &e->data[CM_NAME], strdup(data->name));
cookie_manager_field_builder(CM_CONTENT,
- &e->data[CM_CONTENT], data->value);
+ &e->data[CM_CONTENT], strdup(data->value));
cookie_manager_field_builder(CM_DOMAIN,
- &e->data[CM_DOMAIN], data->domain);
+ &e->data[CM_DOMAIN], strdup(data->domain));
cookie_manager_field_builder(CM_PATH,
- &e->data[CM_PATH], data->path);
+ &e->data[CM_PATH], strdup(data->path));
/* Set the Expires date field */
date = ctime(&data->expires);
@@ -629,44 +629,44 @@ static nserror cookie_manager_init_common_values(void)
/* TODO: use messages */
temp = "Secure hosts via https only";
cookie_manager_field_builder(CM_RESTRICTIONS,
- &cm_ctx.values[CM_HTTPS], temp);
+ &cm_ctx.values[CM_HTTPS], strdup(temp));
temp = "Secure hosts only";
cookie_manager_field_builder(CM_RESTRICTIONS,
- &cm_ctx.values[CM_SECURE], temp);
+ &cm_ctx.values[CM_SECURE], strdup(temp));
temp = "HTTP connections only";
cookie_manager_field_builder(CM_RESTRICTIONS,
- &cm_ctx.values[CM_HTTP], temp);
+ &cm_ctx.values[CM_HTTP], strdup(temp));
temp = "None";
cookie_manager_field_builder(CM_RESTRICTIONS,
- &cm_ctx.values[CM_NONE], temp);
+ &cm_ctx.values[CM_NONE], strdup(temp));
/* Set the Cookie version text */
assert(COOKIE_NETSCAPE == 0);
temp = messages_get("TreeVersion0");
cookie_manager_field_builder(CM_VERSION,
- &cm_ctx.values[CM_NETSCAPE], temp);
+ &cm_ctx.values[CM_NETSCAPE], strdup(temp));
assert(COOKIE_RFC2109 == 1);
temp = messages_get("TreeVersion1");
cookie_manager_field_builder(CM_VERSION,
- &cm_ctx.values[CM_RFC2109], temp);
+ &cm_ctx.values[CM_RFC2109], strdup(temp));
assert(COOKIE_RFC2965 == 2);
temp = messages_get("TreeVersion2");
cookie_manager_field_builder(CM_VERSION,
- &cm_ctx.values[CM_RFC2965], temp);
+ &cm_ctx.values[CM_RFC2965], strdup(temp));
/* Set the Persistent value text */
temp = messages_get("Yes");
cookie_manager_field_builder(CM_PERSISTENT,
- &cm_ctx.values[CM_YES], temp);
+ &cm_ctx.values[CM_YES], strdup(temp));
temp = messages_get("No");
cookie_manager_field_builder(CM_PERSISTENT,
- &cm_ctx.values[CM_NO], temp);
+ &cm_ctx.values[CM_NO], strdup(temp));
return NSERROR_OK;
}
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=b0baa839e82f93223b3...
commit b0baa839e82f93223b3480f0c2d6ecfd27d819f8
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Avoid snprintf and having buffer on stack.
diff --git a/desktop/cookie_manager.c b/desktop/cookie_manager.c
index 80af935..6772d72 100644
--- a/desktop/cookie_manager.c
+++ b/desktop/cookie_manager.c
@@ -623,7 +623,6 @@ error:
*/
static nserror cookie_manager_init_common_values(void)
{
- char buffer[24];
const char *temp;
/* Set the Restrictions text */
@@ -645,18 +644,18 @@ static nserror cookie_manager_init_common_values(void)
&cm_ctx.values[CM_NONE], temp);
/* Set the Cookie version text */
- snprintf(buffer, sizeof(buffer), "TreeVersion%i", COOKIE_NETSCAPE);
- temp = messages_get(buffer);
+ assert(COOKIE_NETSCAPE == 0);
+ temp = messages_get("TreeVersion0");
cookie_manager_field_builder(CM_VERSION,
&cm_ctx.values[CM_NETSCAPE], temp);
- snprintf(buffer, sizeof(buffer), "TreeVersion%i", COOKIE_RFC2109);
- temp = messages_get(buffer);
+ assert(COOKIE_RFC2109 == 1);
+ temp = messages_get("TreeVersion1");
cookie_manager_field_builder(CM_VERSION,
&cm_ctx.values[CM_RFC2109], temp);
- snprintf(buffer, sizeof(buffer), "TreeVersion%i", COOKIE_RFC2965);
- temp = messages_get(buffer);
+ assert(COOKIE_RFC2965 == 2);
+ temp = messages_get("TreeVersion2");
cookie_manager_field_builder(CM_VERSION,
&cm_ctx.values[CM_RFC2965], temp);
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=7bbcec90c42371c55ac...
commit 7bbcec90c42371c55ac2fe0601a94b605ff85bb7
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Use prefabricated field text for common values.
diff --git a/desktop/cookie_manager.c b/desktop/cookie_manager.c
index f5d3ab3..80af935 100644
--- a/desktop/cookie_manager.c
+++ b/desktop/cookie_manager.c
@@ -45,6 +45,19 @@ enum cookie_manager_field {
N_FIELDS
};
+enum cookie_manager_value {
+ CM_HTTPS,
+ CM_SECURE,
+ CM_HTTP,
+ CM_NONE,
+ CM_NETSCAPE,
+ CM_RFC2109,
+ CM_RFC2965,
+ CM_YES,
+ CM_NO,
+ N_VALUES
+};
+
struct cookie_manager_folder {
treeview_node *folder;
struct treeview_field_data data;
@@ -53,6 +66,7 @@ struct cookie_manager_folder {
struct cookie_manager_ctx {
treeview *tree;
struct treeview_field_desc fields[N_FIELDS];
+ struct treeview_field_data values[N_VALUES];
bool built;
};
struct cookie_manager_ctx cm_ctx;
@@ -179,9 +193,6 @@ static void cookie_manager_free_treeview_field_data(
free((void *)e->data[CM_PATH].value);
free((void *)e->data[CM_EXPIRES].value);
free((void *)e->data[CM_LAST_USED].value);
- free((void *)e->data[CM_RESTRICTIONS].value);
- free((void *)e->data[CM_VERSION].value);
- free((void *)e->data[CM_PERSISTENT].value);
}
@@ -189,17 +200,15 @@ static void cookie_manager_free_treeview_field_data(
* Build a cookie manager treeview field from given text
*
* \param field Cookie manager treeview field to build
- * \param e Cookie manager entry to set the field in
+ * \param data Cookie manager entry field data to set
* \param value Text to set in field
* \return NSERROR_OK on success, appropriate error otherwise
*/
static inline nserror cookie_manager_field_builder(
enum cookie_manager_field field,
- struct cookie_manager_entry *e,
+ struct treeview_field_data *data,
const char *value)
{
- struct treeview_field_data *data = &e->data[field];
-
data->field = cm_ctx.fields[field].field;
data->value = strdup(value);
data->value_len = (value != NULL) ? strlen(value) : 0;
@@ -219,19 +228,21 @@ static nserror cookie_manager_set_treeview_field_data(
struct cookie_manager_entry *e,
const struct cookie_data *data)
{
- const char *temp;
const char *date;
char *date2;
- char buffer[32];
assert(e != NULL);
assert(data != NULL);
/* Set the fields up */
- cookie_manager_field_builder(CM_NAME, e, data->name);
- cookie_manager_field_builder(CM_CONTENT, e, data->value);
- cookie_manager_field_builder(CM_DOMAIN, e, data->domain);
- cookie_manager_field_builder(CM_PATH, e, data->path);
+ cookie_manager_field_builder(CM_NAME,
+ &e->data[CM_NAME], data->name);
+ cookie_manager_field_builder(CM_CONTENT,
+ &e->data[CM_CONTENT], data->value);
+ cookie_manager_field_builder(CM_DOMAIN,
+ &e->data[CM_DOMAIN], data->domain);
+ cookie_manager_field_builder(CM_PATH,
+ &e->data[CM_PATH], data->path);
/* Set the Expires date field */
date = ctime(&data->expires);
@@ -240,7 +251,8 @@ static nserror cookie_manager_set_treeview_field_data(
assert(date2[24] == '\n');
date2[24] = '\0';
}
- cookie_manager_field_builder(CM_EXPIRES, e, date2);
+ cookie_manager_field_builder(CM_EXPIRES,
+ &e->data[CM_EXPIRES], date2);
/* Set the Last used date field */
date = ctime(&data->last_used);
@@ -249,29 +261,37 @@ static nserror cookie_manager_set_treeview_field_data(
assert(date2[24] == '\n');
date2[24] = '\0';
}
- cookie_manager_field_builder(CM_LAST_USED, e, date2);
+ cookie_manager_field_builder(CM_LAST_USED,
+ &e->data[CM_LAST_USED], date2);
/* Set the Restrictions text */
- /* TODO: use messages */
if (data->secure && data->http_only)
- temp = "Secure hosts via https only";
+ e->data[CM_RESTRICTIONS] = cm_ctx.values[CM_HTTPS];
else if (data->secure)
- temp = "Secure hosts only";
+ e->data[CM_RESTRICTIONS] = cm_ctx.values[CM_SECURE];
else if (data->http_only)
- temp = "HTTP connections only";
+ e->data[CM_RESTRICTIONS] = cm_ctx.values[CM_HTTP];
else
- temp = "None";
-
- cookie_manager_field_builder(CM_RESTRICTIONS, e, temp);
+ e->data[CM_RESTRICTIONS] = cm_ctx.values[CM_NONE];
/* Set the Version text */
- snprintf(buffer, sizeof(buffer), "TreeVersion%i", data->version);
- temp = messages_get(buffer);
- cookie_manager_field_builder(CM_VERSION, e, temp);
+ switch (data->version) {
+ case COOKIE_NETSCAPE:
+ e->data[CM_VERSION] = cm_ctx.values[CM_NETSCAPE];
+ break;
+ case COOKIE_RFC2109:
+ e->data[CM_VERSION] = cm_ctx.values[CM_RFC2109];
+ break;
+ case COOKIE_RFC2965:
+ e->data[CM_VERSION] = cm_ctx.values[CM_RFC2965];
+ break;
+ }
/* Set the Persistent text */
- temp = data->no_destroy ? messages_get("Yes") : messages_get("No");
- cookie_manager_field_builder(CM_PERSISTENT, e, temp);
+ if (data->no_destroy)
+ e->data[CM_PERSISTENT] = cm_ctx.values[CM_YES];
+ else
+ e->data[CM_PERSISTENT] = cm_ctx.values[CM_NO];
return NSERROR_OK;
}
@@ -594,6 +614,65 @@ error:
return NSERROR_UNKNOWN;
}
+
+
+/**
+ * Initialise the common entry values
+ *
+ * \return true on success, false on memory exhaustion
+ */
+static nserror cookie_manager_init_common_values(void)
+{
+ char buffer[24];
+ const char *temp;
+
+ /* Set the Restrictions text */
+ /* TODO: use messages */
+ temp = "Secure hosts via https only";
+ cookie_manager_field_builder(CM_RESTRICTIONS,
+ &cm_ctx.values[CM_HTTPS], temp);
+
+ temp = "Secure hosts only";
+ cookie_manager_field_builder(CM_RESTRICTIONS,
+ &cm_ctx.values[CM_SECURE], temp);
+
+ temp = "HTTP connections only";
+ cookie_manager_field_builder(CM_RESTRICTIONS,
+ &cm_ctx.values[CM_HTTP], temp);
+
+ temp = "None";
+ cookie_manager_field_builder(CM_RESTRICTIONS,
+ &cm_ctx.values[CM_NONE], temp);
+
+ /* Set the Cookie version text */
+ snprintf(buffer, sizeof(buffer), "TreeVersion%i", COOKIE_NETSCAPE);
+ temp = messages_get(buffer);
+ cookie_manager_field_builder(CM_VERSION,
+ &cm_ctx.values[CM_NETSCAPE], temp);
+
+ snprintf(buffer, sizeof(buffer), "TreeVersion%i", COOKIE_RFC2109);
+ temp = messages_get(buffer);
+ cookie_manager_field_builder(CM_VERSION,
+ &cm_ctx.values[CM_RFC2109], temp);
+
+ snprintf(buffer, sizeof(buffer), "TreeVersion%i", COOKIE_RFC2965);
+ temp = messages_get(buffer);
+ cookie_manager_field_builder(CM_VERSION,
+ &cm_ctx.values[CM_RFC2965], temp);
+
+ /* Set the Persistent value text */
+ temp = messages_get("Yes");
+ cookie_manager_field_builder(CM_PERSISTENT,
+ &cm_ctx.values[CM_YES], temp);
+
+ temp = messages_get("No");
+ cookie_manager_field_builder(CM_PERSISTENT,
+ &cm_ctx.values[CM_NO], temp);
+
+ return NSERROR_OK;
+}
+
+
/**
* Delete cookie manager entries (and optionally delete from urldb)
*
@@ -686,6 +765,13 @@ nserror cookie_manager_init(struct core_window_callback_table *cw_t,
return err;
}
+ /* Init. common treeview field values */
+ err = cookie_manager_init_common_values();
+ if (err != NSERROR_OK) {
+ cm_ctx.tree = NULL;
+ return err;
+ }
+
/* Create the cookie manager treeview */
err = treeview_create(&cm_ctx.tree, &cm_tree_cb_t,
N_FIELDS, cm_ctx.fields,
@@ -728,6 +814,11 @@ nserror cookie_manager_fini(void)
if (cm_ctx.fields[i].field != NULL)
lwc_string_unref(cm_ctx.fields[i].field);
+ /* Free cookie manager treeview common entry values */
+ for (i = 0; i < N_VALUES; i++)
+ if (cm_ctx.values[i].value != NULL)
+ free((void *) cm_ctx.values[i].value);
+
LOG(("Finalised cookie manager"));
return err;
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=0d681fb38e72634dead...
commit 0d681fb38e72634dead365f6768dc7d21db758ae
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Log old cookie manager init timings for comparison.
diff --git a/desktop/cookies_old.c b/desktop/cookies_old.c
index 37b251e..864fef6 100644
--- a/desktop/cookies_old.c
+++ b/desktop/cookies_old.c
@@ -365,6 +365,8 @@ bool cookies_initialise(struct tree *tree, const char* folder_icon_name, const c
if (tree == NULL)
return false;
+ LOG(("Making cookie tree"));
+
folder_icon = tree_load_icon(folder_icon_name);
cookie_icon = tree_load_icon(cookie_icon_name);
@@ -377,6 +379,8 @@ bool cookies_initialise(struct tree *tree, const char* folder_icon_name, const c
tree_set_node_expanded(cookies_tree, cookies_tree_root,
false, true, true);
+ LOG(("Made cookie tree"));
+
return true;
}
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=44fa2a9b918ba93228f...
commit 44fa2a9b918ba93228f50b53a3366259da9d3886
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Optimise cookie tolder and entry node search by comparing lengths before strings.
diff --git a/desktop/cookie_manager.c b/desktop/cookie_manager.c
index e9e7b29..f5d3ab3 100644
--- a/desktop/cookie_manager.c
+++ b/desktop/cookie_manager.c
@@ -68,6 +68,7 @@ struct cookie_manager_entry {
struct treeview_walk_ctx {
const char *title;
+ size_t title_len;
struct cookie_manager_folder *folder;
struct cookie_manager_entry *entry;
};
@@ -80,7 +81,9 @@ static nserror cookie_manager_walk_cb(void *ctx, void *node_data,
if (type == TREE_NODE_ENTRY) {
struct cookie_manager_entry *entry = node_data;
- if (strcmp(tw->title, entry->data[CM_NAME].value) == 0) {
+ if (entry->data[CM_NAME].value_len == tw->title_len &&
+ strcmp(tw->title,
+ entry->data[CM_NAME].value) == 0) {
/* Found what we're looking for */
tw->entry = entry;
*abort = true;
@@ -89,7 +92,8 @@ static nserror cookie_manager_walk_cb(void *ctx, void *node_data,
} else if (type == TREE_NODE_FOLDER) {
struct cookie_manager_folder *folder = node_data;
- if (strcmp(tw->title, folder->data.value) == 0) {
+ if (folder->data.value_len == tw->title_len &&
+ strcmp(tw->title, folder->data.value) == 0) {
/* Found what we're looking for */
tw->folder = folder;
*abort = true;
@@ -103,15 +107,18 @@ static nserror cookie_manager_walk_cb(void *ctx, void *node_data,
*
* \param root Search root node, or NULL to search from tree's root
* \param title ID of the node to look for
+ * \param title_len Byte length of title string
* \param found Updated to the matching node's cookie maanger entry
* \return NSERROR_OK on success, appropriate error otherwise
*/
static nserror cookie_manager_find_entry(treeview_node *root,
- const char *title, struct cookie_manager_entry **found)
+ const char *title, size_t title_len,
+ struct cookie_manager_entry **found)
{
nserror err;
struct treeview_walk_ctx tw = {
.title = title,
+ .title_len = title_len,
.folder = NULL,
.entry = NULL
};
@@ -130,15 +137,18 @@ static nserror cookie_manager_find_entry(treeview_node *root,
*
* \param root Search root node, or NULL to search from tree's root
* \param title ID of the node to look for
+ * \param title_len Byte length of title string
* \param found Updated to the matching node's cookie maanger folder
* \return NSERROR_OK on success, appropriate error otherwise
*/
static nserror cookie_manager_find_folder(treeview_node *root,
- const char *title, struct cookie_manager_folder **found)
+ const char *title, size_t title_len,
+ struct cookie_manager_folder **found)
{
nserror err;
struct treeview_walk_ctx tw = {
.title = title,
+ .title_len = title_len,
.folder = NULL,
.entry = NULL
};
@@ -408,7 +418,8 @@ bool cookie_manager_add(const struct cookie_data *data)
if (cm_ctx.tree == NULL)
return true;
- err = cookie_manager_find_folder(NULL, data->domain, &parent);
+ err = cookie_manager_find_folder(NULL, data->domain,
+ strlen(data->domain), &parent);
if (err != NSERROR_OK) {
return false;
}
@@ -421,7 +432,8 @@ bool cookie_manager_add(const struct cookie_data *data)
}
/* Create cookie node */
- err = cookie_manager_find_entry(parent->folder, data->name, &cookie);
+ err = cookie_manager_find_entry(parent->folder, data->name,
+ strlen(data->name), &cookie);
if (err != NSERROR_OK)
return false;
@@ -450,13 +462,15 @@ void cookie_manager_remove(const struct cookie_data *data)
if (cm_ctx.tree == NULL)
return;
- err = cookie_manager_find_folder(NULL, data->domain, &parent);
+ err = cookie_manager_find_folder(NULL, data->domain,
+ strlen(data->domain), &parent);
if (err != NSERROR_OK || parent == NULL) {
/* Nothing to delete */
return;
}
- err = cookie_manager_find_entry(parent->folder, data->name, &cookie);
+ err = cookie_manager_find_entry(parent->folder, data->name,
+ strlen(data->name), &cookie);
if (err != NSERROR_OK || cookie == NULL) {
/* Nothing to delete */
return;
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=3f0e70706d3d4a28ec5...
commit 3f0e70706d3d4a28ec52d3b815f0a98125767848
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Abstract field building.
diff --git a/desktop/cookie_manager.c b/desktop/cookie_manager.c
index 49fc172..e9e7b29 100644
--- a/desktop/cookie_manager.c
+++ b/desktop/cookie_manager.c
@@ -31,7 +31,7 @@
#include "utils/utils.h"
#include "utils/log.h"
-enum cookie_manager_fields {
+enum cookie_manager_field {
CM_NAME,
CM_CONTENT,
CM_DOMAIN,
@@ -176,6 +176,29 @@ static void cookie_manager_free_treeview_field_data(
/**
+ * Build a cookie manager treeview field from given text
+ *
+ * \param field Cookie manager treeview field to build
+ * \param e Cookie manager entry to set the field in
+ * \param value Text to set in field
+ * \return NSERROR_OK on success, appropriate error otherwise
+ */
+static inline nserror cookie_manager_field_builder(
+ enum cookie_manager_field field,
+ struct cookie_manager_entry *e,
+ const char *value)
+{
+ struct treeview_field_data *data = &e->data[field];
+
+ data->field = cm_ctx.fields[field].field;
+ data->value = strdup(value);
+ data->value_len = (value != NULL) ? strlen(value) : 0;
+
+ return NSERROR_OK;
+}
+
+
+/**
* Set a cookie manager entry's data from the cookie_data.
*
* \param e Cookie manager entry to set up
@@ -194,57 +217,29 @@ static nserror cookie_manager_set_treeview_field_data(
assert(e != NULL);
assert(data != NULL);
- /* Set the Name text */
- temp = data->name;
- e->data[CM_NAME].field = cm_ctx.fields[CM_NAME].field;
- e->data[CM_NAME].value = strdup(temp);
- e->data[CM_NAME].value_len = (e->data[CM_NAME].value != NULL) ?
- strlen(temp) : 0;
-
- /* Set the Content text */
- temp = data->value;
- e->data[CM_CONTENT].field = cm_ctx.fields[CM_CONTENT].field;
- e->data[CM_CONTENT].value = strdup(temp);
- e->data[CM_CONTENT].value_len = (e->data[CM_CONTENT].value != NULL) ?
- strlen(temp) : 0;
-
- /* Set the Domain text */
- temp = data->domain;
- e->data[CM_DOMAIN].field = cm_ctx.fields[CM_DOMAIN].field;
- e->data[CM_DOMAIN].value = strdup(temp);
- e->data[CM_DOMAIN].value_len = (e->data[CM_DOMAIN].value != NULL) ?
- strlen(temp) : 0;
-
- /* Set the Path text */
- temp = data->path;
- e->data[CM_PATH].field = cm_ctx.fields[CM_PATH].field;
- e->data[CM_PATH].value = strdup(temp);
- e->data[CM_PATH].value_len = (e->data[CM_PATH].value != NULL) ?
- strlen(temp) : 0;
-
- /* Set the Expires date text */
+ /* Set the fields up */
+ cookie_manager_field_builder(CM_NAME, e, data->name);
+ cookie_manager_field_builder(CM_CONTENT, e, data->value);
+ cookie_manager_field_builder(CM_DOMAIN, e, data->domain);
+ cookie_manager_field_builder(CM_PATH, e, data->path);
+
+ /* Set the Expires date field */
date = ctime(&data->expires);
date2 = strdup(date);
if (date2 != NULL) {
assert(date2[24] == '\n');
date2[24] = '\0';
}
+ cookie_manager_field_builder(CM_EXPIRES, e, date2);
- e->data[CM_EXPIRES].field = cm_ctx.fields[CM_EXPIRES].field;
- e->data[CM_EXPIRES].value = date2;
- e->data[CM_EXPIRES].value_len = (date2 != NULL) ? 24 : 0;
-
- /* Set the Last used date text */
+ /* Set the Last used date field */
date = ctime(&data->last_used);
date2 = strdup(date);
if (date2 != NULL) {
assert(date2[24] == '\n');
date2[24] = '\0';
}
-
- e->data[CM_LAST_USED].field = cm_ctx.fields[CM_LAST_USED].field;
- e->data[CM_LAST_USED].value = date2;
- e->data[CM_LAST_USED].value_len = (date2 != NULL) ? 24 : 0;
+ cookie_manager_field_builder(CM_LAST_USED, e, date2);
/* Set the Restrictions text */
/* TODO: use messages */
@@ -257,27 +252,16 @@ static nserror cookie_manager_set_treeview_field_data(
else
temp = "None";
- e->data[CM_RESTRICTIONS].field = cm_ctx.fields[CM_RESTRICTIONS].field;
- e->data[CM_RESTRICTIONS].value = strdup(temp);
- e->data[CM_RESTRICTIONS].value_len =
- (e->data[CM_RESTRICTIONS].value != NULL) ?
- strlen(temp) : 0;
+ cookie_manager_field_builder(CM_RESTRICTIONS, e, temp);
/* Set the Version text */
snprintf(buffer, sizeof(buffer), "TreeVersion%i", data->version);
temp = messages_get(buffer);
- e->data[CM_VERSION].field = cm_ctx.fields[CM_VERSION].field;
- e->data[CM_VERSION].value = strdup(temp);
- e->data[CM_VERSION].value_len = (e->data[CM_VERSION].value != NULL) ?
- strlen(temp) : 0;
+ cookie_manager_field_builder(CM_VERSION, e, temp);
/* Set the Persistent text */
temp = data->no_destroy ? messages_get("Yes") : messages_get("No");
- e->data[CM_PERSISTENT].field = cm_ctx.fields[CM_PERSISTENT].field;
- e->data[CM_PERSISTENT].value = strdup(temp);
- e->data[CM_PERSISTENT].value_len =
- (e->data[CM_PERSISTENT].value != NULL) ?
- strlen(temp) : 0;
+ cookie_manager_field_builder(CM_PERSISTENT, e, temp);
return NSERROR_OK;
}
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=f3a3272dd3f94c6c1b9...
commit f3a3272dd3f94c6c1b9e993dfe856c686d6960a0
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Flag a todo. (Move some string literals to messages.)
diff --git a/desktop/cookie_manager.c b/desktop/cookie_manager.c
index 0ec32b4..49fc172 100644
--- a/desktop/cookie_manager.c
+++ b/desktop/cookie_manager.c
@@ -247,6 +247,7 @@ static nserror cookie_manager_set_treeview_field_data(
e->data[CM_LAST_USED].value_len = (date2 != NULL) ? 24 : 0;
/* Set the Restrictions text */
+ /* TODO: use messages */
if (data->secure && data->http_only)
temp = "Secure hosts via https only";
else if (data->secure)
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=034d907a381e0d41c18...
commit 034d907a381e0d41c1879ffe6d8b5a931617dcd6
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Add messages for new treeview.
diff --git a/resources/FatMessages b/resources/FatMessages
index 4e7c0b0..25c53a7 100644
--- a/resources/FatMessages
+++ b/resources/FatMessages
@@ -1162,6 +1162,58 @@ fr.all.TreeviewLabelPeriod:Period
it.all.TreeviewLabelPeriod:Period
nl.all.TreeviewLabelPeriod:Period
+en.all.TreeviewLabelName:Name
+de.all.TreeviewLabelName:Name
+fr.all.TreeviewLabelName:Name
+it.all.TreeviewLabelName:Name
+nl.all.TreeviewLabelName:Name
+en.all.TreeviewLabelContent:Content
+de.all.TreeviewLabelContent:Content
+fr.all.TreeviewLabelContent:Content
+it.all.TreeviewLabelContent:Content
+nl.all.TreeviewLabelContent:Content
+en.all.TreeviewLabelDomain:Domain
+de.all.TreeviewLabelDomain:Domain
+fr.all.TreeviewLabelDomain:Domain
+it.all.TreeviewLabelDomain:Domain
+nl.all.TreeviewLabelDomain:Domain
+en.all.TreeviewLabelPath:Path
+de.all.TreeviewLabelPath:Path
+fr.all.TreeviewLabelPath:Path
+it.all.TreeviewLabelPath:Path
+nl.all.TreeviewLabelPath:Path
+en.all.TreeviewLabelExpires:Expires
+de.all.TreeviewLabelExpires:Expires
+fr.all.TreeviewLabelExpires:Expires
+it.all.TreeviewLabelExpires:Expires
+nl.all.TreeviewLabelExpires:Expires
+en.all.TreeviewLabelLastUsed:Last used
+de.all.TreeviewLabelLastUsed:Last used
+fr.all.TreeviewLabelLastUsed:Last used
+it.all.TreeviewLabelLastUsed:Last used
+nl.all.TreeviewLabelLastUsed:Last used
+en.all.TreeviewLabelRestrictions:Restrictions
+de.all.TreeviewLabelRestrictions:Restrictions
+fr.all.TreeviewLabelRestrictions:Restrictions
+it.all.TreeviewLabelRestrictions:Restrictions
+nl.all.TreeviewLabelRestrictions:Restrictions
+en.all.TreeviewLabelVersion:Version
+de.all.TreeviewLabelVersion:Version
+fr.all.TreeviewLabelVersion:Version
+it.all.TreeviewLabelVersion:Version
+nl.all.TreeviewLabelVersion:Version
+en.all.TreeviewLabelPersistent:Persistent
+de.all.TreeviewLabelPersistent:Persistent
+fr.all.TreeviewLabelPersistent:Persistent
+it.all.TreeviewLabelPersistent:Persistent
+nl.all.TreeviewLabelPersistent:Persistent
+en.all.TreeviewLabelDomainFolder:Domain folder
+de.all.TreeviewLabelDomainFolder:Domain folder
+fr.all.TreeviewLabelDomainFolder:Domain folder
+it.all.TreeviewLabelDomainFolder:Domain folder
+nl.all.TreeviewLabelDomainFolder:Domain folder
+
+
# Tree export
#
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=92ee6e953ca205e4e7d...
commit 92ee6e953ca205e4e7dc3848951ba50226cf7951
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Build new cookie manager.
diff --git a/desktop/Makefile b/desktop/Makefile
index 1c62f1a..90ca5e0 100644
--- a/desktop/Makefile
+++ b/desktop/Makefile
@@ -1,6 +1,6 @@
# Sources for desktop
-S_DESKTOP := cookies_old.c history_global_core.c hotlist.c knockout.c \
+S_DESKTOP := cookie_manager.c cookies_old.c history_global_core.c hotlist.c knockout.c \
mouse.c plot_style.c print.c search.c searchweb.c \
scrollbar.c sslcert.c textarea.c thumbnail.c tree.c \
tree_url_node.c version.c system_colour.c global_history.c treeview.c
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=219f5dac32ac2c4ca15...
commit 219f5dac32ac2c4ca158785514cdcc35cb3f18bf
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Add initial version of new cookie manager.
diff --git a/desktop/cookie_manager.c b/desktop/cookie_manager.c
new file mode 100644
index 0000000..0ec32b4
--- /dev/null
+++ b/desktop/cookie_manager.c
@@ -0,0 +1,758 @@
+/*
+ * Copyright 2013 Michael Drake <tlsa(a)netsurf-browser.org>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** \file
+ * Cookie Manager (implementation).
+ */
+
+
+#include <stdlib.h>
+
+#include "content/urldb.h"
+#include "desktop/browser.h"
+#include "desktop/cookie_manager.h"
+#include "desktop/treeview.h"
+#include "utils/messages.h"
+#include "utils/utils.h"
+#include "utils/log.h"
+
+enum cookie_manager_fields {
+ CM_NAME,
+ CM_CONTENT,
+ CM_DOMAIN,
+ CM_PATH,
+ CM_EXPIRES,
+ CM_LAST_USED,
+ CM_RESTRICTIONS,
+ CM_VERSION,
+ CM_PERSISTENT,
+ CM_DOMAIN_FOLDER,
+ N_FIELDS
+};
+
+struct cookie_manager_folder {
+ treeview_node *folder;
+ struct treeview_field_data data;
+};
+
+struct cookie_manager_ctx {
+ treeview *tree;
+ struct treeview_field_desc fields[N_FIELDS];
+ bool built;
+};
+struct cookie_manager_ctx cm_ctx;
+
+struct cookie_manager_entry {
+ bool user_delete;
+
+ treeview_node *entry;
+
+ struct treeview_field_data data[N_FIELDS - 1];
+};
+
+
+struct treeview_walk_ctx {
+ const char *title;
+ struct cookie_manager_folder *folder;
+ struct cookie_manager_entry *entry;
+};
+/** Callback for treeview_walk */
+static nserror cookie_manager_walk_cb(void *ctx, void *node_data,
+ enum treeview_node_type type, bool *abort)
+{
+ struct treeview_walk_ctx *tw = ctx;
+
+ if (type == TREE_NODE_ENTRY) {
+ struct cookie_manager_entry *entry = node_data;
+
+ if (strcmp(tw->title, entry->data[CM_NAME].value) == 0) {
+ /* Found what we're looking for */
+ tw->entry = entry;
+ *abort = true;
+ }
+
+ } else if (type == TREE_NODE_FOLDER) {
+ struct cookie_manager_folder *folder = node_data;
+
+ if (strcmp(tw->title, folder->data.value) == 0) {
+ /* Found what we're looking for */
+ tw->folder = folder;
+ *abort = true;
+ }
+ }
+
+ return NSERROR_OK;
+}
+/**
+ * Find a cookie entry in the cookie manager's treeview
+ *
+ * \param root Search root node, or NULL to search from tree's root
+ * \param title ID of the node to look for
+ * \param found Updated to the matching node's cookie maanger entry
+ * \return NSERROR_OK on success, appropriate error otherwise
+ */
+static nserror cookie_manager_find_entry(treeview_node *root,
+ const char *title, struct cookie_manager_entry **found)
+{
+ nserror err;
+ struct treeview_walk_ctx tw = {
+ .title = title,
+ .folder = NULL,
+ .entry = NULL
+ };
+
+ err = treeview_walk(cm_ctx.tree, root, cookie_manager_walk_cb, &tw,
+ TREE_NODE_ENTRY);
+ if (err != NSERROR_OK)
+ return err;
+
+ *found = tw.entry;
+
+ return NSERROR_OK;
+}
+/**
+ * Find a cookie domain folder in the cookie manager's treeview
+ *
+ * \param root Search root node, or NULL to search from tree's root
+ * \param title ID of the node to look for
+ * \param found Updated to the matching node's cookie maanger folder
+ * \return NSERROR_OK on success, appropriate error otherwise
+ */
+static nserror cookie_manager_find_folder(treeview_node *root,
+ const char *title, struct cookie_manager_folder **found)
+{
+ nserror err;
+ struct treeview_walk_ctx tw = {
+ .title = title,
+ .folder = NULL,
+ .entry = NULL
+ };
+
+ err = treeview_walk(cm_ctx.tree, root, cookie_manager_walk_cb, &tw,
+ TREE_NODE_FOLDER);
+ if (err != NSERROR_OK)
+ return err;
+
+ *found = tw.folder;
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * Free a cookie manager entry's treeview field data.
+ *
+ * \param e Cookie manager entry to free data from
+ */
+static void cookie_manager_free_treeview_field_data(
+ struct cookie_manager_entry *e)
+{
+ /* Eww */
+ free((void *)e->data[CM_NAME].value);
+ free((void *)e->data[CM_CONTENT].value);
+ free((void *)e->data[CM_DOMAIN].value);
+ free((void *)e->data[CM_PATH].value);
+ free((void *)e->data[CM_EXPIRES].value);
+ free((void *)e->data[CM_LAST_USED].value);
+ free((void *)e->data[CM_RESTRICTIONS].value);
+ free((void *)e->data[CM_VERSION].value);
+ free((void *)e->data[CM_PERSISTENT].value);
+}
+
+
+/**
+ * Set a cookie manager entry's data from the cookie_data.
+ *
+ * \param e Cookie manager entry to set up
+ * \param data Data associated with entry's cookie
+ * \return NSERROR_OK on success, appropriate error otherwise
+ */
+static nserror cookie_manager_set_treeview_field_data(
+ struct cookie_manager_entry *e,
+ const struct cookie_data *data)
+{
+ const char *temp;
+ const char *date;
+ char *date2;
+ char buffer[32];
+
+ assert(e != NULL);
+ assert(data != NULL);
+
+ /* Set the Name text */
+ temp = data->name;
+ e->data[CM_NAME].field = cm_ctx.fields[CM_NAME].field;
+ e->data[CM_NAME].value = strdup(temp);
+ e->data[CM_NAME].value_len = (e->data[CM_NAME].value != NULL) ?
+ strlen(temp) : 0;
+
+ /* Set the Content text */
+ temp = data->value;
+ e->data[CM_CONTENT].field = cm_ctx.fields[CM_CONTENT].field;
+ e->data[CM_CONTENT].value = strdup(temp);
+ e->data[CM_CONTENT].value_len = (e->data[CM_CONTENT].value != NULL) ?
+ strlen(temp) : 0;
+
+ /* Set the Domain text */
+ temp = data->domain;
+ e->data[CM_DOMAIN].field = cm_ctx.fields[CM_DOMAIN].field;
+ e->data[CM_DOMAIN].value = strdup(temp);
+ e->data[CM_DOMAIN].value_len = (e->data[CM_DOMAIN].value != NULL) ?
+ strlen(temp) : 0;
+
+ /* Set the Path text */
+ temp = data->path;
+ e->data[CM_PATH].field = cm_ctx.fields[CM_PATH].field;
+ e->data[CM_PATH].value = strdup(temp);
+ e->data[CM_PATH].value_len = (e->data[CM_PATH].value != NULL) ?
+ strlen(temp) : 0;
+
+ /* Set the Expires date text */
+ date = ctime(&data->expires);
+ date2 = strdup(date);
+ if (date2 != NULL) {
+ assert(date2[24] == '\n');
+ date2[24] = '\0';
+ }
+
+ e->data[CM_EXPIRES].field = cm_ctx.fields[CM_EXPIRES].field;
+ e->data[CM_EXPIRES].value = date2;
+ e->data[CM_EXPIRES].value_len = (date2 != NULL) ? 24 : 0;
+
+ /* Set the Last used date text */
+ date = ctime(&data->last_used);
+ date2 = strdup(date);
+ if (date2 != NULL) {
+ assert(date2[24] == '\n');
+ date2[24] = '\0';
+ }
+
+ e->data[CM_LAST_USED].field = cm_ctx.fields[CM_LAST_USED].field;
+ e->data[CM_LAST_USED].value = date2;
+ e->data[CM_LAST_USED].value_len = (date2 != NULL) ? 24 : 0;
+
+ /* Set the Restrictions text */
+ if (data->secure && data->http_only)
+ temp = "Secure hosts via https only";
+ else if (data->secure)
+ temp = "Secure hosts only";
+ else if (data->http_only)
+ temp = "HTTP connections only";
+ else
+ temp = "None";
+
+ e->data[CM_RESTRICTIONS].field = cm_ctx.fields[CM_RESTRICTIONS].field;
+ e->data[CM_RESTRICTIONS].value = strdup(temp);
+ e->data[CM_RESTRICTIONS].value_len =
+ (e->data[CM_RESTRICTIONS].value != NULL) ?
+ strlen(temp) : 0;
+
+ /* Set the Version text */
+ snprintf(buffer, sizeof(buffer), "TreeVersion%i", data->version);
+ temp = messages_get(buffer);
+ e->data[CM_VERSION].field = cm_ctx.fields[CM_VERSION].field;
+ e->data[CM_VERSION].value = strdup(temp);
+ e->data[CM_VERSION].value_len = (e->data[CM_VERSION].value != NULL) ?
+ strlen(temp) : 0;
+
+ /* Set the Persistent text */
+ temp = data->no_destroy ? messages_get("Yes") : messages_get("No");
+ e->data[CM_PERSISTENT].field = cm_ctx.fields[CM_PERSISTENT].field;
+ e->data[CM_PERSISTENT].value = strdup(temp);
+ e->data[CM_PERSISTENT].value_len =
+ (e->data[CM_PERSISTENT].value != NULL) ?
+ strlen(temp) : 0;
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * Creates an empty tree entry for a cookie, and links it into the tree.
+ *
+ * All information is copied from the cookie_data, and as such can
+ * be edited and should be freed.
+ *
+ * \param parent the node to link to
+ * \param data the cookie data to use
+ * \return NSERROR_OK on success, appropriate error otherwise
+ */
+static nserror cookie_manager_create_cookie_node(
+ struct cookie_manager_folder *parent,
+ const struct cookie_data *data)
+{
+ nserror err;
+ struct cookie_manager_entry *cookie;
+
+ /* Create new cookie manager entry */
+ cookie = malloc(sizeof(struct cookie_manager_entry));
+ if (cookie == NULL) {
+ return NSERROR_NOMEM;
+ }
+
+ cookie->user_delete = false;
+
+ err = cookie_manager_set_treeview_field_data(cookie, data);
+ if (err != NSERROR_OK) {
+ free(cookie);
+ return err;
+ }
+
+ err = treeview_create_node_entry(cm_ctx.tree, &(cookie->entry),
+ parent->folder, TREE_REL_FIRST_CHILD,
+ cookie->data, cookie,
+ cm_ctx.built ? TREE_CREATE_NONE :
+ TREE_CREATE_SUPPRESS_RESIZE);
+ if (err != NSERROR_OK) {
+ cookie_manager_free_treeview_field_data(cookie);
+ free(cookie);
+ return err;
+ }
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * Updates a cookie manager entry for updated cookie_data.
+ *
+ * All information is copied from the cookie_data, and as such can
+ * be edited and should be freed.
+ *
+ * \param e the entry to update
+ * \param data the cookie data to use
+ * \return NSERROR_OK on success, appropriate error otherwise
+ */
+static nserror cookie_manager_update_cookie_node(
+ struct cookie_manager_entry *e,
+ const struct cookie_data *data)
+{
+ nserror err;
+
+ assert(e != NULL);
+
+ /* Reset to defaults */
+ e->user_delete = false;
+ cookie_manager_free_treeview_field_data(e);
+
+ /* Set new field values from the cookie_data */
+ err = cookie_manager_set_treeview_field_data(e, data);
+ if (err != NSERROR_OK) {
+ return err;
+ }
+
+ /* Update the treeview */
+ err = treeview_update_node_entry(cm_ctx.tree, e->entry, e->data, e);
+ if (err != NSERROR_OK) {
+ return err;
+ }
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * Creates an empty tree folder for a cookie domain, and links it into the tree.
+ *
+ * All information is copied from the cookie_data, and as such can
+ * be edited and should be freed.
+ *
+ * \param folder updated to the new folder
+ * \param data the cookie data to use
+ * \return NSERROR_OK on success, appropriate error otherwise
+ */
+static nserror cookie_manager_create_domain_folder(
+ struct cookie_manager_folder **folder,
+ const struct cookie_data *data)
+{
+ nserror err;
+ struct cookie_manager_folder *f;
+
+ /* Create new cookie manager entry */
+ f = malloc(sizeof(struct cookie_manager_folder));
+ if (f == NULL) {
+ return NSERROR_NOMEM;
+ }
+
+ f->data.field = cm_ctx.fields[N_FIELDS - 1].field;
+ f->data.value = strdup(data->domain);
+ f->data.value_len = (f->data.value != NULL) ?
+ strlen(data->domain) : 0;
+
+ err = treeview_create_node_folder(cm_ctx.tree, &(f->folder),
+ NULL, TREE_REL_FIRST_CHILD, &f->data, f,
+ cm_ctx.built ? TREE_CREATE_NONE :
+ TREE_CREATE_SUPPRESS_RESIZE);
+ if (err != NSERROR_OK) {
+ free((void *)f->data.value);
+ free(f);
+ return err;
+ }
+
+ *folder = f;
+
+ return NSERROR_OK;
+}
+
+
+/* exported interface documented in cookie_manager.h */
+bool cookie_manager_add(const struct cookie_data *data)
+{
+ struct cookie_manager_folder *parent = NULL;
+ struct cookie_manager_entry *cookie = NULL;
+ nserror err;
+
+ assert(data != NULL);
+
+ /* If we don't have a cookie manager at the moment, just return true */
+ if (cm_ctx.tree == NULL)
+ return true;
+
+ err = cookie_manager_find_folder(NULL, data->domain, &parent);
+ if (err != NSERROR_OK) {
+ return false;
+ }
+
+ if (parent == NULL) {
+ /* Need to create domain directory */
+ err = cookie_manager_create_domain_folder(&parent, data);
+ if (err != NSERROR_OK || parent == NULL)
+ return false;
+ }
+
+ /* Create cookie node */
+ err = cookie_manager_find_entry(parent->folder, data->name, &cookie);
+ if (err != NSERROR_OK)
+ return false;
+
+ if (cookie == NULL) {
+ err = cookie_manager_create_cookie_node(parent, data);
+ } else {
+ err = cookie_manager_update_cookie_node(cookie, data);
+ }
+ if (err != NSERROR_OK)
+ return false;
+
+ return true;
+}
+
+
+/* exported interface documented in cookie_manager.h */
+void cookie_manager_remove(const struct cookie_data *data)
+{
+ struct cookie_manager_folder *parent = NULL;
+ struct cookie_manager_entry *cookie = NULL;
+ nserror err;
+
+ assert(data != NULL);
+
+ /* If we don't have a cookie manager at the moment, just return */
+ if (cm_ctx.tree == NULL)
+ return;
+
+ err = cookie_manager_find_folder(NULL, data->domain, &parent);
+ if (err != NSERROR_OK || parent == NULL) {
+ /* Nothing to delete */
+ return;
+ }
+
+ err = cookie_manager_find_entry(parent->folder, data->name, &cookie);
+ if (err != NSERROR_OK || cookie == NULL) {
+ /* Nothing to delete */
+ return;
+ }
+
+ /* Delete the node */
+ treeview_delete_node(cm_ctx.tree, cookie->entry);
+}
+
+
+/**
+ * Initialise the treeview entry feilds
+ *
+ * \return true on success, false on memory exhaustion
+ */
+static nserror cookie_manager_init_entry_fields(void)
+{
+ int i;
+ const char *label;
+
+ for (i = 0; i < N_FIELDS; i++)
+ cm_ctx.fields[i].field = NULL;
+
+ cm_ctx.fields[CM_NAME].flags = TREE_FLAG_DEFAULT;
+ label = "TreeviewLabelName";
+ label = messages_get(label);
+ if (lwc_intern_string(label, strlen(label),
+ &cm_ctx.fields[CM_NAME].field) !=
+ lwc_error_ok) {
+ goto error;
+ }
+
+ cm_ctx.fields[CM_CONTENT].flags = TREE_FLAG_SHOW_NAME;
+ label = "TreeviewLabelContent";
+ label = messages_get(label);
+ if (lwc_intern_string(label, strlen(label),
+ &cm_ctx.fields[CM_CONTENT].field) !=
+ lwc_error_ok) {
+ goto error;
+ }
+
+ cm_ctx.fields[CM_DOMAIN].flags = TREE_FLAG_SHOW_NAME;
+ label = "TreeviewLabelDomain";
+ label = messages_get(label);
+ if (lwc_intern_string(label, strlen(label),
+ &cm_ctx.fields[CM_DOMAIN].field) !=
+ lwc_error_ok) {
+ goto error;
+ }
+
+ cm_ctx.fields[CM_PATH].flags = TREE_FLAG_SHOW_NAME;
+ label = "TreeviewLabelPath";
+ label = messages_get(label);
+ if (lwc_intern_string(label, strlen(label),
+ &cm_ctx.fields[CM_PATH].field) !=
+ lwc_error_ok) {
+ goto error;
+ }
+
+ cm_ctx.fields[CM_EXPIRES].flags = TREE_FLAG_SHOW_NAME;
+ label = "TreeviewLabelExpires";
+ label = messages_get(label);
+ if (lwc_intern_string(label, strlen(label),
+ &cm_ctx.fields[CM_EXPIRES].field) !=
+ lwc_error_ok) {
+ goto error;
+ }
+
+ cm_ctx.fields[CM_LAST_USED].flags = TREE_FLAG_SHOW_NAME;
+ label = "TreeviewLabelLastUsed";
+ label = messages_get(label);
+ if (lwc_intern_string(label, strlen(label),
+ &cm_ctx.fields[CM_LAST_USED].field) !=
+ lwc_error_ok) {
+ goto error;
+ }
+
+ cm_ctx.fields[CM_RESTRICTIONS].flags = TREE_FLAG_SHOW_NAME;
+ label = "TreeviewLabelRestrictions";
+ label = messages_get(label);
+ if (lwc_intern_string(label, strlen(label),
+ &cm_ctx.fields[CM_RESTRICTIONS].field) !=
+ lwc_error_ok) {
+ goto error;
+ }
+
+ cm_ctx.fields[CM_VERSION].flags = TREE_FLAG_SHOW_NAME;
+ label = "TreeviewLabelVersion";
+ label = messages_get(label);
+ if (lwc_intern_string(label, strlen(label),
+ &cm_ctx.fields[CM_VERSION].field) !=
+ lwc_error_ok) {
+ goto error;
+ }
+
+ cm_ctx.fields[CM_PERSISTENT].flags = TREE_FLAG_SHOW_NAME;
+ label = "TreeviewLabelPersistent";
+ label = messages_get(label);
+ if (lwc_intern_string(label, strlen(label),
+ &cm_ctx.fields[CM_PERSISTENT].field) !=
+ lwc_error_ok) {
+ goto error;
+ }
+
+ cm_ctx.fields[CM_DOMAIN_FOLDER].flags = TREE_FLAG_DEFAULT;
+ label = "TreeviewLabelDomainFolder";
+ label = messages_get(label);
+ if (lwc_intern_string(label, strlen(label),
+ &cm_ctx.fields[CM_DOMAIN_FOLDER].field) !=
+ lwc_error_ok) {
+ return false;
+ }
+
+ return NSERROR_OK;
+
+error:
+ for (i = 0; i < N_FIELDS; i++)
+ if (cm_ctx.fields[i].field != NULL)
+ lwc_string_unref(cm_ctx.fields[i].field);
+
+ return NSERROR_UNKNOWN;
+}
+
+/**
+ * Delete cookie manager entries (and optionally delete from urldb)
+ *
+ * \param e Cookie manager entry to delete.
+ */
+static void cookie_manager_delete_entry(struct cookie_manager_entry *e)
+{
+ const char *domain;
+ const char *path;
+ const char *name;
+
+ if (e->user_delete) {
+ /* Delete the cookie from URLdb */
+ domain = e->data[CM_DOMAIN].value;
+ path = e->data[CM_PATH].value;
+ name = e->data[CM_NAME].value;
+
+ if ((domain != NULL) && (path != NULL) && (name != NULL)) {
+
+ urldb_delete_cookie(domain, path, name);
+ } else {
+ LOG(("Delete cookie fail: "
+ "need domain, path, and name."));
+ }
+ }
+
+ /* Delete the cookie manager entry */
+ cookie_manager_free_treeview_field_data(e);
+ free(e);
+}
+
+
+static nserror cookie_manager_tree_node_folder_cb(
+ struct treeview_node_msg msg, void *data)
+{
+ struct cookie_manager_folder *f = data;
+
+ switch (msg.msg) {
+ case TREE_MSG_NODE_DELETE:
+ free(f);
+ break;
+
+ case TREE_MSG_NODE_EDIT:
+ break;
+
+ case TREE_MSG_NODE_LAUNCH:
+ break;
+ }
+
+ return NSERROR_OK;
+}
+static nserror cookie_manager_tree_node_entry_cb(
+ struct treeview_node_msg msg, void *data)
+{
+ struct cookie_manager_entry *e = data;
+
+ switch (msg.msg) {
+ case TREE_MSG_NODE_DELETE:
+ e->entry = NULL;
+ e->user_delete = msg.data.delete.user;
+ cookie_manager_delete_entry(e);
+ break;
+
+ case TREE_MSG_NODE_EDIT:
+ break;
+
+ case TREE_MSG_NODE_LAUNCH:
+ break;
+ }
+ return NSERROR_OK;
+}
+struct treeview_callback_table cm_tree_cb_t = {
+ .folder = cookie_manager_tree_node_folder_cb,
+ .entry = cookie_manager_tree_node_entry_cb
+};
+
+
+/* Exported interface, documented in cookie_manager.h */
+nserror cookie_manager_init(struct core_window_callback_table *cw_t,
+ void *core_window_handle)
+{
+ nserror err;
+
+ LOG(("Generating cookie manager data"));
+
+ /* Init. cookie manager treeview entry fields */
+ err = cookie_manager_init_entry_fields();
+ if (err != NSERROR_OK) {
+ cm_ctx.tree = NULL;
+ return err;
+ }
+
+ /* Create the cookie manager treeview */
+ err = treeview_create(&cm_ctx.tree, &cm_tree_cb_t,
+ N_FIELDS, cm_ctx.fields,
+ cw_t, core_window_handle,
+ TREEVIEW_NO_MOVES | TREEVIEW_DEL_EMPTY_DIRS);
+ if (err != NSERROR_OK) {
+ cm_ctx.tree = NULL;
+ return err;
+ }
+
+ /* Load the cookies */
+ urldb_iterate_cookies(cookie_manager_add);
+
+ /* Cookie manager is built
+ * We suppress the treeview height callback on entry insertion before
+ * the treeview is built. */
+ cm_ctx.built = true;
+
+ LOG(("Generated cookie manager data"));
+
+ return NSERROR_OK;
+}
+
+
+/* Exported interface, documented in cookie_manager.h */
+nserror cookie_manager_fini(void)
+{
+ int i;
+ nserror err;
+
+ LOG(("Finalising cookie manager"));
+
+ cm_ctx.built = false;
+
+ /* Destroy the cookie manager treeview */
+ err = treeview_destroy(cm_ctx.tree);
+
+ /* Free cookie manager treeview entry fields */
+ for (i = 0; i < N_FIELDS; i++)
+ if (cm_ctx.fields[i].field != NULL)
+ lwc_string_unref(cm_ctx.fields[i].field);
+
+ LOG(("Finalised cookie manager"));
+
+ return err;
+}
+
+
+/* Exported interface, documented in cookie_manager.h */
+void cookie_manager_redraw(int x, int y, struct rect *clip,
+ const struct redraw_context *ctx)
+{
+ treeview_redraw(cm_ctx.tree, x, y, clip, ctx);
+}
+
+
+/* Exported interface, documented in cookie_manager.h */
+void cookie_manager_mouse_action(browser_mouse_state mouse, int x, int y)
+{
+ treeview_mouse_action(cm_ctx.tree, mouse, x, y);
+}
+
+
+/* Exported interface, documented in cookie_manager.h */
+void cookie_manager_keypress(uint32_t key)
+{
+ treeview_keypress(cm_ctx.tree, key);
+}
+
diff --git a/desktop/cookie_manager.h b/desktop/cookie_manager.h
new file mode 100644
index 0000000..7249236
--- /dev/null
+++ b/desktop/cookie_manager.h
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2013 Michael Drake <tlsa(a)netsurf-browser.org>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** \file
+ * Cookie Manager (interface).
+ */
+
+#ifndef _NETSURF_DESKTOP_COOKIE_MANAGER_H_
+#define _NETSURF_DESKTOP_COOKIE_MANAGER_H_
+
+#include <stdbool.h>
+
+#include "desktop/core_window.h"
+
+struct cookie_data;
+
+/**
+ * Initialise the cookie manager.
+ *
+ * This iterates through the URL database, enumerating the cookies and
+ * creates a treeview.
+ *
+ * This must be called before any other cookie_manager_* function.
+ *
+ * \param cw_t Callback table for core_window containing the treeview
+ * \param cw The core_window in which the treeview is shown
+ * \return NSERROR_OK on success, appropriate error otherwise
+ */
+nserror cookie_manager_init(struct core_window_callback_table *cw_t,
+ void *core_window_handle);
+
+/**
+ * Finalise the cookie manager.
+ *
+ * This destroys the cookie manager treeview and the cookie manager module's
+ * internal data. After calling this if the cookie manager is required again,
+ * cookie_manager_init must be called.
+ *
+ * \return NSERROR_OK on success, appropriate error otherwise
+ */
+nserror cookie_manager_fini(void);
+
+/**
+ * Add/update a cookie to the viewer. (Called by urldb.)
+ *
+ * \param data Data of cookie being added/updated.
+ * \return true (for urldb_iterate_entries)
+ */
+bool cookie_manager_add(const struct cookie_data *data);
+
+/**
+ * Remove a cookie from viewer. (Called by urldb.)
+ *
+ * \param data Data of cookie being removed.
+ */
+void cookie_manager_remove(const struct cookie_data *data);
+
+/**
+ * Redraw the cookies manager.
+ *
+ * \param x X coordinate to render treeview at
+ * \param x Y coordinate to render treeview at
+ * \param clip Current clip rectangle (wrt tree origin)
+ * \param ctx Current redraw context
+ */
+void cookie_manager_redraw(int x, int y, struct rect *clip,
+ const struct redraw_context *ctx);
+
+/**
+ * Handles all kinds of mouse action
+ *
+ * \param mouse The current mouse state
+ * \param x X coordinate
+ * \param y Y coordinate
+ */
+void cookie_manager_mouse_action(browser_mouse_state mouse, int x, int y);
+
+
+/**
+ * Key press handling.
+ *
+ * \param key The ucs4 character codepoint
+ * \return true if the keypress is dealt with, false otherwise.
+ */
+void cookie_manager_keypress(uint32_t key);
+
+#endif
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=4697d1ccc1d6190788b...
commit 4697d1ccc1d6190788b931352b1e3a931dd0a0f7
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Expose treeview walker.
diff --git a/desktop/treeview.c b/desktop/treeview.c
index b920073..c45e914 100644
--- a/desktop/treeview.c
+++ b/desktop/treeview.c
@@ -39,12 +39,6 @@ struct treeview_globals {
int icon_step;
} tree_g;
-enum treeview_node_type {
- TREE_NODE_ROOT,
- TREE_NODE_FOLDER,
- TREE_NODE_ENTRY
-};
-
enum treeview_node_section {
TV_NODE_SECTION_TOGGLE, /**< Expansion toggle */
TV_NODE_SECTION_ON_NODE, /**< Node content (text, icon) */
@@ -573,6 +567,44 @@ static nserror treeview_walk_internal(treeview_node *root, bool full,
}
+struct treeview_walk_ctx {
+ treeview_walk_callback walk_cb;
+ void *ctx;
+ enum treeview_node_type type;
+};
+/** Treewalk node callback. */
+static nserror treeview_walk_cb(treeview_node *n, void *ctx,
+ bool *skip_children, bool *end)
+{
+ struct treeview_walk_ctx *tw = ctx;
+
+ if (n->type & tw->type) {
+ return tw->walk_cb(tw->ctx, n->client_data, tw->type, end);
+ }
+
+ return NSERROR_OK;
+}
+/* Exported interface, documented in treeview.h */
+nserror treeview_walk(treeview *tree, treeview_node *root,
+ treeview_walk_callback walk_cb, void *ctx,
+ enum treeview_node_type type)
+{
+ struct treeview_walk_ctx tw = {
+ .walk_cb = walk_cb,
+ .ctx = ctx,
+ .type = type
+ };
+
+ assert(tree != NULL);
+ assert(tree->root != NULL);
+
+ if (root == NULL)
+ root = tree->root;
+
+ return treeview_walk_internal(root, true, NULL, treeview_walk_cb, &tw);
+}
+
+
struct treeview_node_delete {
treeview *tree;
int height_reduction;
diff --git a/desktop/treeview.h b/desktop/treeview.h
index 82a7af1..ddd9be6 100644
--- a/desktop/treeview.h
+++ b/desktop/treeview.h
@@ -33,6 +33,12 @@
typedef struct treeview treeview;
typedef struct treeview_node treeview_node;
+enum treeview_node_type {
+ TREE_NODE_ROOT = (1 << 0),
+ TREE_NODE_FOLDER = (1 << 1),
+ TREE_NODE_ENTRY = (1 << 2)
+};
+
enum treeview_relationship {
TREE_REL_FIRST_CHILD,
TREE_REL_NEXT_SIBLING
@@ -208,6 +214,37 @@ nserror treeview_update_node_entry(treeview *tree,
const struct treeview_field_data fields[],
void *data);
+
+/**
+ * Client callback for treeview_walk
+ *
+ * \param ctx Client context
+ * \param node_data Client data for the current treeview node
+ * \param type The node type
+ * \param abort Set to true to abort treeview walk prematurely
+ * \return NSERROR_OK on success, or appropriate error otherwise
+ */
+typedef nserror (*treeview_walk_callback)(void *ctx, void *node_data,
+ enum treeview_node_type type, bool *abort);
+
+/**
+ * Walk (depth first) a treeview subtree, calling a callback at each node of
+ * required type.
+ *
+ * \param tree Treeview object to walk
+ * \param root Root node to walk tree from (or NULL for tree root)
+ * \param walk_cb Function to call on each node
+ * \param ctx Client context, passed back to callback function
+ * \param type The node type(s) of interest
+ * \return NSERROR_OK on success, or appropriate error otherwise
+ *
+ * Note, if deleting returned node, walk_cb must terminate the treeview walk by
+ * setting abort to true.
+ */
+nserror treeview_walk(treeview *tree, treeview_node *root,
+ treeview_walk_callback walk_cb, void *ctx,
+ enum treeview_node_type type);
+
/**
* Delete a treeview node
*
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=17abee0045e51b72a1d...
commit 17abee0045e51b72a1dda9de0c187c71c252fc56
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Namespace treeview node callback table.
diff --git a/desktop/global_history.c b/desktop/global_history.c
index b9a5754..902d879 100644
--- a/desktop/global_history.c
+++ b/desktop/global_history.c
@@ -709,7 +709,7 @@ static nserror global_history_tree_node_entry_cb(
}
return NSERROR_OK;
}
-struct treeview_callback_table tree_cb_t = {
+struct treeview_callback_table gh_tree_cb_t = {
.folder = global_history_tree_node_folder_cb,
.entry = global_history_tree_node_entry_cb
};
@@ -741,7 +741,7 @@ nserror global_history_init(struct core_window_callback_table *cw_t,
urldb_iterate_entries(global_history_add_entry);
/* Create the global history treeview */
- err = treeview_create(&gh_ctx.tree, &tree_cb_t,
+ err = treeview_create(&gh_ctx.tree, &gh_tree_cb_t,
N_FIELDS, gh_ctx.fields,
cw_t, core_window_handle,
TREEVIEW_NO_MOVES | TREEVIEW_DEL_EMPTY_DIRS);
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=ba576ad5d6c7aa808de...
commit ba576ad5d6c7aa808dee631643a8ac878d3205cc
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Guard for uninitalised history case.
diff --git a/desktop/global_history.c b/desktop/global_history.c
index bfafe69..b9a5754 100644
--- a/desktop/global_history.c
+++ b/desktop/global_history.c
@@ -809,6 +809,10 @@ nserror global_history_add(nsurl *url)
{
const struct url_data *data;
+ /* If we don't have a global history at the moment, just return OK */
+ if (gh_ctx.tree == NULL)
+ return NSERROR_OK;
+
data = urldb_get_url_data(url);
if (data == NULL) {
LOG(("Can't add URL to history that's not present in urldb."));
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=a399e5aa70342085417...
commit a399e5aa703420854175d14a62b6a8edb3ba0c18
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Fix return type.
diff --git a/desktop/global_history.c b/desktop/global_history.c
index 61735d9..bfafe69 100644
--- a/desktop/global_history.c
+++ b/desktop/global_history.c
@@ -357,7 +357,7 @@ static nserror global_history_add_entry_internal(nsurl *url, int slot,
/* Create new local history entry */
e = malloc(sizeof(struct global_history_entry));
if (e == NULL) {
- return false;
+ return NSERROR_NOMEM;
}
e->user_delete = false;
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=a4b5a8aed72aa842474...
commit a4b5a8aed72aa8424749d905774056c761414150
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Unset built bool when fini is called.
diff --git a/desktop/global_history.c b/desktop/global_history.c
index b2bc602..61735d9 100644
--- a/desktop/global_history.c
+++ b/desktop/global_history.c
@@ -788,6 +788,8 @@ nserror global_history_fini(void)
LOG(("Finalising global history"));
+ gh_ctx.built = false;
+
/* Destroy the global history treeview */
err = treeview_destroy(gh_ctx.tree);
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=ef05c2f6e696f7038b3...
commit ef05c2f6e696f7038b343283db7574d7f1c167e6
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Return correct error.
diff --git a/desktop/global_history.c b/desktop/global_history.c
index 419edee..b2bc602 100644
--- a/desktop/global_history.c
+++ b/desktop/global_history.c
@@ -798,7 +798,7 @@ nserror global_history_fini(void)
LOG(("Finalised global history"));
- return NSERROR_OK;
+ return err;
}
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=c6820e840236615c925...
commit c6820e840236615c9253ce9e2e49b71b783404bf
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Replace magic numbers with enum.
diff --git a/desktop/global_history.c b/desktop/global_history.c
index 05822d7..419edee 100644
--- a/desktop/global_history.c
+++ b/desktop/global_history.c
@@ -27,7 +27,6 @@
#include "utils/utils.h"
#include "utils/log.h"
-#define N_FIELDS 5
#define N_DAYS 28
#define N_SEC_PER_DAY (60 * 60 * 24)
@@ -45,6 +44,15 @@ enum global_history_folders {
GH_N_FOLDERS
};
+enum global_history_fields {
+ GH_TITLE,
+ GH_URL,
+ GH_LAST_VISIT,
+ GH_VISITS,
+ GH_PERIOD,
+ N_FIELDS
+};
+
struct global_history_folder {
treeview_node *folder;
struct treeview_field_data data;
@@ -259,13 +267,14 @@ static nserror global_history_create_treeview_field_data(
char *last_visited2;
int len;
- e->data[0].field = gh_ctx.fields[0].field;
- e->data[0].value = strdup(title);
- e->data[0].value_len = (e->data[0].value != NULL) ? strlen(title) : 0;
+ e->data[GH_TITLE].field = gh_ctx.fields[GH_TITLE].field;
+ e->data[GH_TITLE].value = strdup(title);
+ e->data[GH_TITLE].value_len = (e->data[GH_TITLE].value != NULL) ?
+ strlen(title) : 0;
- e->data[1].field = gh_ctx.fields[1].field;
- e->data[1].value = nsurl_access(e->url);
- e->data[1].value_len = nsurl_length(e->url);
+ e->data[GH_URL].field = gh_ctx.fields[GH_URL].field;
+ e->data[GH_URL].value = nsurl_access(e->url);
+ e->data[GH_URL].value_len = nsurl_length(e->url);
last_visited = ctime(&data->last_visit);
last_visited2 = strdup(last_visited);
@@ -274,9 +283,9 @@ static nserror global_history_create_treeview_field_data(
last_visited2[24] = '\0';
}
- e->data[2].field = gh_ctx.fields[2].field;
- e->data[2].value = last_visited2;
- e->data[2].value_len = (last_visited2 != NULL) ? 24 : 0;
+ e->data[GH_LAST_VISIT].field = gh_ctx.fields[GH_LAST_VISIT].field;
+ e->data[GH_LAST_VISIT].value = last_visited2;
+ e->data[GH_LAST_VISIT].value_len = (last_visited2 != NULL) ? 24 : 0;
len = snprintf(buffer, 16, "%u", data->visits);
if (len == 16) {
@@ -284,9 +293,9 @@ static nserror global_history_create_treeview_field_data(
buffer[len] = '\0';
}
- e->data[3].field = gh_ctx.fields[3].field;
- e->data[3].value = strdup(buffer);
- e->data[3].value_len = len;
+ e->data[GH_VISITS].field = gh_ctx.fields[GH_VISITS].field;
+ e->data[GH_VISITS].value = strdup(buffer);
+ e->data[GH_VISITS].value_len = len;
return NSERROR_OK;
}
@@ -442,9 +451,9 @@ static void global_history_delete_entry_internal(
}
/* Destroy fields */
- free((void *)e->data[0].value); /* Eww */
- free((void *)e->data[2].value); /* Eww */
- free((void *)e->data[3].value); /* Eww */
+ free((void *)e->data[GH_TITLE].value); /* Eww */
+ free((void *)e->data[GH_LAST_VISIT].value); /* Eww */
+ free((void *)e->data[GH_VISITS].value); /* Eww */
nsurl_unref(e->url);
/* Destroy entry */
@@ -512,47 +521,47 @@ static nserror global_history_initialise_entry_fields(void)
for (i = 0; i < N_FIELDS; i++)
gh_ctx.fields[i].field = NULL;
- gh_ctx.fields[0].flags = TREE_FLAG_DEFAULT;
+ gh_ctx.fields[GH_TITLE].flags = TREE_FLAG_DEFAULT;
label = "TreeviewLabelTitle";
label = messages_get(label);
if (lwc_intern_string(label, strlen(label),
- &gh_ctx.fields[0].field) !=
+ &gh_ctx.fields[GH_TITLE].field) !=
lwc_error_ok) {
goto error;
}
- gh_ctx.fields[1].flags = TREE_FLAG_NONE;
+ gh_ctx.fields[GH_URL].flags = TREE_FLAG_NONE;
label = "TreeviewLabelURL";
label = messages_get(label);
if (lwc_intern_string(label, strlen(label),
- &gh_ctx.fields[1].field) !=
+ &gh_ctx.fields[GH_URL].field) !=
lwc_error_ok) {
goto error;
}
- gh_ctx.fields[2].flags = TREE_FLAG_SHOW_NAME;
+ gh_ctx.fields[GH_LAST_VISIT].flags = TREE_FLAG_SHOW_NAME;
label = "TreeviewLabelLastVisit";
label = messages_get(label);
if (lwc_intern_string(label, strlen(label),
- &gh_ctx.fields[2].field) !=
+ &gh_ctx.fields[GH_LAST_VISIT].field) !=
lwc_error_ok) {
goto error;
}
- gh_ctx.fields[3].flags = TREE_FLAG_SHOW_NAME;
+ gh_ctx.fields[GH_VISITS].flags = TREE_FLAG_SHOW_NAME;
label = "TreeviewLabelVisits";
label = messages_get(label);
if (lwc_intern_string(label, strlen(label),
- &gh_ctx.fields[3].field) !=
+ &gh_ctx.fields[GH_VISITS].field) !=
lwc_error_ok) {
goto error;
}
- gh_ctx.fields[4].flags = TREE_FLAG_DEFAULT;
+ gh_ctx.fields[GH_PERIOD].flags = TREE_FLAG_DEFAULT;
label = "TreeviewLabelPeriod";
label = messages_get(label);
if (lwc_intern_string(label, strlen(label),
- &gh_ctx.fields[4].field) !=
+ &gh_ctx.fields[GH_PERIOD].field) !=
lwc_error_ok) {
return false;
}
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=81b4c61ae3ea36751ff...
commit 81b4c61ae3ea36751ff7de240e50020c054f3ecb
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Don't call cookies delete here, the cookie manager has already deleted it. (Calling it only added the cookie again, cos the old cookie manager was braindead.)
diff --git a/content/urldb.c b/content/urldb.c
index 126ee5e..f2f9c0a 100644
--- a/content/urldb.c
+++ b/content/urldb.c
@@ -3835,7 +3835,6 @@ void urldb_delete_cookie_paths(const char *domain, const char *path,
else
p->cookies_end = c->prev;
- cookies_remove((struct cookie_data *)c);
urldb_free_cookie(c);
return;
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=df2efd03c47f9604861...
commit df2efd03c47f9604861991a820753d359ac00e93
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Update header guard.
diff --git a/desktop/cookies_old.h b/desktop/cookies_old.h
index 9e0d79f..18ba658 100644
--- a/desktop/cookies_old.h
+++ b/desktop/cookies_old.h
@@ -20,8 +20,8 @@
* Cookies (interface).
*/
-#ifndef _NETSURF_DESKTOP_COOKIES_H_
-#define _NETSURF_DESKTOP_COOKIES_H_
+#ifndef _NETSURF_DESKTOP_COOKIES_OLD_H_
+#define _NETSURF_DESKTOP_COOKIES_OLD_H_
#include <stdbool.h>
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=68078d7ea7bfe193204...
commit 68078d7ea7bfe19320404b98cbdfc8f4585d6824
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Fix up for cookies_old rename.
diff --git a/amiga/cookies.c b/amiga/cookies.c
index 4ee4637..05fd9f8 100755
--- a/amiga/cookies.c
+++ b/amiga/cookies.c
@@ -18,7 +18,7 @@
#include <proto/exec.h>
#include "amiga/cookies.h"
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
#include "amiga/tree.h"
void ami_cookies_initialise(void)
diff --git a/amiga/misc.c b/amiga/misc.c
index 4359c79..11af051 100755
--- a/amiga/misc.c
+++ b/amiga/misc.c
@@ -32,7 +32,7 @@
#include "amiga/gui.h"
#include "amiga/utf8.h"
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/url.h"
diff --git a/amiga/tree.c b/amiga/tree.c
index ddaf81e..9c7305d 100644
--- a/amiga/tree.c
+++ b/amiga/tree.c
@@ -55,7 +55,7 @@
#include "amiga/filetype.h"
#include "utils/nsoption.h"
#include "content/urldb.h"
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
#include "desktop/history_global_core.h"
#include "desktop/hotlist.h"
#include "desktop/tree_url_node.h"
diff --git a/atari/misc.c b/atari/misc.c
index 96abcf5..75410d2 100755
--- a/atari/misc.c
+++ b/atari/misc.c
@@ -27,9 +27,8 @@
#include "content/content.h"
#include "content/hlcache.h"
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
#include "desktop/mouse.h"
-#include "desktop/cookies.h"
#include "desktop/tree.h"
#include "utils/nsoption.h"
#include "utils/messages.h"
diff --git a/beos/gui.cpp b/beos/gui.cpp
index 7667822..0abef08 100644
--- a/beos/gui.cpp
+++ b/beos/gui.cpp
@@ -50,7 +50,7 @@ extern "C" {
#include "content/urldb.h"
#include "desktop/401login.h"
#include "desktop/browser_private.h"
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
#include "desktop/gui.h"
#include "desktop/netsurf.h"
#include "utils/nsoption.h"
diff --git a/cocoa/NetSurf.xcodeproj/project.pbxproj b/cocoa/NetSurf.xcodeproj/project.pbxproj
index ca0bed6..ef25d2f 100644
--- a/cocoa/NetSurf.xcodeproj/project.pbxproj
+++ b/cocoa/NetSurf.xcodeproj/project.pbxproj
@@ -41,7 +41,7 @@
260F1F8512D620E800D9B07F /* browser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = browser.c; sourceTree = "<group>"; };
260F1F8612D620E800D9B07F /* browser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = browser.h; sourceTree = "<group>"; };
260F1F8712D620E800D9B07F /* cookies.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cookies.c; sourceTree = "<group>"; };
- 260F1F8812D620E800D9B07F /* cookies.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cookies.h; sourceTree = "<group>"; };
+ 260F1F8812D620E800D9B07F /* cookies_old.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cookies_old.h; sourceTree = "<group>"; };
260F1F8912D620E800D9B07F /* download.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = download.c; sourceTree = "<group>"; };
260F1F8A12D620E800D9B07F /* download.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = download.h; sourceTree = "<group>"; };
260F1F8B12D620E800D9B07F /* frames.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = frames.c; sourceTree = "<group>"; };
@@ -398,7 +398,7 @@
260F1F8512D620E800D9B07F /* browser.c */,
260F1F8612D620E800D9B07F /* browser.h */,
260F1F8712D620E800D9B07F /* cookies.c */,
- 260F1F8812D620E800D9B07F /* cookies.h */,
+ 260F1F8812D620E800D9B07F /* cookies_old.h */,
260F1F8912D620E800D9B07F /* download.c */,
260F1F8A12D620E800D9B07F /* download.h */,
260F1F8B12D620E800D9B07F /* frames.c */,
diff --git a/content/urldb.c b/content/urldb.c
index c950dcd..126ee5e 100644
--- a/content/urldb.c
+++ b/content/urldb.c
@@ -100,7 +100,7 @@
#include "image/bitmap.h"
#include "content/content.h"
#include "content/urldb.h"
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
#include "utils/nsoption.h"
#include "utils/log.h"
#include "utils/corestrings.h"
diff --git a/desktop/Makefile b/desktop/Makefile
index ded75aa..1c62f1a 100644
--- a/desktop/Makefile
+++ b/desktop/Makefile
@@ -1,6 +1,6 @@
# Sources for desktop
-S_DESKTOP := cookies.c history_global_core.c hotlist.c knockout.c \
+S_DESKTOP := cookies_old.c history_global_core.c hotlist.c knockout.c \
mouse.c plot_style.c print.c search.c searchweb.c \
scrollbar.c sslcert.c textarea.c thumbnail.c tree.c \
tree_url_node.c version.c system_colour.c global_history.c treeview.c
diff --git a/framebuffer/misc.c b/framebuffer/misc.c
index 035e6b4..0568e36 100644
--- a/framebuffer/misc.c
+++ b/framebuffer/misc.c
@@ -21,7 +21,7 @@
#include <stdio.h>
#include <string.h>
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/utils.h"
diff --git a/gtk/cookies.c b/gtk/cookies.c
index dd62d56..99b2a80 100644
--- a/gtk/cookies.c
+++ b/gtk/cookies.c
@@ -21,7 +21,7 @@
*/
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
#include "desktop/plotters.h"
#include "desktop/tree.h"
#include "utils/log.h"
diff --git a/gtk/gui.c b/gtk/gui.c
index 01f9688..3fb2c2b 100644
--- a/gtk/gui.c
+++ b/gtk/gui.c
@@ -45,7 +45,7 @@
#include "content/hlcache.h"
#include "content/urldb.h"
#include "desktop/browser_private.h"
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
#include "desktop/gui.h"
#include "desktop/history_global_core.h"
#include "desktop/netsurf.h"
diff --git a/riscos/cookies.c b/riscos/cookies.c
index 8fb4594..14a1d03 100644
--- a/riscos/cookies.c
+++ b/riscos/cookies.c
@@ -30,7 +30,7 @@
#include "oslib/wimp.h"
#include "oslib/wimpspriteop.h"
#include "content/urldb.h"
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
#include "desktop/tree.h"
#include "riscos/cookies.h"
#include "riscos/dialog.h"
diff --git a/riscos/gui.c b/riscos/gui.c
index e409fbb..81b8a63 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -55,7 +55,7 @@
#include "content/hlcache.h"
#include "content/urldb.h"
#include "content/fetchers/resource.h"
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
#include "desktop/gui.h"
#include "desktop/history_global_core.h"
#include "desktop/hotlist.h"
diff --git a/riscos/menus.c b/riscos/menus.c
index 337ca48..bf9fa84 100644
--- a/riscos/menus.c
+++ b/riscos/menus.c
@@ -34,7 +34,7 @@
#include "content/content.h"
#include "content/hlcache.h"
#include "content/urldb.h"
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
#include "desktop/browser.h"
#include "desktop/gui.h"
#include "desktop/history_global_core.h"
diff --git a/riscos/window.c b/riscos/window.c
index 8e0f0a0..cbb31cf 100644
--- a/riscos/window.c
+++ b/riscos/window.c
@@ -46,7 +46,7 @@
#include "content/urldb.h"
#include "css/css.h"
#include "desktop/browser_private.h"
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
#include "desktop/scrollbar.h"
#include "desktop/frames.h"
#include "desktop/local_history.h"
diff --git a/test/llcache.c b/test/llcache.c
index de82304..b3eb0d2 100644
--- a/test/llcache.c
+++ b/test/llcache.c
@@ -105,11 +105,11 @@ char *url_to_path(const char *url)
* Things that are absolutely not reasonable, and should disappear *
******************************************************************************/
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
#include "desktop/gui.h"
#include "desktop/tree.h"
-/* desktop/cookies.h -- used by urldb
+/* desktop/cookies_old.h -- used by urldb
*
* URLdb should have a cookies update event + handler registration
*/
@@ -118,7 +118,7 @@ bool cookies_schedule_update(const struct cookie_data *data)
return true;
}
-/* desktop/cookies.h -- used by urldb
+/* desktop/cookies_old.h -- used by urldb
*
* URLdb should have a cookies removal handler registration
*/
diff --git a/test/urldbtest.c b/test/urldbtest.c
index bc9d899..7c72ed7 100644
--- a/test/urldbtest.c
+++ b/test/urldbtest.c
@@ -32,7 +32,7 @@
#include "image/bitmap.h"
#include "content/content.h"
#include "content/urldb.h"
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
#include "utils/nsoption.h"
#ifdef riscos
/** \todo lose this */
diff --git a/windows/misc.c b/windows/misc.c
index 5132e61..51c02ca 100644
--- a/windows/misc.c
+++ b/windows/misc.c
@@ -25,7 +25,7 @@
#include <windows.h>
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
#include "utils/messages.h"
#include "utils/utils.h"
#include "utils/url.h"
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=01159ff5896f9ac2410...
commit 01159ff5896f9ac2410832c1516bbbd5ff57ae0d
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Move cookies viewer module.
diff --git a/desktop/cookies.c b/desktop/cookies.c
deleted file mode 100644
index 9f66aea..0000000
--- a/desktop/cookies.c
+++ /dev/null
@@ -1,525 +0,0 @@
-/*
- * Copyright 2006 Richard Wilson <info(a)tinct.net>
- * Copyright 2009 Paul Blokus <paul_pl(a)users.sourceforge.net>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * Cookies (implementation).
- */
-
-#include <assert.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include "content/content.h"
-#include "content/hlcache.h"
-#include "content/urldb.h"
-#include "desktop/cookies.h"
-#include "utils/nsoption.h"
-#include "desktop/tree.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/schedule.h"
-#include "utils/url.h"
-#include "utils/utils.h"
-
-/** Flags for each type of cookie tree node. */
-enum tree_element_cookie {
- TREE_ELEMENT_PERSISTENT = 0x01,
- TREE_ELEMENT_VERSION = 0x02,
- TREE_ELEMENT_SECURE = 0x03,
- TREE_ELEMENT_LAST_USED = 0x04,
- TREE_ELEMENT_EXPIRES = 0x05,
- TREE_ELEMENT_PATH = 0x06,
- TREE_ELEMENT_DOMAIN = 0x07,
- TREE_ELEMENT_COMMENT = 0x08,
- TREE_ELEMENT_VALUE = 0x09,
-};
-
-static struct tree *cookies_tree;
-static struct node *cookies_tree_root;
-static bool user_delete;
-static hlcache_handle *folder_icon;
-static hlcache_handle *cookie_icon;
-
-
-/**
- * Find an entry in the cookie tree
- *
- * \param node the node to check the children of
- * \param title The title to find
- * \return Pointer to node, or NULL if not found
- */
-static struct node *cookies_find(struct node *node, const char *title)
-{
- struct node *search;
- struct node_element *element;
-
- assert(node !=NULL);
-
- for (search = tree_node_get_child(node); search;
- search = tree_node_get_next(search)) {
- element = tree_node_find_element(search, TREE_ELEMENT_TITLE,
- NULL);
- if (strcmp(title, tree_node_element_get_text(element)) == 0)
- return search;
- }
- return NULL;
-}
-
-/**
- * Callback for all cookie tree nodes.
- */
-static node_callback_resp cookies_node_callback(void *user_data, struct node_msg_data *msg_data)
-{
- struct node *node = msg_data->node;
- struct node_element *domain, *path;
- const char *domain_t, *path_t, *name_t;
- char *space;
- bool is_folder = tree_node_is_folder(node);
-
- /* we don't remove any icons here */
- if (msg_data->msg == NODE_DELETE_ELEMENT_IMG)
- return NODE_CALLBACK_HANDLED;
-
- /* let the tree handle events other than text data removal */
- if (msg_data->msg != NODE_DELETE_ELEMENT_TXT)
- return NODE_CALLBACK_NOT_HANDLED;
-
- /* check if it's a domain folder */
- if (is_folder)
- return NODE_CALLBACK_NOT_HANDLED;
-
- switch (msg_data->flag) {
- case TREE_ELEMENT_TITLE:
- if (!user_delete)
- break;
- /* get the rest of the cookie data */
- domain = tree_node_find_element(node,
- TREE_ELEMENT_DOMAIN, NULL);
- path = tree_node_find_element(node, TREE_ELEMENT_PATH,
- NULL);
-
- if ((domain != NULL) &&
- (path != NULL)) {
- domain_t = tree_node_element_get_text(domain) +
- strlen(messages_get(
- "TreeDomain")) - 4;
- space = strchr(domain_t, ' ');
- if (space != NULL)
- *space = '\0';
- path_t = tree_node_element_get_text(path) +
- strlen(messages_get("TreePath"))
- - 4;
- space = strchr(path_t, ' ');
- if (space != NULL)
- *space = '\0';
- name_t = msg_data->data.text;
- urldb_delete_cookie(domain_t, path_t, name_t);
- }
- break;
- default:
- break;
- }
-
- free(msg_data->data.text);
-
- return NODE_CALLBACK_HANDLED;
-}
-
-
-/**
- * Updates a tree entry for a cookie.
- *
- * All information is copied from the cookie_data, and as such can
- * be edited and should be freed.
- *
- * \param node The node to update
- * \param data The cookie data to use
- * \return true if node updated, or false for failure
- */
-static bool cookies_update_cookie_node(struct node *node,
- const struct cookie_data *data)
-{
- struct node_element *element;
- char buffer[32];
-
- assert(data != NULL);
-
- /* update the value text */
- element = tree_node_find_element(node, TREE_ELEMENT_VALUE, NULL);
- tree_update_element_text(cookies_tree,
- element,
- messages_get_buff("TreeValue",
- data->value != NULL ?
- data->value :
- messages_get("TreeUnused")));
-
-
- /* update the comment text */
- if ((data->comment != NULL) &&
- (strcmp(data->comment, "") != 0)) {
- element = tree_node_find_element(node, TREE_ELEMENT_COMMENT, NULL);
- tree_update_element_text(cookies_tree,
- element,
- messages_get_buff("TreeComment",
- data->comment));
- }
-
- /* update domain text */
- element = tree_node_find_element(node, TREE_ELEMENT_DOMAIN, element);
- tree_update_element_text(cookies_tree,
- element,
- messages_get_buff("TreeDomain",
- data->domain,
- data->domain_from_set ?
- messages_get("TreeHeaders") :
- ""));
-
- /* update path text */
- element = tree_node_find_element(node, TREE_ELEMENT_PATH, element);
- tree_update_element_text(cookies_tree,
- element,
- messages_get_buff("TreePath", data->path,
- data->path_from_set ?
- messages_get("TreeHeaders") :
- ""));
-
- /* update expiry text */
- element = tree_node_find_element(node, TREE_ELEMENT_EXPIRES, element);
- tree_update_element_text(cookies_tree,
- element,
- messages_get_buff("TreeExpires",
- (data->expires > 0)
- ? (data->expires == 1)
- ? messages_get("TreeSession")
- : ctime(&data->expires)
- : messages_get("TreeUnknown")));
-
- /* update last used text */
- element = tree_node_find_element(node, TREE_ELEMENT_LAST_USED, element);
- tree_update_element_text(cookies_tree,
- element,
- messages_get_buff("TreeLastUsed",
- (data->last_used > 0) ?
- ctime(&data->last_used) :
- messages_get("TreeUnknown")));
-
- /* update secure text */
- element = tree_node_find_element(node, TREE_ELEMENT_SECURE, element);
- tree_update_element_text(cookies_tree,
- element,
- messages_get_buff("TreeSecure",
- data->secure ?
- messages_get("Yes") :
- messages_get("No")));
-
- /* update version text */
- element = tree_node_find_element(node, TREE_ELEMENT_VERSION, element);
- snprintf(buffer, sizeof(buffer), "TreeVersion%i", data->version);
- tree_update_element_text(cookies_tree,
- element,
- messages_get_buff("TreeVersion",
- messages_get(buffer)));
-
- /* update persistant text */
- element = tree_node_find_element(node, TREE_ELEMENT_PERSISTENT, element);
- tree_update_element_text(cookies_tree,
- element,
- messages_get_buff("TreePersistent",
- data->no_destroy ?
- messages_get("Yes") :
- messages_get("No")));
-
- return true;
-}
-
-/**
- * Creates an empty tree entry for a cookie, and links it into the tree.
- *
- * All information is copied from the cookie_data, and as such can
- * be edited and should be freed.
- *
- * \param parent the node to link to
- * \param data the cookie data to use
- * \return the node created, or NULL for failure
- */
-static struct node *cookies_create_cookie_node(struct node *parent,
- const struct cookie_data *data)
-{
- struct node *node;
-
- node = tree_create_leaf_node(cookies_tree,
- NULL,
- data->name,
- false, false, false);
- if (node == NULL) {
- return NULL;
- }
-
- tree_set_node_user_callback(node, cookies_node_callback, NULL);
-
- tree_create_node_element(node, NODE_ELEMENT_TEXT,
- TREE_ELEMENT_PERSISTENT, false);
-
- tree_create_node_element(node, NODE_ELEMENT_TEXT,
- TREE_ELEMENT_VERSION, false);
-
- tree_create_node_element(node, NODE_ELEMENT_TEXT,
- TREE_ELEMENT_SECURE, false);
-
- tree_create_node_element(node, NODE_ELEMENT_TEXT,
- TREE_ELEMENT_LAST_USED, false);
-
- tree_create_node_element(node, NODE_ELEMENT_TEXT,
- TREE_ELEMENT_EXPIRES, false);
-
- tree_create_node_element(node, NODE_ELEMENT_TEXT,
- TREE_ELEMENT_PATH, false);
-
- tree_create_node_element(node, NODE_ELEMENT_TEXT,
- TREE_ELEMENT_DOMAIN, false);
-
- if ((data->comment) && (strcmp(data->comment, "")))
- tree_create_node_element(node, NODE_ELEMENT_TEXT,
- TREE_ELEMENT_COMMENT, false);
- tree_create_node_element(node, NODE_ELEMENT_TEXT,
- TREE_ELEMENT_VALUE, false);
- tree_set_node_icon(cookies_tree, node, cookie_icon);
-
- if (!cookies_update_cookie_node(node, data))
- {
- tree_delete_node(NULL, node, false);
- return NULL;
- }
-
- tree_link_node(cookies_tree, parent, node, false);
- return node;
-}
-
-
-/**
- * Called when scheduled event gets fired. Actually performs the update.
- */
-static void cookies_schedule_callback(const void *scheduled_data)
-{
- const struct cookie_data *data = scheduled_data;
- struct node *node = NULL;
- struct node *cookie_node = NULL;
-
- assert(data != NULL);
-
- node = cookies_find(cookies_tree_root, data->domain);
-
- if (node == NULL) {
- node = tree_create_folder_node(cookies_tree,
- cookies_tree_root,
- data->domain,
- false, false, false);
- if (node != NULL) {
- tree_set_node_user_callback(node,
- cookies_node_callback,
- NULL);
- tree_set_node_icon(cookies_tree, node, folder_icon);
- }
- }
-
- if (node != NULL) {
- cookie_node = cookies_find(node, data->name);
- if (cookie_node == NULL) {
- cookies_create_cookie_node(node, data);
- } else {
- cookies_update_cookie_node(cookie_node, data);
- }
-
- }
-}
-
-/**
- * Initialises cookies tree.
- *
- * \param data user data for the callbacks
- * \param start_redraw callback function called before every redraw
- * \param end_redraw callback function called after every redraw
- * \return true on success, false on memory exhaustion
- */
-bool cookies_initialise(struct tree *tree, const char* folder_icon_name, const char* cookie_icon_name)
-{
-
- if (tree == NULL)
- return false;
-
- folder_icon = tree_load_icon(folder_icon_name);
- cookie_icon = tree_load_icon(cookie_icon_name);
-
- /* Create an empty tree */
- cookies_tree = tree;
- cookies_tree_root = tree_get_root(cookies_tree);
-
- user_delete = false;
- urldb_iterate_cookies(cookies_schedule_update);
- tree_set_node_expanded(cookies_tree, cookies_tree_root,
- false, true, true);
-
- return true;
-}
-
-
-/**
- * Get flags with which the cookies tree should be created;
- *
- * \return the flags
- */
-unsigned int cookies_get_tree_flags(void)
-{
- return TREE_DELETE_EMPTY_DIRS;
-}
-
-
-/* exported interface documented in cookies.h */
-bool cookies_schedule_update(const struct cookie_data *data)
-{
- assert(data != NULL);
- assert(user_delete == false);
-
- if (cookies_tree_root != NULL)
- cookies_schedule_callback(data);
-
- return true;
-}
-
-
-/* exported interface documented in cookies.h */
-void cookies_remove(const struct cookie_data *data)
-{
- assert(data != NULL);
-
- if (cookies_tree_root != NULL)
- cookies_schedule_callback(data);
-}
-
-
-/**
- * Free memory and release all other resources.
- */
-void cookies_cleanup(void)
-{
- hlcache_handle_release(folder_icon);
- hlcache_handle_release(cookie_icon);
-}
-
-/* Actions to be connected to front end specific toolbars */
-
-/**
- * Delete nodes which are currently selected.
- */
-void cookies_delete_selected(void)
-{
- user_delete = true;
- tree_delete_selected_nodes(cookies_tree, cookies_tree_root);
- user_delete = false;
-}
-
-/**
- * Delete all nodes.
- */
-void cookies_delete_all(void)
-{
- bool needs_redraw = tree_get_redraw(cookies_tree);
- if (needs_redraw)
- tree_set_redraw(cookies_tree, false);
-
- user_delete = true;
- tree_set_node_selected(cookies_tree, cookies_tree_root, true, true);
- tree_delete_selected_nodes(cookies_tree, cookies_tree_root);
- user_delete = false;
-
- if (needs_redraw)
- tree_set_redraw(cookies_tree, true);
-}
-
-/**
- * Select all nodes in the tree.
- */
-void cookies_select_all(void)
-{
- tree_set_node_selected(cookies_tree, cookies_tree_root, true, true);
-}
-
-/**
- * Unselect all nodes.
- */
-void cookies_clear_selection(void)
-{
- tree_set_node_selected(cookies_tree, cookies_tree_root, true, false);
-}
-
-/**
- * Expand both domain and cookie nodes.
- */
-void cookies_expand_all(void)
-{
- tree_set_node_expanded(cookies_tree, cookies_tree_root,
- true, true, true);
-}
-
-/**
- * Expand domain nodes only.
- */
-void cookies_expand_domains(void)
-{
- tree_set_node_expanded(cookies_tree, cookies_tree_root,
- true, true, false);
-}
-
-/**
- * Expand cookie nodes only.
- */
-void cookies_expand_cookies(void)
-{
- tree_set_node_expanded(cookies_tree, cookies_tree_root,
- true, false, true);
-}
-
-/**
- * Collapse both domain and cookie nodes.
- */
-void cookies_collapse_all(void)
-{
- tree_set_node_expanded(cookies_tree, cookies_tree_root,
- false, true, true);
-}
-
-/**
- * Collapse domain nodes only.
- */
-void cookies_collapse_domains(void)
-{
- tree_set_node_expanded(cookies_tree, cookies_tree_root,
- false, true, false);
-}
-
-/**
- * Collapse cookie nodes only.
- */
-void cookies_collapse_cookies(void)
-{
- tree_set_node_expanded(cookies_tree, cookies_tree_root,
- false, false, true);
-}
diff --git a/desktop/cookies.h b/desktop/cookies.h
deleted file mode 100644
index 9e0d79f..0000000
--- a/desktop/cookies.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright 2006 Richard Wilson <info(a)tinct.net>
- *
- * This file is part of NetSurf, http://www.netsurf-browser.org/
- *
- * NetSurf is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * NetSurf is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/** \file
- * Cookies (interface).
- */
-
-#ifndef _NETSURF_DESKTOP_COOKIES_H_
-#define _NETSURF_DESKTOP_COOKIES_H_
-
-#include <stdbool.h>
-
-#include "desktop/tree.h"
-
-struct cookie_data;
-
-bool cookies_initialise(struct tree *tree, const char* folder_icon_name, const char* cookie_icon_name);
-unsigned int cookies_get_tree_flags(void);
-
-/**
- * Perform cookie updates and addition. The update is only scheduled here.
- * The actual update is performed in the callback function.
- *
- * \param data Data of cookie being updated.
- * \return true (for urldb_iterate_entries)
- */
-bool cookies_schedule_update(const struct cookie_data *data);
-
-/**
- * Remove a cookie from the active set.
- * The cookie is to be removed from the active set and no futher
- * references made to the cookie data.
- *
- * \param data Data of cookie being removed.
- */
-void cookies_remove(const struct cookie_data *data);
-
-void cookies_cleanup(void);
-
-void cookies_delete_selected(void);
-void cookies_delete_all(void);
-void cookies_select_all(void);
-void cookies_clear_selection(void);
-void cookies_expand_all(void);
-void cookies_expand_domains(void);
-void cookies_expand_cookies(void);
-void cookies_collapse_all(void);
-void cookies_collapse_domains(void);
-void cookies_collapse_cookies(void);
-
-#endif
diff --git a/desktop/cookies_old.c b/desktop/cookies_old.c
new file mode 100644
index 0000000..37b251e
--- /dev/null
+++ b/desktop/cookies_old.c
@@ -0,0 +1,525 @@
+/*
+ * Copyright 2006 Richard Wilson <info(a)tinct.net>
+ * Copyright 2009 Paul Blokus <paul_pl(a)users.sourceforge.net>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** \file
+ * Cookies (implementation).
+ */
+
+#include <assert.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#include "content/content.h"
+#include "content/hlcache.h"
+#include "content/urldb.h"
+#include "desktop/cookies_old.h"
+#include "utils/nsoption.h"
+#include "desktop/tree.h"
+#include "utils/log.h"
+#include "utils/messages.h"
+#include "utils/schedule.h"
+#include "utils/url.h"
+#include "utils/utils.h"
+
+/** Flags for each type of cookie tree node. */
+enum tree_element_cookie {
+ TREE_ELEMENT_PERSISTENT = 0x01,
+ TREE_ELEMENT_VERSION = 0x02,
+ TREE_ELEMENT_SECURE = 0x03,
+ TREE_ELEMENT_LAST_USED = 0x04,
+ TREE_ELEMENT_EXPIRES = 0x05,
+ TREE_ELEMENT_PATH = 0x06,
+ TREE_ELEMENT_DOMAIN = 0x07,
+ TREE_ELEMENT_COMMENT = 0x08,
+ TREE_ELEMENT_VALUE = 0x09,
+};
+
+static struct tree *cookies_tree;
+static struct node *cookies_tree_root;
+static bool user_delete;
+static hlcache_handle *folder_icon;
+static hlcache_handle *cookie_icon;
+
+
+/**
+ * Find an entry in the cookie tree
+ *
+ * \param node the node to check the children of
+ * \param title The title to find
+ * \return Pointer to node, or NULL if not found
+ */
+static struct node *cookies_find(struct node *node, const char *title)
+{
+ struct node *search;
+ struct node_element *element;
+
+ assert(node !=NULL);
+
+ for (search = tree_node_get_child(node); search;
+ search = tree_node_get_next(search)) {
+ element = tree_node_find_element(search, TREE_ELEMENT_TITLE,
+ NULL);
+ if (strcmp(title, tree_node_element_get_text(element)) == 0)
+ return search;
+ }
+ return NULL;
+}
+
+/**
+ * Callback for all cookie tree nodes.
+ */
+static node_callback_resp cookies_node_callback(void *user_data, struct node_msg_data *msg_data)
+{
+ struct node *node = msg_data->node;
+ struct node_element *domain, *path;
+ const char *domain_t, *path_t, *name_t;
+ char *space;
+ bool is_folder = tree_node_is_folder(node);
+
+ /* we don't remove any icons here */
+ if (msg_data->msg == NODE_DELETE_ELEMENT_IMG)
+ return NODE_CALLBACK_HANDLED;
+
+ /* let the tree handle events other than text data removal */
+ if (msg_data->msg != NODE_DELETE_ELEMENT_TXT)
+ return NODE_CALLBACK_NOT_HANDLED;
+
+ /* check if it's a domain folder */
+ if (is_folder)
+ return NODE_CALLBACK_NOT_HANDLED;
+
+ switch (msg_data->flag) {
+ case TREE_ELEMENT_TITLE:
+ if (!user_delete)
+ break;
+ /* get the rest of the cookie data */
+ domain = tree_node_find_element(node,
+ TREE_ELEMENT_DOMAIN, NULL);
+ path = tree_node_find_element(node, TREE_ELEMENT_PATH,
+ NULL);
+
+ if ((domain != NULL) &&
+ (path != NULL)) {
+ domain_t = tree_node_element_get_text(domain) +
+ strlen(messages_get(
+ "TreeDomain")) - 4;
+ space = strchr(domain_t, ' ');
+ if (space != NULL)
+ *space = '\0';
+ path_t = tree_node_element_get_text(path) +
+ strlen(messages_get("TreePath"))
+ - 4;
+ space = strchr(path_t, ' ');
+ if (space != NULL)
+ *space = '\0';
+ name_t = msg_data->data.text;
+ urldb_delete_cookie(domain_t, path_t, name_t);
+ }
+ break;
+ default:
+ break;
+ }
+
+ free(msg_data->data.text);
+
+ return NODE_CALLBACK_HANDLED;
+}
+
+
+/**
+ * Updates a tree entry for a cookie.
+ *
+ * All information is copied from the cookie_data, and as such can
+ * be edited and should be freed.
+ *
+ * \param node The node to update
+ * \param data The cookie data to use
+ * \return true if node updated, or false for failure
+ */
+static bool cookies_update_cookie_node(struct node *node,
+ const struct cookie_data *data)
+{
+ struct node_element *element;
+ char buffer[32];
+
+ assert(data != NULL);
+
+ /* update the value text */
+ element = tree_node_find_element(node, TREE_ELEMENT_VALUE, NULL);
+ tree_update_element_text(cookies_tree,
+ element,
+ messages_get_buff("TreeValue",
+ data->value != NULL ?
+ data->value :
+ messages_get("TreeUnused")));
+
+
+ /* update the comment text */
+ if ((data->comment != NULL) &&
+ (strcmp(data->comment, "") != 0)) {
+ element = tree_node_find_element(node, TREE_ELEMENT_COMMENT, NULL);
+ tree_update_element_text(cookies_tree,
+ element,
+ messages_get_buff("TreeComment",
+ data->comment));
+ }
+
+ /* update domain text */
+ element = tree_node_find_element(node, TREE_ELEMENT_DOMAIN, element);
+ tree_update_element_text(cookies_tree,
+ element,
+ messages_get_buff("TreeDomain",
+ data->domain,
+ data->domain_from_set ?
+ messages_get("TreeHeaders") :
+ ""));
+
+ /* update path text */
+ element = tree_node_find_element(node, TREE_ELEMENT_PATH, element);
+ tree_update_element_text(cookies_tree,
+ element,
+ messages_get_buff("TreePath", data->path,
+ data->path_from_set ?
+ messages_get("TreeHeaders") :
+ ""));
+
+ /* update expiry text */
+ element = tree_node_find_element(node, TREE_ELEMENT_EXPIRES, element);
+ tree_update_element_text(cookies_tree,
+ element,
+ messages_get_buff("TreeExpires",
+ (data->expires > 0)
+ ? (data->expires == 1)
+ ? messages_get("TreeSession")
+ : ctime(&data->expires)
+ : messages_get("TreeUnknown")));
+
+ /* update last used text */
+ element = tree_node_find_element(node, TREE_ELEMENT_LAST_USED, element);
+ tree_update_element_text(cookies_tree,
+ element,
+ messages_get_buff("TreeLastUsed",
+ (data->last_used > 0) ?
+ ctime(&data->last_used) :
+ messages_get("TreeUnknown")));
+
+ /* update secure text */
+ element = tree_node_find_element(node, TREE_ELEMENT_SECURE, element);
+ tree_update_element_text(cookies_tree,
+ element,
+ messages_get_buff("TreeSecure",
+ data->secure ?
+ messages_get("Yes") :
+ messages_get("No")));
+
+ /* update version text */
+ element = tree_node_find_element(node, TREE_ELEMENT_VERSION, element);
+ snprintf(buffer, sizeof(buffer), "TreeVersion%i", data->version);
+ tree_update_element_text(cookies_tree,
+ element,
+ messages_get_buff("TreeVersion",
+ messages_get(buffer)));
+
+ /* update persistant text */
+ element = tree_node_find_element(node, TREE_ELEMENT_PERSISTENT, element);
+ tree_update_element_text(cookies_tree,
+ element,
+ messages_get_buff("TreePersistent",
+ data->no_destroy ?
+ messages_get("Yes") :
+ messages_get("No")));
+
+ return true;
+}
+
+/**
+ * Creates an empty tree entry for a cookie, and links it into the tree.
+ *
+ * All information is copied from the cookie_data, and as such can
+ * be edited and should be freed.
+ *
+ * \param parent the node to link to
+ * \param data the cookie data to use
+ * \return the node created, or NULL for failure
+ */
+static struct node *cookies_create_cookie_node(struct node *parent,
+ const struct cookie_data *data)
+{
+ struct node *node;
+
+ node = tree_create_leaf_node(cookies_tree,
+ NULL,
+ data->name,
+ false, false, false);
+ if (node == NULL) {
+ return NULL;
+ }
+
+ tree_set_node_user_callback(node, cookies_node_callback, NULL);
+
+ tree_create_node_element(node, NODE_ELEMENT_TEXT,
+ TREE_ELEMENT_PERSISTENT, false);
+
+ tree_create_node_element(node, NODE_ELEMENT_TEXT,
+ TREE_ELEMENT_VERSION, false);
+
+ tree_create_node_element(node, NODE_ELEMENT_TEXT,
+ TREE_ELEMENT_SECURE, false);
+
+ tree_create_node_element(node, NODE_ELEMENT_TEXT,
+ TREE_ELEMENT_LAST_USED, false);
+
+ tree_create_node_element(node, NODE_ELEMENT_TEXT,
+ TREE_ELEMENT_EXPIRES, false);
+
+ tree_create_node_element(node, NODE_ELEMENT_TEXT,
+ TREE_ELEMENT_PATH, false);
+
+ tree_create_node_element(node, NODE_ELEMENT_TEXT,
+ TREE_ELEMENT_DOMAIN, false);
+
+ if ((data->comment) && (strcmp(data->comment, "")))
+ tree_create_node_element(node, NODE_ELEMENT_TEXT,
+ TREE_ELEMENT_COMMENT, false);
+ tree_create_node_element(node, NODE_ELEMENT_TEXT,
+ TREE_ELEMENT_VALUE, false);
+ tree_set_node_icon(cookies_tree, node, cookie_icon);
+
+ if (!cookies_update_cookie_node(node, data))
+ {
+ tree_delete_node(NULL, node, false);
+ return NULL;
+ }
+
+ tree_link_node(cookies_tree, parent, node, false);
+ return node;
+}
+
+
+/**
+ * Called when scheduled event gets fired. Actually performs the update.
+ */
+static void cookies_schedule_callback(const void *scheduled_data)
+{
+ const struct cookie_data *data = scheduled_data;
+ struct node *node = NULL;
+ struct node *cookie_node = NULL;
+
+ assert(data != NULL);
+
+ node = cookies_find(cookies_tree_root, data->domain);
+
+ if (node == NULL) {
+ node = tree_create_folder_node(cookies_tree,
+ cookies_tree_root,
+ data->domain,
+ false, false, false);
+ if (node != NULL) {
+ tree_set_node_user_callback(node,
+ cookies_node_callback,
+ NULL);
+ tree_set_node_icon(cookies_tree, node, folder_icon);
+ }
+ }
+
+ if (node != NULL) {
+ cookie_node = cookies_find(node, data->name);
+ if (cookie_node == NULL) {
+ cookies_create_cookie_node(node, data);
+ } else {
+ cookies_update_cookie_node(cookie_node, data);
+ }
+
+ }
+}
+
+/**
+ * Initialises cookies tree.
+ *
+ * \param data user data for the callbacks
+ * \param start_redraw callback function called before every redraw
+ * \param end_redraw callback function called after every redraw
+ * \return true on success, false on memory exhaustion
+ */
+bool cookies_initialise(struct tree *tree, const char* folder_icon_name, const char* cookie_icon_name)
+{
+
+ if (tree == NULL)
+ return false;
+
+ folder_icon = tree_load_icon(folder_icon_name);
+ cookie_icon = tree_load_icon(cookie_icon_name);
+
+ /* Create an empty tree */
+ cookies_tree = tree;
+ cookies_tree_root = tree_get_root(cookies_tree);
+
+ user_delete = false;
+ urldb_iterate_cookies(cookies_schedule_update);
+ tree_set_node_expanded(cookies_tree, cookies_tree_root,
+ false, true, true);
+
+ return true;
+}
+
+
+/**
+ * Get flags with which the cookies tree should be created;
+ *
+ * \return the flags
+ */
+unsigned int cookies_get_tree_flags(void)
+{
+ return TREE_DELETE_EMPTY_DIRS;
+}
+
+
+/* exported interface documented in cookies_old.h */
+bool cookies_schedule_update(const struct cookie_data *data)
+{
+ assert(data != NULL);
+ assert(user_delete == false);
+
+ if (cookies_tree_root != NULL)
+ cookies_schedule_callback(data);
+
+ return true;
+}
+
+
+/* exported interface documented in cookies_old.h */
+void cookies_remove(const struct cookie_data *data)
+{
+ assert(data != NULL);
+
+ if (cookies_tree_root != NULL)
+ cookies_schedule_callback(data);
+}
+
+
+/**
+ * Free memory and release all other resources.
+ */
+void cookies_cleanup(void)
+{
+ hlcache_handle_release(folder_icon);
+ hlcache_handle_release(cookie_icon);
+}
+
+/* Actions to be connected to front end specific toolbars */
+
+/**
+ * Delete nodes which are currently selected.
+ */
+void cookies_delete_selected(void)
+{
+ user_delete = true;
+ tree_delete_selected_nodes(cookies_tree, cookies_tree_root);
+ user_delete = false;
+}
+
+/**
+ * Delete all nodes.
+ */
+void cookies_delete_all(void)
+{
+ bool needs_redraw = tree_get_redraw(cookies_tree);
+ if (needs_redraw)
+ tree_set_redraw(cookies_tree, false);
+
+ user_delete = true;
+ tree_set_node_selected(cookies_tree, cookies_tree_root, true, true);
+ tree_delete_selected_nodes(cookies_tree, cookies_tree_root);
+ user_delete = false;
+
+ if (needs_redraw)
+ tree_set_redraw(cookies_tree, true);
+}
+
+/**
+ * Select all nodes in the tree.
+ */
+void cookies_select_all(void)
+{
+ tree_set_node_selected(cookies_tree, cookies_tree_root, true, true);
+}
+
+/**
+ * Unselect all nodes.
+ */
+void cookies_clear_selection(void)
+{
+ tree_set_node_selected(cookies_tree, cookies_tree_root, true, false);
+}
+
+/**
+ * Expand both domain and cookie nodes.
+ */
+void cookies_expand_all(void)
+{
+ tree_set_node_expanded(cookies_tree, cookies_tree_root,
+ true, true, true);
+}
+
+/**
+ * Expand domain nodes only.
+ */
+void cookies_expand_domains(void)
+{
+ tree_set_node_expanded(cookies_tree, cookies_tree_root,
+ true, true, false);
+}
+
+/**
+ * Expand cookie nodes only.
+ */
+void cookies_expand_cookies(void)
+{
+ tree_set_node_expanded(cookies_tree, cookies_tree_root,
+ true, false, true);
+}
+
+/**
+ * Collapse both domain and cookie nodes.
+ */
+void cookies_collapse_all(void)
+{
+ tree_set_node_expanded(cookies_tree, cookies_tree_root,
+ false, true, true);
+}
+
+/**
+ * Collapse domain nodes only.
+ */
+void cookies_collapse_domains(void)
+{
+ tree_set_node_expanded(cookies_tree, cookies_tree_root,
+ false, true, false);
+}
+
+/**
+ * Collapse cookie nodes only.
+ */
+void cookies_collapse_cookies(void)
+{
+ tree_set_node_expanded(cookies_tree, cookies_tree_root,
+ false, false, true);
+}
diff --git a/desktop/cookies_old.h b/desktop/cookies_old.h
new file mode 100644
index 0000000..9e0d79f
--- /dev/null
+++ b/desktop/cookies_old.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2006 Richard Wilson <info(a)tinct.net>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** \file
+ * Cookies (interface).
+ */
+
+#ifndef _NETSURF_DESKTOP_COOKIES_H_
+#define _NETSURF_DESKTOP_COOKIES_H_
+
+#include <stdbool.h>
+
+#include "desktop/tree.h"
+
+struct cookie_data;
+
+bool cookies_initialise(struct tree *tree, const char* folder_icon_name, const char* cookie_icon_name);
+unsigned int cookies_get_tree_flags(void);
+
+/**
+ * Perform cookie updates and addition. The update is only scheduled here.
+ * The actual update is performed in the callback function.
+ *
+ * \param data Data of cookie being updated.
+ * \return true (for urldb_iterate_entries)
+ */
+bool cookies_schedule_update(const struct cookie_data *data);
+
+/**
+ * Remove a cookie from the active set.
+ * The cookie is to be removed from the active set and no futher
+ * references made to the cookie data.
+ *
+ * \param data Data of cookie being removed.
+ */
+void cookies_remove(const struct cookie_data *data);
+
+void cookies_cleanup(void);
+
+void cookies_delete_selected(void);
+void cookies_delete_all(void);
+void cookies_select_all(void);
+void cookies_clear_selection(void);
+void cookies_expand_all(void);
+void cookies_expand_domains(void);
+void cookies_expand_cookies(void);
+void cookies_collapse_all(void);
+void cookies_collapse_domains(void);
+void cookies_collapse_cookies(void);
+
+#endif
-----------------------------------------------------------------------
Summary of changes:
amiga/cookies.c | 2 +-
amiga/misc.c | 2 +-
amiga/tree.c | 2 +-
atari/misc.c | 3 +-
beos/gui.cpp | 2 +-
cocoa/NetSurf.xcodeproj/project.pbxproj | 4 +-
content/urldb.c | 62 ++-
desktop/Makefile | 2 +-
desktop/cookie_manager.c | 846 ++++++++++++++++++++++++
desktop/{global_history.h => cookie_manager.h} | 57 +-
desktop/{cookies.c => cookies_old.c} | 12 +-
desktop/{cookies.h => cookies_old.h} | 4 +-
desktop/global_history.c | 75 ++-
desktop/history_global_core.c | 2 +-
desktop/hotlist.c | 2 +-
desktop/sslcert.c | 2 +-
desktop/tree.c | 103 ++-
desktop/tree.h | 5 +
desktop/treeview.c | 44 ++-
desktop/treeview.h | 37 +
framebuffer/misc.c | 2 +-
gtk/cookies.c | 2 +-
gtk/gui.c | 2 +-
resources/FatMessages | 71 ++
riscos/cookies.c | 2 +-
riscos/gui.c | 2 +-
riscos/menus.c | 2 +-
riscos/window.c | 2 +-
test/llcache.c | 6 +-
test/urldbtest.c | 2 +-
windows/misc.c | 2 +-
31 files changed, 1227 insertions(+), 136 deletions(-)
create mode 100644 desktop/cookie_manager.c
copy desktop/{global_history.h => cookie_manager.h} (55%)
rename desktop/{cookies.c => cookies_old.c} (98%)
rename desktop/{cookies.h => cookies_old.h} (95%)
diff --git a/amiga/cookies.c b/amiga/cookies.c
index 4ee4637..05fd9f8 100755
--- a/amiga/cookies.c
+++ b/amiga/cookies.c
@@ -18,7 +18,7 @@
#include <proto/exec.h>
#include "amiga/cookies.h"
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
#include "amiga/tree.h"
void ami_cookies_initialise(void)
diff --git a/amiga/misc.c b/amiga/misc.c
index 4359c79..11af051 100755
--- a/amiga/misc.c
+++ b/amiga/misc.c
@@ -32,7 +32,7 @@
#include "amiga/gui.h"
#include "amiga/utf8.h"
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/url.h"
diff --git a/amiga/tree.c b/amiga/tree.c
index ddaf81e..9c7305d 100644
--- a/amiga/tree.c
+++ b/amiga/tree.c
@@ -55,7 +55,7 @@
#include "amiga/filetype.h"
#include "utils/nsoption.h"
#include "content/urldb.h"
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
#include "desktop/history_global_core.h"
#include "desktop/hotlist.h"
#include "desktop/tree_url_node.h"
diff --git a/atari/misc.c b/atari/misc.c
index 96abcf5..75410d2 100755
--- a/atari/misc.c
+++ b/atari/misc.c
@@ -27,9 +27,8 @@
#include "content/content.h"
#include "content/hlcache.h"
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
#include "desktop/mouse.h"
-#include "desktop/cookies.h"
#include "desktop/tree.h"
#include "utils/nsoption.h"
#include "utils/messages.h"
diff --git a/beos/gui.cpp b/beos/gui.cpp
index 7667822..0abef08 100644
--- a/beos/gui.cpp
+++ b/beos/gui.cpp
@@ -50,7 +50,7 @@ extern "C" {
#include "content/urldb.h"
#include "desktop/401login.h"
#include "desktop/browser_private.h"
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
#include "desktop/gui.h"
#include "desktop/netsurf.h"
#include "utils/nsoption.h"
diff --git a/cocoa/NetSurf.xcodeproj/project.pbxproj b/cocoa/NetSurf.xcodeproj/project.pbxproj
index ca0bed6..ef25d2f 100644
--- a/cocoa/NetSurf.xcodeproj/project.pbxproj
+++ b/cocoa/NetSurf.xcodeproj/project.pbxproj
@@ -41,7 +41,7 @@
260F1F8512D620E800D9B07F /* browser.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = browser.c; sourceTree = "<group>"; };
260F1F8612D620E800D9B07F /* browser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = browser.h; sourceTree = "<group>"; };
260F1F8712D620E800D9B07F /* cookies.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cookies.c; sourceTree = "<group>"; };
- 260F1F8812D620E800D9B07F /* cookies.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cookies.h; sourceTree = "<group>"; };
+ 260F1F8812D620E800D9B07F /* cookies_old.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cookies_old.h; sourceTree = "<group>"; };
260F1F8912D620E800D9B07F /* download.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = download.c; sourceTree = "<group>"; };
260F1F8A12D620E800D9B07F /* download.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = download.h; sourceTree = "<group>"; };
260F1F8B12D620E800D9B07F /* frames.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = frames.c; sourceTree = "<group>"; };
@@ -398,7 +398,7 @@
260F1F8512D620E800D9B07F /* browser.c */,
260F1F8612D620E800D9B07F /* browser.h */,
260F1F8712D620E800D9B07F /* cookies.c */,
- 260F1F8812D620E800D9B07F /* cookies.h */,
+ 260F1F8812D620E800D9B07F /* cookies_old.h */,
260F1F8912D620E800D9B07F /* download.c */,
260F1F8A12D620E800D9B07F /* download.h */,
260F1F8B12D620E800D9B07F /* frames.c */,
diff --git a/content/urldb.c b/content/urldb.c
index c950dcd..feb7c6f 100644
--- a/content/urldb.c
+++ b/content/urldb.c
@@ -100,7 +100,8 @@
#include "image/bitmap.h"
#include "content/content.h"
#include "content/urldb.h"
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
+#include "desktop/cookie_manager.h"
#include "utils/nsoption.h"
#include "utils/log.h"
#include "utils/corestrings.h"
@@ -2540,7 +2541,13 @@ char *urldb_get_cookie(nsurl *url, bool include_http_only)
version = c->version;
c->last_used = now;
- cookies_schedule_update((struct cookie_data *)c);
+
+ if (nsoption_bool(temp_treeview_test) == false)
+ cookies_schedule_update(
+ (struct cookie_data *)c);
+ else
+ cookie_manager_add(
+ (struct cookie_data *)c);
}
}
}
@@ -2575,7 +2582,13 @@ char *urldb_get_cookie(nsurl *url, bool include_http_only)
version = c->version;
c->last_used = now;
- cookies_schedule_update((struct cookie_data *)c);
+
+ if (nsoption_bool(temp_treeview_test) == false)
+ cookies_schedule_update(
+ (struct cookie_data *)c);
+ else
+ cookie_manager_add(
+ (struct cookie_data *)c);
}
}
@@ -2618,7 +2631,12 @@ char *urldb_get_cookie(nsurl *url, bool include_http_only)
version = c->version;
c->last_used = now;
- cookies_schedule_update((struct cookie_data *)c);
+
+ if (nsoption_bool(temp_treeview_test) == false)
+ cookies_schedule_update(
+ (struct cookie_data *)c);
+ else
+ cookie_manager_add((struct cookie_data *)c);
}
}
@@ -2651,7 +2669,12 @@ char *urldb_get_cookie(nsurl *url, bool include_http_only)
version = c->version;
c->last_used = now;
- cookies_schedule_update((struct cookie_data *)c);
+
+ if (nsoption_bool(temp_treeview_test) == false)
+ cookies_schedule_update(
+ (struct cookie_data *)c);
+ else
+ cookie_manager_add((struct cookie_data *)c);
}
}
@@ -3405,8 +3428,12 @@ bool urldb_insert_cookie(struct cookie_internal_data *c, lwc_string *scheme,
d->prev->next = d->next;
else
p->cookies = d->next;
-
- cookies_remove((struct cookie_data *)d);
+
+ if (nsoption_bool(temp_treeview_test) == false)
+ cookies_remove((struct cookie_data *)d);
+ else
+ cookie_manager_remove((struct cookie_data *)d);
+
urldb_free_cookie(d);
urldb_free_cookie(c);
} else {
@@ -3421,11 +3448,18 @@ bool urldb_insert_cookie(struct cookie_internal_data *c, lwc_string *scheme,
c->prev->next = c;
else
p->cookies = c;
-
- cookies_remove((struct cookie_data *)d);
+
+ if (nsoption_bool(temp_treeview_test) == false)
+ cookies_remove((struct cookie_data *)d);
+ else
+ cookie_manager_remove((struct cookie_data *)d);
urldb_free_cookie(d);
-
- cookies_schedule_update((struct cookie_data *)c);
+
+ if (nsoption_bool(temp_treeview_test) == false)
+ cookies_schedule_update(
+ (struct cookie_data *)c);
+ else
+ cookie_manager_add((struct cookie_data *)c);
}
} else {
c->prev = p->cookies_end;
@@ -3436,7 +3470,10 @@ bool urldb_insert_cookie(struct cookie_internal_data *c, lwc_string *scheme,
p->cookies = c;
p->cookies_end = c;
- cookies_schedule_update((struct cookie_data *)c);
+ if (nsoption_bool(temp_treeview_test) == false)
+ cookies_schedule_update((struct cookie_data *)c);
+ else
+ cookie_manager_add((struct cookie_data *)c);
}
return true;
@@ -3835,7 +3872,6 @@ void urldb_delete_cookie_paths(const char *domain, const char *path,
else
p->cookies_end = c->prev;
- cookies_remove((struct cookie_data *)c);
urldb_free_cookie(c);
return;
diff --git a/desktop/Makefile b/desktop/Makefile
index ded75aa..90ca5e0 100644
--- a/desktop/Makefile
+++ b/desktop/Makefile
@@ -1,6 +1,6 @@
# Sources for desktop
-S_DESKTOP := cookies.c history_global_core.c hotlist.c knockout.c \
+S_DESKTOP := cookie_manager.c cookies_old.c history_global_core.c hotlist.c knockout.c \
mouse.c plot_style.c print.c search.c searchweb.c \
scrollbar.c sslcert.c textarea.c thumbnail.c tree.c \
tree_url_node.c version.c system_colour.c global_history.c treeview.c
diff --git a/desktop/cookie_manager.c b/desktop/cookie_manager.c
new file mode 100644
index 0000000..c35251e
--- /dev/null
+++ b/desktop/cookie_manager.c
@@ -0,0 +1,846 @@
+/*
+ * Copyright 2013 Michael Drake <tlsa(a)netsurf-browser.org>
+ *
+ * This file is part of NetSurf, http://www.netsurf-browser.org/
+ *
+ * NetSurf is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * NetSurf is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/** \file
+ * Cookie Manager (implementation).
+ */
+
+
+#include <stdlib.h>
+
+#include "content/urldb.h"
+#include "desktop/browser.h"
+#include "desktop/cookie_manager.h"
+#include "desktop/treeview.h"
+#include "utils/messages.h"
+#include "utils/utils.h"
+#include "utils/log.h"
+
+enum cookie_manager_field {
+ CM_NAME,
+ CM_CONTENT,
+ CM_DOMAIN,
+ CM_PATH,
+ CM_EXPIRES,
+ CM_LAST_USED,
+ CM_RESTRICTIONS,
+ CM_VERSION,
+ CM_PERSISTENT,
+ CM_DOMAIN_FOLDER,
+ N_FIELDS
+};
+
+enum cookie_manager_value {
+ CM_HTTPS,
+ CM_SECURE,
+ CM_HTTP,
+ CM_NONE,
+ CM_NETSCAPE,
+ CM_RFC2109,
+ CM_RFC2965,
+ CM_YES,
+ CM_NO,
+ N_VALUES
+};
+
+struct cookie_manager_folder {
+ treeview_node *folder;
+ struct treeview_field_data data;
+};
+
+struct cookie_manager_ctx {
+ treeview *tree;
+ struct treeview_field_desc fields[N_FIELDS];
+ struct treeview_field_data values[N_VALUES];
+ bool built;
+};
+struct cookie_manager_ctx cm_ctx;
+
+struct cookie_manager_entry {
+ bool user_delete;
+
+ treeview_node *entry;
+
+ struct treeview_field_data data[N_FIELDS - 1];
+};
+
+
+struct treeview_walk_ctx {
+ const char *title;
+ size_t title_len;
+ struct cookie_manager_folder *folder;
+ struct cookie_manager_entry *entry;
+};
+/** Callback for treeview_walk */
+static nserror cookie_manager_walk_cb(void *ctx, void *node_data,
+ enum treeview_node_type type, bool *abort)
+{
+ struct treeview_walk_ctx *tw = ctx;
+
+ if (type == TREE_NODE_ENTRY) {
+ struct cookie_manager_entry *entry = node_data;
+
+ if (entry->data[CM_NAME].value_len == tw->title_len &&
+ strcmp(tw->title,
+ entry->data[CM_NAME].value) == 0) {
+ /* Found what we're looking for */
+ tw->entry = entry;
+ *abort = true;
+ }
+
+ } else if (type == TREE_NODE_FOLDER) {
+ struct cookie_manager_folder *folder = node_data;
+
+ if (folder->data.value_len == tw->title_len &&
+ strcmp(tw->title, folder->data.value) == 0) {
+ /* Found what we're looking for */
+ tw->folder = folder;
+ *abort = true;
+ }
+ }
+
+ return NSERROR_OK;
+}
+/**
+ * Find a cookie entry in the cookie manager's treeview
+ *
+ * \param root Search root node, or NULL to search from tree's root
+ * \param title ID of the node to look for
+ * \param title_len Byte length of title string
+ * \param found Updated to the matching node's cookie maanger entry
+ * \return NSERROR_OK on success, appropriate error otherwise
+ */
+static nserror cookie_manager_find_entry(treeview_node *root,
+ const char *title, size_t title_len,
+ struct cookie_manager_entry **found)
+{
+ nserror err;
+ struct treeview_walk_ctx tw = {
+ .title = title,
+ .title_len = title_len,
+ .folder = NULL,
+ .entry = NULL
+ };
+
+ err = treeview_walk(cm_ctx.tree, root, cookie_manager_walk_cb, &tw,
+ TREE_NODE_ENTRY);
+ if (err != NSERROR_OK)
+ return err;
+
+ *found = tw.entry;
+
+ return NSERROR_OK;
+}
+/**
+ * Find a cookie domain folder in the cookie manager's treeview
+ *
+ * \param root Search root node, or NULL to search from tree's root
+ * \param title ID of the node to look for
+ * \param title_len Byte length of title string
+ * \param found Updated to the matching node's cookie maanger folder
+ * \return NSERROR_OK on success, appropriate error otherwise
+ */
+static nserror cookie_manager_find_folder(treeview_node *root,
+ const char *title, size_t title_len,
+ struct cookie_manager_folder **found)
+{
+ nserror err;
+ struct treeview_walk_ctx tw = {
+ .title = title,
+ .title_len = title_len,
+ .folder = NULL,
+ .entry = NULL
+ };
+
+ err = treeview_walk(cm_ctx.tree, root, cookie_manager_walk_cb, &tw,
+ TREE_NODE_FOLDER);
+ if (err != NSERROR_OK)
+ return err;
+
+ *found = tw.folder;
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * Free a cookie manager entry's treeview field data.
+ *
+ * \param e Cookie manager entry to free data from
+ */
+static void cookie_manager_free_treeview_field_data(
+ struct cookie_manager_entry *e)
+{
+ /* Eww */
+ free((void *)e->data[CM_NAME].value);
+ free((void *)e->data[CM_CONTENT].value);
+ free((void *)e->data[CM_DOMAIN].value);
+ free((void *)e->data[CM_PATH].value);
+ free((void *)e->data[CM_EXPIRES].value);
+ free((void *)e->data[CM_LAST_USED].value);
+}
+
+
+/**
+ * Build a cookie manager treeview field from given text
+ *
+ * \param field Cookie manager treeview field to build
+ * \param data Cookie manager entry field data to set
+ * \param value Text to set in field, ownership yielded
+ * \return NSERROR_OK on success, appropriate error otherwise
+ */
+static inline nserror cookie_manager_field_builder(
+ enum cookie_manager_field field,
+ struct treeview_field_data *data,
+ const char *value)
+{
+ data->field = cm_ctx.fields[field].field;
+ data->value = value;
+ data->value_len = (value != NULL) ? strlen(value) : 0;
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * Set a cookie manager entry's data from the cookie_data.
+ *
+ * \param e Cookie manager entry to set up
+ * \param data Data associated with entry's cookie
+ * \return NSERROR_OK on success, appropriate error otherwise
+ */
+static nserror cookie_manager_set_treeview_field_data(
+ struct cookie_manager_entry *e,
+ const struct cookie_data *data)
+{
+ const char *date;
+ char *date2;
+
+ assert(e != NULL);
+ assert(data != NULL);
+
+ /* Set the fields up */
+ cookie_manager_field_builder(CM_NAME,
+ &e->data[CM_NAME], strdup(data->name));
+ cookie_manager_field_builder(CM_CONTENT,
+ &e->data[CM_CONTENT], strdup(data->value));
+ cookie_manager_field_builder(CM_DOMAIN,
+ &e->data[CM_DOMAIN], strdup(data->domain));
+ cookie_manager_field_builder(CM_PATH,
+ &e->data[CM_PATH], strdup(data->path));
+
+ /* Set the Expires date field */
+ date = ctime(&data->expires);
+ date2 = strdup(date);
+ if (date2 != NULL) {
+ assert(date2[24] == '\n');
+ date2[24] = '\0';
+ }
+ cookie_manager_field_builder(CM_EXPIRES,
+ &e->data[CM_EXPIRES], date2);
+
+ /* Set the Last used date field */
+ date = ctime(&data->last_used);
+ date2 = strdup(date);
+ if (date2 != NULL) {
+ assert(date2[24] == '\n');
+ date2[24] = '\0';
+ }
+ cookie_manager_field_builder(CM_LAST_USED,
+ &e->data[CM_LAST_USED], date2);
+
+ /* Set the Restrictions text */
+ if (data->secure && data->http_only)
+ e->data[CM_RESTRICTIONS] = cm_ctx.values[CM_HTTPS];
+ else if (data->secure)
+ e->data[CM_RESTRICTIONS] = cm_ctx.values[CM_SECURE];
+ else if (data->http_only)
+ e->data[CM_RESTRICTIONS] = cm_ctx.values[CM_HTTP];
+ else
+ e->data[CM_RESTRICTIONS] = cm_ctx.values[CM_NONE];
+
+ /* Set the Version text */
+ switch (data->version) {
+ case COOKIE_NETSCAPE:
+ e->data[CM_VERSION] = cm_ctx.values[CM_NETSCAPE];
+ break;
+ case COOKIE_RFC2109:
+ e->data[CM_VERSION] = cm_ctx.values[CM_RFC2109];
+ break;
+ case COOKIE_RFC2965:
+ e->data[CM_VERSION] = cm_ctx.values[CM_RFC2965];
+ break;
+ }
+
+ /* Set the Persistent text */
+ if (data->no_destroy)
+ e->data[CM_PERSISTENT] = cm_ctx.values[CM_YES];
+ else
+ e->data[CM_PERSISTENT] = cm_ctx.values[CM_NO];
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * Creates an empty tree entry for a cookie, and links it into the tree.
+ *
+ * All information is copied from the cookie_data, and as such can
+ * be edited and should be freed.
+ *
+ * \param parent the node to link to
+ * \param data the cookie data to use
+ * \return NSERROR_OK on success, appropriate error otherwise
+ */
+static nserror cookie_manager_create_cookie_node(
+ struct cookie_manager_folder *parent,
+ const struct cookie_data *data)
+{
+ nserror err;
+ struct cookie_manager_entry *cookie;
+
+ /* Create new cookie manager entry */
+ cookie = malloc(sizeof(struct cookie_manager_entry));
+ if (cookie == NULL) {
+ return NSERROR_NOMEM;
+ }
+
+ cookie->user_delete = false;
+
+ err = cookie_manager_set_treeview_field_data(cookie, data);
+ if (err != NSERROR_OK) {
+ free(cookie);
+ return err;
+ }
+
+ err = treeview_create_node_entry(cm_ctx.tree, &(cookie->entry),
+ parent->folder, TREE_REL_FIRST_CHILD,
+ cookie->data, cookie,
+ cm_ctx.built ? TREE_CREATE_NONE :
+ TREE_CREATE_SUPPRESS_RESIZE);
+ if (err != NSERROR_OK) {
+ cookie_manager_free_treeview_field_data(cookie);
+ free(cookie);
+ return err;
+ }
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * Updates a cookie manager entry for updated cookie_data.
+ *
+ * All information is copied from the cookie_data, and as such can
+ * be edited and should be freed.
+ *
+ * \param e the entry to update
+ * \param data the cookie data to use
+ * \return NSERROR_OK on success, appropriate error otherwise
+ */
+static nserror cookie_manager_update_cookie_node(
+ struct cookie_manager_entry *e,
+ const struct cookie_data *data)
+{
+ nserror err;
+
+ assert(e != NULL);
+
+ /* Reset to defaults */
+ e->user_delete = false;
+ cookie_manager_free_treeview_field_data(e);
+
+ /* Set new field values from the cookie_data */
+ err = cookie_manager_set_treeview_field_data(e, data);
+ if (err != NSERROR_OK) {
+ return err;
+ }
+
+ /* Update the treeview */
+ err = treeview_update_node_entry(cm_ctx.tree, e->entry, e->data, e);
+ if (err != NSERROR_OK) {
+ return err;
+ }
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * Creates an empty tree folder for a cookie domain, and links it into the tree.
+ *
+ * All information is copied from the cookie_data, and as such can
+ * be edited and should be freed.
+ *
+ * \param folder updated to the new folder
+ * \param data the cookie data to use
+ * \return NSERROR_OK on success, appropriate error otherwise
+ */
+static nserror cookie_manager_create_domain_folder(
+ struct cookie_manager_folder **folder,
+ const struct cookie_data *data)
+{
+ nserror err;
+ struct cookie_manager_folder *f;
+
+ /* Create new cookie manager entry */
+ f = malloc(sizeof(struct cookie_manager_folder));
+ if (f == NULL) {
+ return NSERROR_NOMEM;
+ }
+
+ f->data.field = cm_ctx.fields[N_FIELDS - 1].field;
+ f->data.value = strdup(data->domain);
+ f->data.value_len = (f->data.value != NULL) ?
+ strlen(data->domain) : 0;
+
+ err = treeview_create_node_folder(cm_ctx.tree, &(f->folder),
+ NULL, TREE_REL_FIRST_CHILD, &f->data, f,
+ cm_ctx.built ? TREE_CREATE_NONE :
+ TREE_CREATE_SUPPRESS_RESIZE);
+ if (err != NSERROR_OK) {
+ free((void *)f->data.value);
+ free(f);
+ return err;
+ }
+
+ *folder = f;
+
+ return NSERROR_OK;
+}
+
+
+/* exported interface documented in cookie_manager.h */
+bool cookie_manager_add(const struct cookie_data *data)
+{
+ struct cookie_manager_folder *parent = NULL;
+ struct cookie_manager_entry *cookie = NULL;
+ nserror err;
+
+ assert(data != NULL);
+
+ /* If we don't have a cookie manager at the moment, just return true */
+ if (cm_ctx.tree == NULL)
+ return true;
+
+ err = cookie_manager_find_folder(NULL, data->domain,
+ strlen(data->domain), &parent);
+ if (err != NSERROR_OK) {
+ return false;
+ }
+
+ if (parent == NULL) {
+ /* Need to create domain directory */
+ err = cookie_manager_create_domain_folder(&parent, data);
+ if (err != NSERROR_OK || parent == NULL)
+ return false;
+ }
+
+ /* Create cookie node */
+ err = cookie_manager_find_entry(parent->folder, data->name,
+ strlen(data->name), &cookie);
+ if (err != NSERROR_OK)
+ return false;
+
+ if (cookie == NULL) {
+ err = cookie_manager_create_cookie_node(parent, data);
+ } else {
+ err = cookie_manager_update_cookie_node(cookie, data);
+ }
+ if (err != NSERROR_OK)
+ return false;
+
+ return true;
+}
+
+
+/* exported interface documented in cookie_manager.h */
+void cookie_manager_remove(const struct cookie_data *data)
+{
+ struct cookie_manager_folder *parent = NULL;
+ struct cookie_manager_entry *cookie = NULL;
+ nserror err;
+
+ assert(data != NULL);
+
+ /* If we don't have a cookie manager at the moment, just return */
+ if (cm_ctx.tree == NULL)
+ return;
+
+ err = cookie_manager_find_folder(NULL, data->domain,
+ strlen(data->domain), &parent);
+ if (err != NSERROR_OK || parent == NULL) {
+ /* Nothing to delete */
+ return;
+ }
+
+ err = cookie_manager_find_entry(parent->folder, data->name,
+ strlen(data->name), &cookie);
+ if (err != NSERROR_OK || cookie == NULL) {
+ /* Nothing to delete */
+ return;
+ }
+
+ /* Delete the node */
+ treeview_delete_node(cm_ctx.tree, cookie->entry);
+}
+
+
+/**
+ * Initialise the treeview entry feilds
+ *
+ * \return true on success, false on memory exhaustion
+ */
+static nserror cookie_manager_init_entry_fields(void)
+{
+ int i;
+ const char *label;
+
+ for (i = 0; i < N_FIELDS; i++)
+ cm_ctx.fields[i].field = NULL;
+
+ cm_ctx.fields[CM_NAME].flags = TREE_FLAG_DEFAULT;
+ label = "TreeviewLabelName";
+ label = messages_get(label);
+ if (lwc_intern_string(label, strlen(label),
+ &cm_ctx.fields[CM_NAME].field) !=
+ lwc_error_ok) {
+ goto error;
+ }
+
+ cm_ctx.fields[CM_CONTENT].flags = TREE_FLAG_SHOW_NAME;
+ label = "TreeviewLabelContent";
+ label = messages_get(label);
+ if (lwc_intern_string(label, strlen(label),
+ &cm_ctx.fields[CM_CONTENT].field) !=
+ lwc_error_ok) {
+ goto error;
+ }
+
+ cm_ctx.fields[CM_DOMAIN].flags = TREE_FLAG_SHOW_NAME;
+ label = "TreeviewLabelDomain";
+ label = messages_get(label);
+ if (lwc_intern_string(label, strlen(label),
+ &cm_ctx.fields[CM_DOMAIN].field) !=
+ lwc_error_ok) {
+ goto error;
+ }
+
+ cm_ctx.fields[CM_PATH].flags = TREE_FLAG_SHOW_NAME;
+ label = "TreeviewLabelPath";
+ label = messages_get(label);
+ if (lwc_intern_string(label, strlen(label),
+ &cm_ctx.fields[CM_PATH].field) !=
+ lwc_error_ok) {
+ goto error;
+ }
+
+ cm_ctx.fields[CM_EXPIRES].flags = TREE_FLAG_SHOW_NAME;
+ label = "TreeviewLabelExpires";
+ label = messages_get(label);
+ if (lwc_intern_string(label, strlen(label),
+ &cm_ctx.fields[CM_EXPIRES].field) !=
+ lwc_error_ok) {
+ goto error;
+ }
+
+ cm_ctx.fields[CM_LAST_USED].flags = TREE_FLAG_SHOW_NAME;
+ label = "TreeviewLabelLastUsed";
+ label = messages_get(label);
+ if (lwc_intern_string(label, strlen(label),
+ &cm_ctx.fields[CM_LAST_USED].field) !=
+ lwc_error_ok) {
+ goto error;
+ }
+
+ cm_ctx.fields[CM_RESTRICTIONS].flags = TREE_FLAG_SHOW_NAME;
+ label = "TreeviewLabelRestrictions";
+ label = messages_get(label);
+ if (lwc_intern_string(label, strlen(label),
+ &cm_ctx.fields[CM_RESTRICTIONS].field) !=
+ lwc_error_ok) {
+ goto error;
+ }
+
+ cm_ctx.fields[CM_VERSION].flags = TREE_FLAG_SHOW_NAME;
+ label = "TreeviewLabelVersion";
+ label = messages_get(label);
+ if (lwc_intern_string(label, strlen(label),
+ &cm_ctx.fields[CM_VERSION].field) !=
+ lwc_error_ok) {
+ goto error;
+ }
+
+ cm_ctx.fields[CM_PERSISTENT].flags = TREE_FLAG_SHOW_NAME;
+ label = "TreeviewLabelPersistent";
+ label = messages_get(label);
+ if (lwc_intern_string(label, strlen(label),
+ &cm_ctx.fields[CM_PERSISTENT].field) !=
+ lwc_error_ok) {
+ goto error;
+ }
+
+ cm_ctx.fields[CM_DOMAIN_FOLDER].flags = TREE_FLAG_DEFAULT;
+ label = "TreeviewLabelDomainFolder";
+ label = messages_get(label);
+ if (lwc_intern_string(label, strlen(label),
+ &cm_ctx.fields[CM_DOMAIN_FOLDER].field) !=
+ lwc_error_ok) {
+ return false;
+ }
+
+ return NSERROR_OK;
+
+error:
+ for (i = 0; i < N_FIELDS; i++)
+ if (cm_ctx.fields[i].field != NULL)
+ lwc_string_unref(cm_ctx.fields[i].field);
+
+ return NSERROR_UNKNOWN;
+}
+
+
+
+/**
+ * Initialise the common entry values
+ *
+ * \return true on success, false on memory exhaustion
+ */
+static nserror cookie_manager_init_common_values(void)
+{
+ const char *temp;
+
+ /* Set the Restrictions text */
+ temp = messages_get("CookieManagerHTTPS");
+ cookie_manager_field_builder(CM_RESTRICTIONS,
+ &cm_ctx.values[CM_HTTPS], strdup(temp));
+
+ temp = messages_get("CookieManagerSecure");
+ cookie_manager_field_builder(CM_RESTRICTIONS,
+ &cm_ctx.values[CM_SECURE], strdup(temp));
+
+ temp = messages_get("CookieManagerHTTP");
+ cookie_manager_field_builder(CM_RESTRICTIONS,
+ &cm_ctx.values[CM_HTTP], strdup(temp));
+
+ temp = messages_get("None");
+ cookie_manager_field_builder(CM_RESTRICTIONS,
+ &cm_ctx.values[CM_NONE], strdup(temp));
+
+ /* Set the Cookie version text */
+ assert(COOKIE_NETSCAPE == 0);
+ temp = messages_get("TreeVersion0");
+ cookie_manager_field_builder(CM_VERSION,
+ &cm_ctx.values[CM_NETSCAPE], strdup(temp));
+
+ assert(COOKIE_RFC2109 == 1);
+ temp = messages_get("TreeVersion1");
+ cookie_manager_field_builder(CM_VERSION,
+ &cm_ctx.values[CM_RFC2109], strdup(temp));
+
+ assert(COOKIE_RFC2965 == 2);
+ temp = messages_get("TreeVersion2");
+ cookie_manager_field_builder(CM_VERSION,
+ &cm_ctx.values[CM_RFC2965], strdup(temp));
+
+ /* Set the Persistent value text */
+ temp = messages_get("Yes");
+ cookie_manager_field_builder(CM_PERSISTENT,
+ &cm_ctx.values[CM_YES], strdup(temp));
+
+ temp = messages_get("No");
+ cookie_manager_field_builder(CM_PERSISTENT,
+ &cm_ctx.values[CM_NO], strdup(temp));
+
+ return NSERROR_OK;
+}
+
+
+/**
+ * Delete cookie manager entries (and optionally delete from urldb)
+ *
+ * \param e Cookie manager entry to delete.
+ */
+static void cookie_manager_delete_entry(struct cookie_manager_entry *e)
+{
+ const char *domain;
+ const char *path;
+ const char *name;
+
+ if (e->user_delete) {
+ /* Delete the cookie from URLdb */
+ domain = e->data[CM_DOMAIN].value;
+ path = e->data[CM_PATH].value;
+ name = e->data[CM_NAME].value;
+
+ if ((domain != NULL) && (path != NULL) && (name != NULL)) {
+
+ urldb_delete_cookie(domain, path, name);
+ } else {
+ LOG(("Delete cookie fail: "
+ "need domain, path, and name."));
+ }
+ }
+
+ /* Delete the cookie manager entry */
+ cookie_manager_free_treeview_field_data(e);
+ free(e);
+}
+
+
+static nserror cookie_manager_tree_node_folder_cb(
+ struct treeview_node_msg msg, void *data)
+{
+ struct cookie_manager_folder *f = data;
+
+ switch (msg.msg) {
+ case TREE_MSG_NODE_DELETE:
+ free(f);
+ break;
+
+ case TREE_MSG_NODE_EDIT:
+ break;
+
+ case TREE_MSG_NODE_LAUNCH:
+ break;
+ }
+
+ return NSERROR_OK;
+}
+static nserror cookie_manager_tree_node_entry_cb(
+ struct treeview_node_msg msg, void *data)
+{
+ struct cookie_manager_entry *e = data;
+
+ switch (msg.msg) {
+ case TREE_MSG_NODE_DELETE:
+ e->entry = NULL;
+ e->user_delete = msg.data.delete.user;
+ cookie_manager_delete_entry(e);
+ break;
+
+ case TREE_MSG_NODE_EDIT:
+ break;
+
+ case TREE_MSG_NODE_LAUNCH:
+ break;
+ }
+ return NSERROR_OK;
+}
+struct treeview_callback_table cm_tree_cb_t = {
+ .folder = cookie_manager_tree_node_folder_cb,
+ .entry = cookie_manager_tree_node_entry_cb
+};
+
+
+/* Exported interface, documented in cookie_manager.h */
+nserror cookie_manager_init(struct core_window_callback_table *cw_t,
+ void *core_window_handle)
+{
+ nserror err;
+
+ LOG(("Generating cookie manager data"));
+
+ /* Init. cookie manager treeview entry fields */
+ err = cookie_manager_init_entry_fields();
+ if (err != NSERROR_OK) {
+ cm_ctx.tree = NULL;
+ return err;
+ }
+
+ /* Init. common treeview field values */
+ err = cookie_manager_init_common_values();
+ if (err != NSERROR_OK) {
+ cm_ctx.tree = NULL;
+ return err;
+ }
+
+ /* Create the cookie manager treeview */
+ err = treeview_create(&cm_ctx.tree, &cm_tree_cb_t,
+ N_FIELDS, cm_ctx.fields,
+ cw_t, core_window_handle,
+ TREEVIEW_NO_MOVES | TREEVIEW_DEL_EMPTY_DIRS);
+ if (err != NSERROR_OK) {
+ cm_ctx.tree = NULL;
+ return err;
+ }
+
+ /* Load the cookies */
+ urldb_iterate_cookies(cookie_manager_add);
+
+ /* Cookie manager is built
+ * We suppress the treeview height callback on entry insertion before
+ * the treeview is built. */
+ cm_ctx.built = true;
+
+ LOG(("Generated cookie manager data"));
+
+ return NSERROR_OK;
+}
+
+
+/* Exported interface, documented in cookie_manager.h */
+nserror cookie_manager_fini(void)
+{
+ int i;
+ nserror err;
+
+ LOG(("Finalising cookie manager"));
+
+ cm_ctx.built = false;
+
+ /* Destroy the cookie manager treeview */
+ err = treeview_destroy(cm_ctx.tree);
+
+ /* Free cookie manager treeview entry fields */
+ for (i = 0; i < N_FIELDS; i++)
+ if (cm_ctx.fields[i].field != NULL)
+ lwc_string_unref(cm_ctx.fields[i].field);
+
+ /* Free cookie manager treeview common entry values */
+ for (i = 0; i < N_VALUES; i++)
+ if (cm_ctx.values[i].value != NULL)
+ free((void *) cm_ctx.values[i].value);
+
+ LOG(("Finalised cookie manager"));
+
+ return err;
+}
+
+
+/* Exported interface, documented in cookie_manager.h */
+void cookie_manager_redraw(int x, int y, struct rect *clip,
+ const struct redraw_context *ctx)
+{
+ treeview_redraw(cm_ctx.tree, x, y, clip, ctx);
+}
+
+
+/* Exported interface, documented in cookie_manager.h */
+void cookie_manager_mouse_action(browser_mouse_state mouse, int x, int y)
+{
+ treeview_mouse_action(cm_ctx.tree, mouse, x, y);
+}
+
+
+/* Exported interface, documented in cookie_manager.h */
+void cookie_manager_keypress(uint32_t key)
+{
+ treeview_keypress(cm_ctx.tree, key);
+}
+
diff --git a/desktop/global_history.h b/desktop/cookie_manager.h
similarity index 55%
copy from desktop/global_history.h
copy to desktop/cookie_manager.h
index 3863e81..7249236 100644
--- a/desktop/global_history.h
+++ b/desktop/cookie_manager.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 - 2013 Michael Drake <tlsa(a)netsurf-browser.org>
+ * Copyright 2013 Michael Drake <tlsa(a)netsurf-browser.org>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -15,61 +15,70 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-
-#ifndef _NETSURF_DESKTOP_GLOBAL_HISTORY_H_
-#define _NETSURF_DESKTOP_GLOBAL_HISTORY_H_
+
+/** \file
+ * Cookie Manager (interface).
+ */
+
+#ifndef _NETSURF_DESKTOP_COOKIE_MANAGER_H_
+#define _NETSURF_DESKTOP_COOKIE_MANAGER_H_
#include <stdbool.h>
#include "desktop/core_window.h"
-#include "utils/nsurl.h"
+struct cookie_data;
/**
- * Initialise the global history.
+ * Initialise the cookie manager.
*
- * This iterates through the URL database, generating the global history data,
- * and creates a treeview.
+ * This iterates through the URL database, enumerating the cookies and
+ * creates a treeview.
*
- * This must be called before any other global_history_* function.
+ * This must be called before any other cookie_manager_* function.
*
* \param cw_t Callback table for core_window containing the treeview
* \param cw The core_window in which the treeview is shown
* \return NSERROR_OK on success, appropriate error otherwise
*/
-nserror global_history_init(struct core_window_callback_table *cw_t,
+nserror cookie_manager_init(struct core_window_callback_table *cw_t,
void *core_window_handle);
/**
- * Finalise the global history.
+ * Finalise the cookie manager.
*
- * This destroys the global history treeview and the global history module's
- * internal data. After calling this if global history is required again,
- * global_history_init must be called.
+ * This destroys the cookie manager treeview and the cookie manager module's
+ * internal data. After calling this if the cookie manager is required again,
+ * cookie_manager_init must be called.
*
* \return NSERROR_OK on success, appropriate error otherwise
*/
-nserror global_history_fini(void);
+nserror cookie_manager_fini(void);
/**
- * Add an entry to the global history.
+ * Add/update a cookie to the viewer. (Called by urldb.)
*
- * If the URL already exists in the global history, the old node is removed.
+ * \param data Data of cookie being added/updated.
+ * \return true (for urldb_iterate_entries)
+ */
+bool cookie_manager_add(const struct cookie_data *data);
+
+/**
+ * Remove a cookie from viewer. (Called by urldb.)
*
- * \param url URL for node being added
- * \return NSERROR_OK on success, appropriate error otherwise
+ * \param data Data of cookie being removed.
*/
-nserror global_history_add(nsurl *url);
+void cookie_manager_remove(const struct cookie_data *data);
/**
- * Redraw the global history.
+ * Redraw the cookies manager.
*
* \param x X coordinate to render treeview at
* \param x Y coordinate to render treeview at
* \param clip Current clip rectangle (wrt tree origin)
* \param ctx Current redraw context
*/
-void global_history_redraw(int x, int y, struct rect *clip,
+void cookie_manager_redraw(int x, int y, struct rect *clip,
const struct redraw_context *ctx);
/**
@@ -79,7 +88,7 @@ void global_history_redraw(int x, int y, struct rect *clip,
* \param x X coordinate
* \param y Y coordinate
*/
-void global_history_mouse_action(browser_mouse_state mouse, int x, int y);
+void cookie_manager_mouse_action(browser_mouse_state mouse, int x, int y);
/**
@@ -88,6 +97,6 @@ void global_history_mouse_action(browser_mouse_state mouse, int x, int y);
* \param key The ucs4 character codepoint
* \return true if the keypress is dealt with, false otherwise.
*/
-void global_history_keypress(uint32_t key);
+void cookie_manager_keypress(uint32_t key);
#endif
diff --git a/desktop/cookies.c b/desktop/cookies_old.c
similarity index 98%
rename from desktop/cookies.c
rename to desktop/cookies_old.c
index 9f66aea..0aaf61f 100644
--- a/desktop/cookies.c
+++ b/desktop/cookies_old.c
@@ -30,7 +30,7 @@
#include "content/content.h"
#include "content/hlcache.h"
#include "content/urldb.h"
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
#include "utils/nsoption.h"
#include "desktop/tree.h"
#include "utils/log.h"
@@ -365,6 +365,8 @@ bool cookies_initialise(struct tree *tree, const char* folder_icon_name, const c
if (tree == NULL)
return false;
+ LOG(("Making cookie tree"));
+
folder_icon = tree_load_icon(folder_icon_name);
cookie_icon = tree_load_icon(cookie_icon_name);
@@ -377,6 +379,8 @@ bool cookies_initialise(struct tree *tree, const char* folder_icon_name, const c
tree_set_node_expanded(cookies_tree, cookies_tree_root,
false, true, true);
+ LOG(("Made cookie tree"));
+
return true;
}
@@ -388,11 +392,11 @@ bool cookies_initialise(struct tree *tree, const char* folder_icon_name, const c
*/
unsigned int cookies_get_tree_flags(void)
{
- return TREE_DELETE_EMPTY_DIRS;
+ return TREE_DELETE_EMPTY_DIRS | TREE_COOKIES;
}
-/* exported interface documented in cookies.h */
+/* exported interface documented in cookies_old.h */
bool cookies_schedule_update(const struct cookie_data *data)
{
assert(data != NULL);
@@ -405,7 +409,7 @@ bool cookies_schedule_update(const struct cookie_data *data)
}
-/* exported interface documented in cookies.h */
+/* exported interface documented in cookies_old.h */
void cookies_remove(const struct cookie_data *data)
{
assert(data != NULL);
diff --git a/desktop/cookies.h b/desktop/cookies_old.h
similarity index 95%
rename from desktop/cookies.h
rename to desktop/cookies_old.h
index 9e0d79f..18ba658 100644
--- a/desktop/cookies.h
+++ b/desktop/cookies_old.h
@@ -20,8 +20,8 @@
* Cookies (interface).
*/
-#ifndef _NETSURF_DESKTOP_COOKIES_H_
-#define _NETSURF_DESKTOP_COOKIES_H_
+#ifndef _NETSURF_DESKTOP_COOKIES_OLD_H_
+#define _NETSURF_DESKTOP_COOKIES_OLD_H_
#include <stdbool.h>
diff --git a/desktop/global_history.c b/desktop/global_history.c
index 05822d7..902d879 100644
--- a/desktop/global_history.c
+++ b/desktop/global_history.c
@@ -27,7 +27,6 @@
#include "utils/utils.h"
#include "utils/log.h"
-#define N_FIELDS 5
#define N_DAYS 28
#define N_SEC_PER_DAY (60 * 60 * 24)
@@ -45,6 +44,15 @@ enum global_history_folders {
GH_N_FOLDERS
};
+enum global_history_fields {
+ GH_TITLE,
+ GH_URL,
+ GH_LAST_VISIT,
+ GH_VISITS,
+ GH_PERIOD,
+ N_FIELDS
+};
+
struct global_history_folder {
treeview_node *folder;
struct treeview_field_data data;
@@ -259,13 +267,14 @@ static nserror global_history_create_treeview_field_data(
char *last_visited2;
int len;
- e->data[0].field = gh_ctx.fields[0].field;
- e->data[0].value = strdup(title);
- e->data[0].value_len = (e->data[0].value != NULL) ? strlen(title) : 0;
+ e->data[GH_TITLE].field = gh_ctx.fields[GH_TITLE].field;
+ e->data[GH_TITLE].value = strdup(title);
+ e->data[GH_TITLE].value_len = (e->data[GH_TITLE].value != NULL) ?
+ strlen(title) : 0;
- e->data[1].field = gh_ctx.fields[1].field;
- e->data[1].value = nsurl_access(e->url);
- e->data[1].value_len = nsurl_length(e->url);
+ e->data[GH_URL].field = gh_ctx.fields[GH_URL].field;
+ e->data[GH_URL].value = nsurl_access(e->url);
+ e->data[GH_URL].value_len = nsurl_length(e->url);
last_visited = ctime(&data->last_visit);
last_visited2 = strdup(last_visited);
@@ -274,9 +283,9 @@ static nserror global_history_create_treeview_field_data(
last_visited2[24] = '\0';
}
- e->data[2].field = gh_ctx.fields[2].field;
- e->data[2].value = last_visited2;
- e->data[2].value_len = (last_visited2 != NULL) ? 24 : 0;
+ e->data[GH_LAST_VISIT].field = gh_ctx.fields[GH_LAST_VISIT].field;
+ e->data[GH_LAST_VISIT].value = last_visited2;
+ e->data[GH_LAST_VISIT].value_len = (last_visited2 != NULL) ? 24 : 0;
len = snprintf(buffer, 16, "%u", data->visits);
if (len == 16) {
@@ -284,9 +293,9 @@ static nserror global_history_create_treeview_field_data(
buffer[len] = '\0';
}
- e->data[3].field = gh_ctx.fields[3].field;
- e->data[3].value = strdup(buffer);
- e->data[3].value_len = len;
+ e->data[GH_VISITS].field = gh_ctx.fields[GH_VISITS].field;
+ e->data[GH_VISITS].value = strdup(buffer);
+ e->data[GH_VISITS].value_len = len;
return NSERROR_OK;
}
@@ -348,7 +357,7 @@ static nserror global_history_add_entry_internal(nsurl *url, int slot,
/* Create new local history entry */
e = malloc(sizeof(struct global_history_entry));
if (e == NULL) {
- return false;
+ return NSERROR_NOMEM;
}
e->user_delete = false;
@@ -442,9 +451,9 @@ static void global_history_delete_entry_internal(
}
/* Destroy fields */
- free((void *)e->data[0].value); /* Eww */
- free((void *)e->data[2].value); /* Eww */
- free((void *)e->data[3].value); /* Eww */
+ free((void *)e->data[GH_TITLE].value); /* Eww */
+ free((void *)e->data[GH_LAST_VISIT].value); /* Eww */
+ free((void *)e->data[GH_VISITS].value); /* Eww */
nsurl_unref(e->url);
/* Destroy entry */
@@ -512,47 +521,47 @@ static nserror global_history_initialise_entry_fields(void)
for (i = 0; i < N_FIELDS; i++)
gh_ctx.fields[i].field = NULL;
- gh_ctx.fields[0].flags = TREE_FLAG_DEFAULT;
+ gh_ctx.fields[GH_TITLE].flags = TREE_FLAG_DEFAULT;
label = "TreeviewLabelTitle";
label = messages_get(label);
if (lwc_intern_string(label, strlen(label),
- &gh_ctx.fields[0].field) !=
+ &gh_ctx.fields[GH_TITLE].field) !=
lwc_error_ok) {
goto error;
}
- gh_ctx.fields[1].flags = TREE_FLAG_NONE;
+ gh_ctx.fields[GH_URL].flags = TREE_FLAG_NONE;
label = "TreeviewLabelURL";
label = messages_get(label);
if (lwc_intern_string(label, strlen(label),
- &gh_ctx.fields[1].field) !=
+ &gh_ctx.fields[GH_URL].field) !=
lwc_error_ok) {
goto error;
}
- gh_ctx.fields[2].flags = TREE_FLAG_SHOW_NAME;
+ gh_ctx.fields[GH_LAST_VISIT].flags = TREE_FLAG_SHOW_NAME;
label = "TreeviewLabelLastVisit";
label = messages_get(label);
if (lwc_intern_string(label, strlen(label),
- &gh_ctx.fields[2].field) !=
+ &gh_ctx.fields[GH_LAST_VISIT].field) !=
lwc_error_ok) {
goto error;
}
- gh_ctx.fields[3].flags = TREE_FLAG_SHOW_NAME;
+ gh_ctx.fields[GH_VISITS].flags = TREE_FLAG_SHOW_NAME;
label = "TreeviewLabelVisits";
label = messages_get(label);
if (lwc_intern_string(label, strlen(label),
- &gh_ctx.fields[3].field) !=
+ &gh_ctx.fields[GH_VISITS].field) !=
lwc_error_ok) {
goto error;
}
- gh_ctx.fields[4].flags = TREE_FLAG_DEFAULT;
+ gh_ctx.fields[GH_PERIOD].flags = TREE_FLAG_DEFAULT;
label = "TreeviewLabelPeriod";
label = messages_get(label);
if (lwc_intern_string(label, strlen(label),
- &gh_ctx.fields[4].field) !=
+ &gh_ctx.fields[GH_PERIOD].field) !=
lwc_error_ok) {
return false;
}
@@ -700,7 +709,7 @@ static nserror global_history_tree_node_entry_cb(
}
return NSERROR_OK;
}
-struct treeview_callback_table tree_cb_t = {
+struct treeview_callback_table gh_tree_cb_t = {
.folder = global_history_tree_node_folder_cb,
.entry = global_history_tree_node_entry_cb
};
@@ -732,7 +741,7 @@ nserror global_history_init(struct core_window_callback_table *cw_t,
urldb_iterate_entries(global_history_add_entry);
/* Create the global history treeview */
- err = treeview_create(&gh_ctx.tree, &tree_cb_t,
+ err = treeview_create(&gh_ctx.tree, &gh_tree_cb_t,
N_FIELDS, gh_ctx.fields,
cw_t, core_window_handle,
TREEVIEW_NO_MOVES | TREEVIEW_DEL_EMPTY_DIRS);
@@ -779,6 +788,8 @@ nserror global_history_fini(void)
LOG(("Finalising global history"));
+ gh_ctx.built = false;
+
/* Destroy the global history treeview */
err = treeview_destroy(gh_ctx.tree);
@@ -789,7 +800,7 @@ nserror global_history_fini(void)
LOG(("Finalised global history"));
- return NSERROR_OK;
+ return err;
}
@@ -798,6 +809,10 @@ nserror global_history_add(nsurl *url)
{
const struct url_data *data;
+ /* If we don't have a global history at the moment, just return OK */
+ if (gh_ctx.tree == NULL)
+ return NSERROR_OK;
+
data = urldb_get_url_data(url);
if (data == NULL) {
LOG(("Can't add URL to history that's not present in urldb."));
diff --git a/desktop/history_global_core.c b/desktop/history_global_core.c
index ce43830..b03485a 100644
--- a/desktop/history_global_core.c
+++ b/desktop/history_global_core.c
@@ -297,7 +297,7 @@ bool history_global_initialise(struct tree *tree, const char* folder_icon_name)
*/
unsigned int history_global_get_tree_flags(void)
{
- return TREE_NO_FLAGS;
+ return TREE_NO_FLAGS | TREE_HISTORY;
}
diff --git a/desktop/hotlist.c b/desktop/hotlist.c
index 055de3a..adc9e5f 100644
--- a/desktop/hotlist.c
+++ b/desktop/hotlist.c
@@ -189,7 +189,7 @@ bool hotlist_initialise(struct tree *tree, const char *hotlist_path,
*/
unsigned int hotlist_get_tree_flags(void)
{
- return TREE_MOVABLE;
+ return TREE_MOVABLE | TREE_HOTLIST;
}
diff --git a/desktop/sslcert.c b/desktop/sslcert.c
index 2b4d726..d5e7f6f 100644
--- a/desktop/sslcert.c
+++ b/desktop/sslcert.c
@@ -73,7 +73,7 @@ void sslcert_init(const char* icon_name)
*/
unsigned int sslcert_get_tree_flags(void)
{
- return TREE_NO_DRAGS | TREE_NO_SELECT;
+ return TREE_NO_DRAGS | TREE_NO_SELECT | TREE_SSLCERT;
}
diff --git a/desktop/tree.c b/desktop/tree.c
index 46910e7..7cac1cb 100644
--- a/desktop/tree.c
+++ b/desktop/tree.c
@@ -177,8 +177,11 @@ struct tree {
#include "desktop/treeview.h"
+#include "desktop/cookie_manager.h"
#include "desktop/global_history.h"
+int treeview_inits;
+
static void treeview_test_redraw_request(struct core_window *cw, struct rect r)
{
struct tree *tree = (struct tree *)cw;
@@ -238,10 +241,22 @@ static bool treeview_test_init(struct tree *tree)
if (nsoption_bool(temp_treeview_test) == false)
return false;
- treeview_init();
- err = global_history_init(&cw_t, (struct core_window *)tree);
- if (err != NSERROR_OK) {
- warn_user("Duffed it.", 0);
+ treeview_inits++;
+
+ if (treeview_inits == 1)
+ treeview_init();
+
+ if (tree->flags & TREE_COOKIES) {
+ err = cookie_manager_init(&cw_t, (struct core_window *)tree);
+ if (err != NSERROR_OK) {
+ warn_user("Couldn't init new cookie manager.", 0);
+ }
+ }
+ if (tree->flags & 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);
+ }
}
return true;
@@ -254,12 +269,23 @@ static bool treeview_test_fini(struct tree *tree)
if (nsoption_bool(temp_treeview_test) == false)
return false;
- err = global_history_fini();
- treeview_fini();
- if (err != NSERROR_OK) {
- warn_user("Duffed it.", 0);
+ if (tree->flags & TREE_COOKIES) {
+ err = cookie_manager_fini();
+ if (err != NSERROR_OK) {
+ warn_user("Couldn't finalise cookie manager.", 0);
+ }
+ }
+ if (tree->flags & TREE_HISTORY) {
+ err = global_history_fini();
+ if (err != NSERROR_OK) {
+ warn_user("Couldn't finalise cookie manager.", 0);
+ }
}
+ if (treeview_inits == 1)
+ treeview_fini();
+ treeview_inits--;
+
return true;
}
@@ -277,9 +303,16 @@ static bool treeview_test_redraw(struct tree *tree, int x, int y,
clip.x1 = clip_x + clip_width;
clip.y1 = clip_y + clip_height;
- global_history_redraw(x, y, &clip, ctx);
+ if (tree->flags & TREE_COOKIES) {
+ cookie_manager_redraw(x, y, &clip, ctx);
+ return true;
+ }
+ if (tree->flags & TREE_HISTORY) {
+ global_history_redraw(x, y, &clip, ctx);
+ return true;
+ }
- return true;
+ return false;
}
static bool treeview_test_mouse_action(struct tree *tree,
@@ -288,9 +321,16 @@ static bool treeview_test_mouse_action(struct tree *tree,
if (nsoption_bool(temp_treeview_test) == false)
return false;
- global_history_mouse_action(mouse, x, y);
+ if (tree->flags & TREE_COOKIES) {
+ cookie_manager_mouse_action(mouse, x, y);
+ return true;
+ }
+ if (tree->flags & TREE_HISTORY) {
+ global_history_mouse_action(mouse, x, y);
+ return true;
+ }
- return true;
+ return false;
}
static bool treeview_test_keypress(struct tree *tree, uint32_t key)
@@ -298,9 +338,16 @@ static bool treeview_test_keypress(struct tree *tree, uint32_t key)
if (nsoption_bool(temp_treeview_test) == false)
return false;
- global_history_keypress(key);
+ if (tree->flags & TREE_COOKIES) {
+ cookie_manager_keypress(key);
+ return true;
+ }
+ if (tree->flags & TREE_HISTORY) {
+ global_history_keypress(key);
+ return true;
+ }
- return true;
+ return false;
}
@@ -420,9 +467,7 @@ struct tree *tree_create(unsigned int flags,
tree_setup_colours();
- if (flags == TREE_MOVABLE) {
- treeview_test_init(tree);
- }
+ treeview_test_init(tree);
return tree;
}
@@ -1267,9 +1312,7 @@ void tree_delete(struct tree *tree)
{
tree->redraw = false;
- if (tree->flags == TREE_MOVABLE) {
- treeview_test_fini(tree);
- }
+ treeview_test_fini(tree);
if (tree->root->child != NULL)
tree_delete_node_internal(tree, tree->root->child, true);
@@ -2196,11 +2239,9 @@ void tree_draw(struct tree *tree, int x, int y,
assert(tree != NULL);
assert(tree->root != NULL);
- if (tree->flags == TREE_MOVABLE) {
- if (treeview_test_redraw(tree, x, y, clip_x, clip_y,
- clip_width, clip_height, ctx)) {
- return;
- }
+ if (treeview_test_redraw(tree, x, y, clip_x, clip_y,
+ clip_width, clip_height, ctx)) {
+ return;
}
/* Start knockout rendering if it's available for this plotter */
@@ -2567,10 +2608,8 @@ bool tree_mouse_action(struct tree *tree, browser_mouse_state mouse, int x,
assert(tree != NULL);
assert(tree->root != NULL);
- if (tree->flags == TREE_MOVABLE) {
- if (treeview_test_mouse_action(tree, mouse, x, y)) {
- return true;
- }
+ if (treeview_test_mouse_action(tree, mouse, x, y)) {
+ return true;
}
if (tree->root->child == NULL)
@@ -3026,10 +3065,8 @@ void tree_drag_end(struct tree *tree, browser_mouse_state mouse, int x0, int y0,
*/
bool tree_keypress(struct tree *tree, uint32_t key)
{
- if (tree->flags == TREE_MOVABLE) {
- if (treeview_test_keypress(tree, key)) {
- return true;
- }
+ if (treeview_test_keypress(tree, key)) {
+ return true;
}
if (tree->editing != NULL)
diff --git a/desktop/tree.h b/desktop/tree.h
index 20ade30..7074f60 100644
--- a/desktop/tree.h
+++ b/desktop/tree.h
@@ -45,6 +45,11 @@ enum tree_flags {
* directory will be deleted
* too.
*/
+ /* The following are to aid transition to new treeviews */
+ TREE_HISTORY = 64,
+ TREE_COOKIES = 128,
+ TREE_SSLCERT = 256,
+ TREE_HOTLIST = 512
};
/** A "flag" value to indicate the element data contains title
diff --git a/desktop/treeview.c b/desktop/treeview.c
index b920073..c45e914 100644
--- a/desktop/treeview.c
+++ b/desktop/treeview.c
@@ -39,12 +39,6 @@ struct treeview_globals {
int icon_step;
} tree_g;
-enum treeview_node_type {
- TREE_NODE_ROOT,
- TREE_NODE_FOLDER,
- TREE_NODE_ENTRY
-};
-
enum treeview_node_section {
TV_NODE_SECTION_TOGGLE, /**< Expansion toggle */
TV_NODE_SECTION_ON_NODE, /**< Node content (text, icon) */
@@ -573,6 +567,44 @@ static nserror treeview_walk_internal(treeview_node *root, bool full,
}
+struct treeview_walk_ctx {
+ treeview_walk_callback walk_cb;
+ void *ctx;
+ enum treeview_node_type type;
+};
+/** Treewalk node callback. */
+static nserror treeview_walk_cb(treeview_node *n, void *ctx,
+ bool *skip_children, bool *end)
+{
+ struct treeview_walk_ctx *tw = ctx;
+
+ if (n->type & tw->type) {
+ return tw->walk_cb(tw->ctx, n->client_data, tw->type, end);
+ }
+
+ return NSERROR_OK;
+}
+/* Exported interface, documented in treeview.h */
+nserror treeview_walk(treeview *tree, treeview_node *root,
+ treeview_walk_callback walk_cb, void *ctx,
+ enum treeview_node_type type)
+{
+ struct treeview_walk_ctx tw = {
+ .walk_cb = walk_cb,
+ .ctx = ctx,
+ .type = type
+ };
+
+ assert(tree != NULL);
+ assert(tree->root != NULL);
+
+ if (root == NULL)
+ root = tree->root;
+
+ return treeview_walk_internal(root, true, NULL, treeview_walk_cb, &tw);
+}
+
+
struct treeview_node_delete {
treeview *tree;
int height_reduction;
diff --git a/desktop/treeview.h b/desktop/treeview.h
index 82a7af1..ddd9be6 100644
--- a/desktop/treeview.h
+++ b/desktop/treeview.h
@@ -33,6 +33,12 @@
typedef struct treeview treeview;
typedef struct treeview_node treeview_node;
+enum treeview_node_type {
+ TREE_NODE_ROOT = (1 << 0),
+ TREE_NODE_FOLDER = (1 << 1),
+ TREE_NODE_ENTRY = (1 << 2)
+};
+
enum treeview_relationship {
TREE_REL_FIRST_CHILD,
TREE_REL_NEXT_SIBLING
@@ -208,6 +214,37 @@ nserror treeview_update_node_entry(treeview *tree,
const struct treeview_field_data fields[],
void *data);
+
+/**
+ * Client callback for treeview_walk
+ *
+ * \param ctx Client context
+ * \param node_data Client data for the current treeview node
+ * \param type The node type
+ * \param abort Set to true to abort treeview walk prematurely
+ * \return NSERROR_OK on success, or appropriate error otherwise
+ */
+typedef nserror (*treeview_walk_callback)(void *ctx, void *node_data,
+ enum treeview_node_type type, bool *abort);
+
+/**
+ * Walk (depth first) a treeview subtree, calling a callback at each node of
+ * required type.
+ *
+ * \param tree Treeview object to walk
+ * \param root Root node to walk tree from (or NULL for tree root)
+ * \param walk_cb Function to call on each node
+ * \param ctx Client context, passed back to callback function
+ * \param type The node type(s) of interest
+ * \return NSERROR_OK on success, or appropriate error otherwise
+ *
+ * Note, if deleting returned node, walk_cb must terminate the treeview walk by
+ * setting abort to true.
+ */
+nserror treeview_walk(treeview *tree, treeview_node *root,
+ treeview_walk_callback walk_cb, void *ctx,
+ enum treeview_node_type type);
+
/**
* Delete a treeview node
*
diff --git a/framebuffer/misc.c b/framebuffer/misc.c
index 035e6b4..0568e36 100644
--- a/framebuffer/misc.c
+++ b/framebuffer/misc.c
@@ -21,7 +21,7 @@
#include <stdio.h>
#include <string.h>
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "utils/utils.h"
diff --git a/gtk/cookies.c b/gtk/cookies.c
index dd62d56..99b2a80 100644
--- a/gtk/cookies.c
+++ b/gtk/cookies.c
@@ -21,7 +21,7 @@
*/
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
#include "desktop/plotters.h"
#include "desktop/tree.h"
#include "utils/log.h"
diff --git a/gtk/gui.c b/gtk/gui.c
index 01f9688..3fb2c2b 100644
--- a/gtk/gui.c
+++ b/gtk/gui.c
@@ -45,7 +45,7 @@
#include "content/hlcache.h"
#include "content/urldb.h"
#include "desktop/browser_private.h"
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
#include "desktop/gui.h"
#include "desktop/history_global_core.h"
#include "desktop/netsurf.h"
diff --git a/resources/FatMessages b/resources/FatMessages
index 4e7c0b0..49486b5 100644
--- a/resources/FatMessages
+++ b/resources/FatMessages
@@ -1162,6 +1162,77 @@ fr.all.TreeviewLabelPeriod:Period
it.all.TreeviewLabelPeriod:Period
nl.all.TreeviewLabelPeriod:Period
+en.all.TreeviewLabelName:Name
+de.all.TreeviewLabelName:Name
+fr.all.TreeviewLabelName:Name
+it.all.TreeviewLabelName:Name
+nl.all.TreeviewLabelName:Name
+en.all.TreeviewLabelContent:Content
+de.all.TreeviewLabelContent:Content
+fr.all.TreeviewLabelContent:Content
+it.all.TreeviewLabelContent:Content
+nl.all.TreeviewLabelContent:Content
+en.all.TreeviewLabelDomain:Domain
+de.all.TreeviewLabelDomain:Domain
+fr.all.TreeviewLabelDomain:Domain
+it.all.TreeviewLabelDomain:Domain
+nl.all.TreeviewLabelDomain:Domain
+en.all.TreeviewLabelPath:Path
+de.all.TreeviewLabelPath:Path
+fr.all.TreeviewLabelPath:Path
+it.all.TreeviewLabelPath:Path
+nl.all.TreeviewLabelPath:Path
+en.all.TreeviewLabelExpires:Expires
+de.all.TreeviewLabelExpires:Expires
+fr.all.TreeviewLabelExpires:Expires
+it.all.TreeviewLabelExpires:Expires
+nl.all.TreeviewLabelExpires:Expires
+en.all.TreeviewLabelLastUsed:Last used
+de.all.TreeviewLabelLastUsed:Last used
+fr.all.TreeviewLabelLastUsed:Last used
+it.all.TreeviewLabelLastUsed:Last used
+nl.all.TreeviewLabelLastUsed:Last used
+en.all.TreeviewLabelRestrictions:Restrictions
+de.all.TreeviewLabelRestrictions:Restrictions
+fr.all.TreeviewLabelRestrictions:Restrictions
+it.all.TreeviewLabelRestrictions:Restrictions
+nl.all.TreeviewLabelRestrictions:Restrictions
+en.all.TreeviewLabelVersion:Version
+de.all.TreeviewLabelVersion:Version
+fr.all.TreeviewLabelVersion:Version
+it.all.TreeviewLabelVersion:Version
+nl.all.TreeviewLabelVersion:Version
+en.all.TreeviewLabelPersistent:Persistent
+de.all.TreeviewLabelPersistent:Persistent
+fr.all.TreeviewLabelPersistent:Persistent
+it.all.TreeviewLabelPersistent:Persistent
+nl.all.TreeviewLabelPersistent:Persistent
+en.all.TreeviewLabelDomainFolder:Domain folder
+de.all.TreeviewLabelDomainFolder:Domain folder
+fr.all.TreeviewLabelDomainFolder:Domain folder
+it.all.TreeviewLabelDomainFolder:Domain folder
+nl.all.TreeviewLabelDomainFolder:Domain folder
+
+
+# Cookie Manager field values
+#
+en.all.CookieManagerHTTPS:Secure hosts via https only
+de.all.CookieManagerHTTPS:Secure hosts via https only
+fr.all.CookieManagerHTTPS:Secure hosts via https only
+it.all.CookieManagerHTTPS:Secure hosts via https only
+nl.all.CookieManagerHTTPS:Secure hosts via https only
+en.all.CookieManagerSecure:Secure hosts only
+de.all.CookieManagerSecure:Secure hosts only
+fr.all.CookieManagerSecure:Secure hosts only
+it.all.CookieManagerSecure:Secure hosts only
+nl.all.CookieManagerSecure:Secure hosts only
+en.all.CookieManagerHTTP:HTTP connections only
+de.all.CookieManagerHTTP:HTTP connections only
+fr.all.CookieManagerHTTP:HTTP connections only
+it.all.CookieManagerHTTP:HTTP connections only
+nl.all.CookieManagerHTTP:HTTP connections only
+
+
# Tree export
#
diff --git a/riscos/cookies.c b/riscos/cookies.c
index 8fb4594..14a1d03 100644
--- a/riscos/cookies.c
+++ b/riscos/cookies.c
@@ -30,7 +30,7 @@
#include "oslib/wimp.h"
#include "oslib/wimpspriteop.h"
#include "content/urldb.h"
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
#include "desktop/tree.h"
#include "riscos/cookies.h"
#include "riscos/dialog.h"
diff --git a/riscos/gui.c b/riscos/gui.c
index e409fbb..81b8a63 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -55,7 +55,7 @@
#include "content/hlcache.h"
#include "content/urldb.h"
#include "content/fetchers/resource.h"
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
#include "desktop/gui.h"
#include "desktop/history_global_core.h"
#include "desktop/hotlist.h"
diff --git a/riscos/menus.c b/riscos/menus.c
index 337ca48..bf9fa84 100644
--- a/riscos/menus.c
+++ b/riscos/menus.c
@@ -34,7 +34,7 @@
#include "content/content.h"
#include "content/hlcache.h"
#include "content/urldb.h"
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
#include "desktop/browser.h"
#include "desktop/gui.h"
#include "desktop/history_global_core.h"
diff --git a/riscos/window.c b/riscos/window.c
index 8e0f0a0..cbb31cf 100644
--- a/riscos/window.c
+++ b/riscos/window.c
@@ -46,7 +46,7 @@
#include "content/urldb.h"
#include "css/css.h"
#include "desktop/browser_private.h"
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
#include "desktop/scrollbar.h"
#include "desktop/frames.h"
#include "desktop/local_history.h"
diff --git a/test/llcache.c b/test/llcache.c
index de82304..b3eb0d2 100644
--- a/test/llcache.c
+++ b/test/llcache.c
@@ -105,11 +105,11 @@ char *url_to_path(const char *url)
* Things that are absolutely not reasonable, and should disappear *
******************************************************************************/
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
#include "desktop/gui.h"
#include "desktop/tree.h"
-/* desktop/cookies.h -- used by urldb
+/* desktop/cookies_old.h -- used by urldb
*
* URLdb should have a cookies update event + handler registration
*/
@@ -118,7 +118,7 @@ bool cookies_schedule_update(const struct cookie_data *data)
return true;
}
-/* desktop/cookies.h -- used by urldb
+/* desktop/cookies_old.h -- used by urldb
*
* URLdb should have a cookies removal handler registration
*/
diff --git a/test/urldbtest.c b/test/urldbtest.c
index bc9d899..7c72ed7 100644
--- a/test/urldbtest.c
+++ b/test/urldbtest.c
@@ -32,7 +32,7 @@
#include "image/bitmap.h"
#include "content/content.h"
#include "content/urldb.h"
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
#include "utils/nsoption.h"
#ifdef riscos
/** \todo lose this */
diff --git a/windows/misc.c b/windows/misc.c
index 5132e61..51c02ca 100644
--- a/windows/misc.c
+++ b/windows/misc.c
@@ -25,7 +25,7 @@
#include <windows.h>
-#include "desktop/cookies.h"
+#include "desktop/cookies_old.h"
#include "utils/messages.h"
#include "utils/utils.h"
#include "utils/url.h"
--
NetSurf Browser
10 years, 2 months
netsurf: branch master updated. release/3.0-324-gdce3c8c
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/dce3c8c170a7394e1114f...
...commit http://git.netsurf-browser.org/netsurf.git/commit/dce3c8c170a7394e1114f19...
...tree http://git.netsurf-browser.org/netsurf.git/tree/dce3c8c170a7394e1114f19fc...
The branch, master has been updated
via dce3c8c170a7394e1114f19fc5aa68007eb61324 (commit)
via 9ac58865a79c575ff5636614a18b828eaa4d4b4a (commit)
via 5aed1425609557573346675bda9be7ed3c0d5362 (commit)
from 0a0e7867b97a530686b4bc428dada5268e68e513 (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=dce3c8c170a7394e111...
commit dce3c8c170a7394e1114f19fc5aa68007eb61324
Merge: 9ac5886 0a0e786
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Merge branch 'master' of git://git.netsurf-browser.org/netsurf
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=9ac58865a79c575ff56...
commit 9ac58865a79c575ff5636614a18b828eaa4d4b4a
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Remove unused function declaration.
diff --git a/desktop/core_window.h b/desktop/core_window.h
index 8f53d96..6138f49 100644
--- a/desktop/core_window.h
+++ b/desktop/core_window.h
@@ -80,8 +80,4 @@ struct core_window_callback_table {
};
-void core_window_draw(struct core_window *cw, int x, int y, struct rect r,
- const struct redraw_context *ctx);
-
-
#endif
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=5aed142560955757334...
commit 5aed1425609557573346675bda9be7ed3c0d5362
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Document callbacks.
diff --git a/desktop/core_window.h b/desktop/core_window.h
index b7f1ba3..8f53d96 100644
--- a/desktop/core_window.h
+++ b/desktop/core_window.h
@@ -34,7 +34,12 @@ typedef enum {
/** Callbacks to achieve various core window functionality. */
struct core_window_callback_table {
- /** Request a redraw of the window. */
+ /**
+ * Request a redraw of the window
+ *
+ * \param cw the core window object
+ * \param r rectangle to redraw
+ */
void (*redraw_request)(struct core_window *cw, struct rect r);
/**
@@ -46,10 +51,21 @@ struct core_window_callback_table {
*/
void (*update_size)(struct core_window *cw, int width, int height);
- /** Scroll the window to make area visible */
+ /**
+ * Scroll the window to make area visible
+ *
+ * \param cw the core window object
+ * \param r rectangle to make visible
+ */
void (*scroll_visible)(struct core_window *cw, struct rect r);
- /** Get window viewport dimensions */
+ /**
+ * Get window viewport dimensions
+ *
+ * \param cw the core window object
+ * \param width to be set to viewport width in px
+ * \param height to be set to viewport height in px
+ */
void (*get_window_dimensions)(struct core_window *cw,
int *width, int *height);
-----------------------------------------------------------------------
Summary of changes:
desktop/core_window.h | 26 +++++++++++++++++++-------
1 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/desktop/core_window.h b/desktop/core_window.h
index b7f1ba3..6138f49 100644
--- a/desktop/core_window.h
+++ b/desktop/core_window.h
@@ -34,7 +34,12 @@ typedef enum {
/** Callbacks to achieve various core window functionality. */
struct core_window_callback_table {
- /** Request a redraw of the window. */
+ /**
+ * Request a redraw of the window
+ *
+ * \param cw the core window object
+ * \param r rectangle to redraw
+ */
void (*redraw_request)(struct core_window *cw, struct rect r);
/**
@@ -46,10 +51,21 @@ struct core_window_callback_table {
*/
void (*update_size)(struct core_window *cw, int width, int height);
- /** Scroll the window to make area visible */
+ /**
+ * Scroll the window to make area visible
+ *
+ * \param cw the core window object
+ * \param r rectangle to make visible
+ */
void (*scroll_visible)(struct core_window *cw, struct rect r);
- /** Get window viewport dimensions */
+ /**
+ * Get window viewport dimensions
+ *
+ * \param cw the core window object
+ * \param width to be set to viewport width in px
+ * \param height to be set to viewport height in px
+ */
void (*get_window_dimensions)(struct core_window *cw,
int *width, int *height);
@@ -64,8 +80,4 @@ struct core_window_callback_table {
};
-void core_window_draw(struct core_window *cw, int x, int y, struct rect r,
- const struct redraw_context *ctx);
-
-
#endif
--
NetSurf Browser
10 years, 2 months
netsurf: branch master updated. release/3.0-321-g0a0e786
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/0a0e7867b97a530686b4b...
...commit http://git.netsurf-browser.org/netsurf.git/commit/0a0e7867b97a530686b4bc4...
...tree http://git.netsurf-browser.org/netsurf.git/tree/0a0e7867b97a530686b4bc428...
The branch, master has been updated
via 0a0e7867b97a530686b4bc428dada5268e68e513 (commit)
via 0f79676d85bcdd5e5ff1192444bb9c38205728e8 (commit)
via a479e8d18a464280fdf85aebd7cbf74a3fba301f (commit)
from 618ef549838363f337a2162f34c0fa60c6e1899f (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=0a0e7867b97a530686b...
commit 0a0e7867b97a530686b4bc428dada5268e68e513
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Fix enable/disable of tab close option
diff --git a/amiga/menu.h b/amiga/menu.h
index 47c848e..dea99c5 100755
--- a/amiga/menu.h
+++ b/amiga/menu.h
@@ -113,7 +113,7 @@ enum {
#define AMI_MENU_SAVEAS_COMPLETE FULLMENUNUM(0,4,2)
#define AMI_MENU_SAVEAS_IFF FULLMENUNUM(0,4,3)
#define AMI_MENU_SAVEAS_PDF FULLMENUNUM(0,4,4)
-#define AMI_MENU_CLOSETAB FULLMENUNUM(0,6,0)
+#define AMI_MENU_CLOSETAB FULLMENUNUM(0,8,0)
#define AMI_MENU_CUT FULLMENUNUM(1,0,0)
#define AMI_MENU_COPY FULLMENUNUM(1,1,0)
#define AMI_MENU_PASTE FULLMENUNUM(1,2,0)
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=0f79676d85bcdd5e5ff...
commit 0f79676d85bcdd5e5ff1192444bb9c38205728e8
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Re-arrange menu to better conform to the Style Guide
diff --git a/amiga/menu.c b/amiga/menu.c
index 3e9ac97..ef1338c 100644
--- a/amiga/menu.c
+++ b/amiga/menu.c
@@ -199,16 +199,17 @@ void ami_init_menulabs(struct gui_window_2 *gwin)
ami_menu_alloc_item(gwin, M_SAVEIFF, NM_SUB, "IFF", 0, NULL,
ami_menu_item_project_save, (void *)AMINS_SAVE_IFF);
ami_menu_alloc_item(gwin, M_BAR_P2, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL);
+ ami_menu_alloc_item(gwin, M_PRINT, NM_ITEM, "PrintNS", 'P', NULL,
+ ami_menu_item_project_print, NULL);
+ ami_menu_alloc_item(gwin, M_BAR_P3, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL);
ami_menu_alloc_item(gwin, M_CLOSETAB, NM_ITEM, "CloseTab", 'K', NULL,
ami_menu_item_project_closetab, NULL);
ami_menu_alloc_item(gwin, M_CLOSEWIN, NM_ITEM, "CloseWindow", 0, NULL,
ami_menu_item_project_closewin, NULL);
- ami_menu_alloc_item(gwin, M_BAR_P3, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL);
- ami_menu_alloc_item(gwin, M_PRINT, NM_ITEM, "PrintNS", 'P', NULL,
- ami_menu_item_project_print, NULL);
- ami_menu_alloc_item(gwin, M_BAR_P4, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL);
+ ami_menu_alloc_item(gwin, M_BAR_P4, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL);
ami_menu_alloc_item(gwin, M_ABOUT, NM_ITEM, "About", '?', NULL,
ami_menu_item_project_about, NULL);
+ ami_menu_alloc_item(gwin, M_BAR_P5, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL);
ami_menu_alloc_item(gwin, M_QUIT, NM_ITEM, "Quit", 'Q', NULL,
ami_menu_item_project_quit, NULL);
diff --git a/amiga/menu.h b/amiga/menu.h
index e96fcf0..47c848e 100755
--- a/amiga/menu.h
+++ b/amiga/menu.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2008,2009 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ * Copyright 2008,2009,2013 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -46,12 +46,13 @@ enum {
M_SAVEPDF,
#endif
M_BAR_P2,
+ M_PRINT,
+ M_BAR_P3,
M_CLOSETAB,
M_CLOSEWIN,
- M_BAR_P3,
- M_PRINT,
M_BAR_P4,
M_ABOUT,
+ M_BAR_P5,
M_QUIT,
/* Edit menu */
M_EDIT,
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=a479e8d18a464280fdf...
commit a479e8d18a464280fdf85aebd7cbf74a3fba301f
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Remove some ellipsis abuse - should only be used if the item is going to pop up a window or requester for more info before the requested operation is carried out. (have only modified the Amiga strings)
diff --git a/resources/FatMessages b/resources/FatMessages
index 20f7a2f..4e7c0b0 100644
--- a/resources/FatMessages
+++ b/resources/FatMessages
@@ -244,7 +244,7 @@ nl.all.LinkSave:Save
en.all.LinkDload:Download target
de.all.LinkDload:Ziel speichern
fr.all.LinkDload:Download target
-it.all.LinkDload:Salva file in...
+it.all.LinkDload:Salva file in
nl.all.LinkDload:Download target
en.all.LinkNew:New window
de.all.LinkNew:Neues Fenster
@@ -774,11 +774,11 @@ de.all.OpenFile:Öffne lokale Datei...
fr.all.OpenFile:Open local file...
it.all.OpenFile:Apri file locale...
nl.all.OpenFile:Open local file...
-en.all.About:About...
-de.all.About:Über...
-fr.all.About:About...
-it.all.About:Informazioni...
-nl.all.About:About...
+en.all.About:About
+de.all.About:Über
+fr.all.About:About
+it.all.About:Informazioni
+nl.all.About:About
en.all.PrintNS:Print...
de.all.PrintNS:Drucken...
fr.all.PrintNS:Print...
@@ -820,16 +820,16 @@ de.all.Browser:Browser
fr.all.Browser:Browser
it.all.Browser:Strumenti
nl.all.Browser:Browser
-en.all.HistGlobalNS:Show global history...
-de.all.HistGlobalNS:Zeige globale History...
-fr.all.HistGlobalNS:Show global history...
-it.all.HistGlobalNS:Mostra cronologia globale...
-nl.all.HistGlobalNS:Show global history...
-en.all.HistLocalNS:Show local history...
-de.all.HistLocalNS:Zeige lokale History...
-fr.all.HistLocalNS:Show local history...
-it.all.HistLocalNS:Mostra cronologia locale...
-nl.all.HistLocalNS:Show local history...
+en.all.HistGlobalNS:Show global history
+de.all.HistGlobalNS:Zeige globale History
+fr.all.HistGlobalNS:Show global history
+it.all.HistGlobalNS:Mostra cronologia globale
+nl.all.HistGlobalNS:Show global history
+en.all.HistLocalNS:Show local history
+de.all.HistLocalNS:Zeige lokale History
+fr.all.HistLocalNS:Show local history
+it.all.HistLocalNS:Mostra cronologia locale
+nl.all.HistLocalNS:Show local history
en.all.FindTextNS:Find text...
de.all.FindTextNS:Suchen...
fr.all.FindTextNS:Find text...
@@ -863,19 +863,19 @@ nl.all.ScaleNorm:Normal
# Hotlist menu
#
-en.all.HotlistShowNS:Show hotlist...
-de.all.HotlistShowNS:Zeige Hotlist...
-fr.all.HotlistShowNS:Show hotlist...
-it.all.HotlistShowNS:Mostra...
-nl.all.HotlistShowNS:Show hotlist...
+en.all.HotlistShowNS:Show hotlist
+de.all.HotlistShowNS:Zeige Hotlist
+fr.all.HotlistShowNS:Show hotlist
+it.all.HotlistShowNS:Mostra
+nl.all.HotlistShowNS:Show hotlist
# Settings menu
#
-en.all.SettingsEdit:Edit preferences...
-de.all.SettingsEdit:Voreinstellungen...
-fr.all.SettingsEdit:Edit preferences...
-it.all.SettingsEdit:Modifica...
-nl.all.SettingsEdit:Edit preferences...
+en.all.SettingsEdit:Edit preferences
+de.all.SettingsEdit:Voreinstellungen
+fr.all.SettingsEdit:Edit preferences
+it.all.SettingsEdit:Modifica
+nl.all.SettingsEdit:Edit preferences
en.all.Settings:Settings
de.all.Settings:Einstellungen
fr.all.Settings:Settings
@@ -965,7 +965,7 @@ nl.all.Frame:Frame
en.all.FrameNewWin:Show in new window
de.all.FrameNewWin:In neuem Fenster anzeigen
fr.all.FrameNewWin:Show in new window
-it.all.FrameNewWin:Apri frame in nuova finestra...
+it.all.FrameNewWin:Apri frame in nuova finestra
nl.all.FrameNewWin:Show in new window
en.all.FrameNewTab:Show in new tab
de.all.FrameNewTab:In neuem Tab anzeigen
@@ -984,7 +984,7 @@ fr.all.SelectFile:Select file...
it.all.SelectFile:Seleziona file...
nl.all.SelectFile:Select file...
en.all.ExternalApp:Open in external application
-de.all.ExternalApp:In externer Anwendung öffnen..
+de.all.ExternalApp:In externer Anwendung öffnen
fr.all.ExternalApp:Open in external application
it.all.ExternalApp:Apri con applicazione esterna
nl.all.ExternalApp:Open in external application
-----------------------------------------------------------------------
Summary of changes:
amiga/menu.c | 9 ++++---
amiga/menu.h | 9 ++++---
resources/FatMessages | 56 ++++++++++++++++++++++++------------------------
3 files changed, 38 insertions(+), 36 deletions(-)
diff --git a/amiga/menu.c b/amiga/menu.c
index 3e9ac97..ef1338c 100644
--- a/amiga/menu.c
+++ b/amiga/menu.c
@@ -199,16 +199,17 @@ void ami_init_menulabs(struct gui_window_2 *gwin)
ami_menu_alloc_item(gwin, M_SAVEIFF, NM_SUB, "IFF", 0, NULL,
ami_menu_item_project_save, (void *)AMINS_SAVE_IFF);
ami_menu_alloc_item(gwin, M_BAR_P2, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL);
+ ami_menu_alloc_item(gwin, M_PRINT, NM_ITEM, "PrintNS", 'P', NULL,
+ ami_menu_item_project_print, NULL);
+ ami_menu_alloc_item(gwin, M_BAR_P3, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL);
ami_menu_alloc_item(gwin, M_CLOSETAB, NM_ITEM, "CloseTab", 'K', NULL,
ami_menu_item_project_closetab, NULL);
ami_menu_alloc_item(gwin, M_CLOSEWIN, NM_ITEM, "CloseWindow", 0, NULL,
ami_menu_item_project_closewin, NULL);
- ami_menu_alloc_item(gwin, M_BAR_P3, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL);
- ami_menu_alloc_item(gwin, M_PRINT, NM_ITEM, "PrintNS", 'P', NULL,
- ami_menu_item_project_print, NULL);
- ami_menu_alloc_item(gwin, M_BAR_P4, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL);
+ ami_menu_alloc_item(gwin, M_BAR_P4, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL);
ami_menu_alloc_item(gwin, M_ABOUT, NM_ITEM, "About", '?', NULL,
ami_menu_item_project_about, NULL);
+ ami_menu_alloc_item(gwin, M_BAR_P5, NM_ITEM, NM_BARLABEL, 0, NULL, NULL, NULL);
ami_menu_alloc_item(gwin, M_QUIT, NM_ITEM, "Quit", 'Q', NULL,
ami_menu_item_project_quit, NULL);
diff --git a/amiga/menu.h b/amiga/menu.h
index e96fcf0..dea99c5 100755
--- a/amiga/menu.h
+++ b/amiga/menu.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2008,2009 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
+ * Copyright 2008,2009,2013 Chris Young <chris(a)unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -46,12 +46,13 @@ enum {
M_SAVEPDF,
#endif
M_BAR_P2,
+ M_PRINT,
+ M_BAR_P3,
M_CLOSETAB,
M_CLOSEWIN,
- M_BAR_P3,
- M_PRINT,
M_BAR_P4,
M_ABOUT,
+ M_BAR_P5,
M_QUIT,
/* Edit menu */
M_EDIT,
@@ -112,7 +113,7 @@ enum {
#define AMI_MENU_SAVEAS_COMPLETE FULLMENUNUM(0,4,2)
#define AMI_MENU_SAVEAS_IFF FULLMENUNUM(0,4,3)
#define AMI_MENU_SAVEAS_PDF FULLMENUNUM(0,4,4)
-#define AMI_MENU_CLOSETAB FULLMENUNUM(0,6,0)
+#define AMI_MENU_CLOSETAB FULLMENUNUM(0,8,0)
#define AMI_MENU_CUT FULLMENUNUM(1,0,0)
#define AMI_MENU_COPY FULLMENUNUM(1,1,0)
#define AMI_MENU_PASTE FULLMENUNUM(1,2,0)
diff --git a/resources/FatMessages b/resources/FatMessages
index 20f7a2f..4e7c0b0 100644
--- a/resources/FatMessages
+++ b/resources/FatMessages
@@ -244,7 +244,7 @@ nl.all.LinkSave:Save
en.all.LinkDload:Download target
de.all.LinkDload:Ziel speichern
fr.all.LinkDload:Download target
-it.all.LinkDload:Salva file in...
+it.all.LinkDload:Salva file in
nl.all.LinkDload:Download target
en.all.LinkNew:New window
de.all.LinkNew:Neues Fenster
@@ -774,11 +774,11 @@ de.all.OpenFile:Öffne lokale Datei...
fr.all.OpenFile:Open local file...
it.all.OpenFile:Apri file locale...
nl.all.OpenFile:Open local file...
-en.all.About:About...
-de.all.About:Über...
-fr.all.About:About...
-it.all.About:Informazioni...
-nl.all.About:About...
+en.all.About:About
+de.all.About:Über
+fr.all.About:About
+it.all.About:Informazioni
+nl.all.About:About
en.all.PrintNS:Print...
de.all.PrintNS:Drucken...
fr.all.PrintNS:Print...
@@ -820,16 +820,16 @@ de.all.Browser:Browser
fr.all.Browser:Browser
it.all.Browser:Strumenti
nl.all.Browser:Browser
-en.all.HistGlobalNS:Show global history...
-de.all.HistGlobalNS:Zeige globale History...
-fr.all.HistGlobalNS:Show global history...
-it.all.HistGlobalNS:Mostra cronologia globale...
-nl.all.HistGlobalNS:Show global history...
-en.all.HistLocalNS:Show local history...
-de.all.HistLocalNS:Zeige lokale History...
-fr.all.HistLocalNS:Show local history...
-it.all.HistLocalNS:Mostra cronologia locale...
-nl.all.HistLocalNS:Show local history...
+en.all.HistGlobalNS:Show global history
+de.all.HistGlobalNS:Zeige globale History
+fr.all.HistGlobalNS:Show global history
+it.all.HistGlobalNS:Mostra cronologia globale
+nl.all.HistGlobalNS:Show global history
+en.all.HistLocalNS:Show local history
+de.all.HistLocalNS:Zeige lokale History
+fr.all.HistLocalNS:Show local history
+it.all.HistLocalNS:Mostra cronologia locale
+nl.all.HistLocalNS:Show local history
en.all.FindTextNS:Find text...
de.all.FindTextNS:Suchen...
fr.all.FindTextNS:Find text...
@@ -863,19 +863,19 @@ nl.all.ScaleNorm:Normal
# Hotlist menu
#
-en.all.HotlistShowNS:Show hotlist...
-de.all.HotlistShowNS:Zeige Hotlist...
-fr.all.HotlistShowNS:Show hotlist...
-it.all.HotlistShowNS:Mostra...
-nl.all.HotlistShowNS:Show hotlist...
+en.all.HotlistShowNS:Show hotlist
+de.all.HotlistShowNS:Zeige Hotlist
+fr.all.HotlistShowNS:Show hotlist
+it.all.HotlistShowNS:Mostra
+nl.all.HotlistShowNS:Show hotlist
# Settings menu
#
-en.all.SettingsEdit:Edit preferences...
-de.all.SettingsEdit:Voreinstellungen...
-fr.all.SettingsEdit:Edit preferences...
-it.all.SettingsEdit:Modifica...
-nl.all.SettingsEdit:Edit preferences...
+en.all.SettingsEdit:Edit preferences
+de.all.SettingsEdit:Voreinstellungen
+fr.all.SettingsEdit:Edit preferences
+it.all.SettingsEdit:Modifica
+nl.all.SettingsEdit:Edit preferences
en.all.Settings:Settings
de.all.Settings:Einstellungen
fr.all.Settings:Settings
@@ -965,7 +965,7 @@ nl.all.Frame:Frame
en.all.FrameNewWin:Show in new window
de.all.FrameNewWin:In neuem Fenster anzeigen
fr.all.FrameNewWin:Show in new window
-it.all.FrameNewWin:Apri frame in nuova finestra...
+it.all.FrameNewWin:Apri frame in nuova finestra
nl.all.FrameNewWin:Show in new window
en.all.FrameNewTab:Show in new tab
de.all.FrameNewTab:In neuem Tab anzeigen
@@ -984,7 +984,7 @@ fr.all.SelectFile:Select file...
it.all.SelectFile:Seleziona file...
nl.all.SelectFile:Select file...
en.all.ExternalApp:Open in external application
-de.all.ExternalApp:In externer Anwendung öffnen..
+de.all.ExternalApp:In externer Anwendung öffnen
fr.all.ExternalApp:Open in external application
it.all.ExternalApp:Apri con applicazione esterna
nl.all.ExternalApp:Open in external application
--
NetSurf Browser
10 years, 2 months
netsurf: branch master updated. release/3.0-318-g618ef54
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/618ef549838363f337a21...
...commit http://git.netsurf-browser.org/netsurf.git/commit/618ef549838363f337a2162...
...tree http://git.netsurf-browser.org/netsurf.git/tree/618ef549838363f337a2162f3...
The branch, master has been updated
via 618ef549838363f337a2162f34c0fa60c6e1899f (commit)
via 07c2add5cc28efa18f7bcaae239879a3bc12a700 (commit)
via 28a04f6da778afe03bc2639c0ecce947b5f36b7f (commit)
via ec9608c4ded5f286d91fcb3df09906b8ac8ec025 (commit)
via 9f72b5e04639e904e71f55cc2385a6ff30ebdc3b (commit)
via 094ef9a64b1d4c89f116fc09780781985738e5e3 (commit)
from 716776a181de46648aa6f65a2931bd5789330682 (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=618ef549838363f337a...
commit 618ef549838363f337a2162f34c0fa60c6e1899f
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Update new global history, if the treeview test option is set.
diff --git a/desktop/browser.c b/desktop/browser.c
index 2ab93c9..9f3636e 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -45,6 +45,7 @@
#include "desktop/browser_private.h"
#include "desktop/download.h"
#include "desktop/frames.h"
+#include "desktop/global_history.h"
#include "desktop/gui.h"
#include "desktop/history_global_core.h"
#include "desktop/hotlist.h"
@@ -1247,8 +1248,12 @@ static nserror browser_window_callback(hlcache_handle *c,
urldb_update_url_visit_data(url);
urldb_set_url_content_type(url,
content_get_type(c));
+
/* This is safe as we've just added the URL */
- history_global_add(urldb_get_url(url));
+ if (nsoption_bool(temp_treeview_test) == false)
+ history_global_add(urldb_get_url(url));
+ else
+ global_history_add(urldb_get_url(url));
}
}
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=07c2add5cc28efa18f7...
commit 07c2add5cc28efa18f7bcaae239879a3bc12a700
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Add function to add to global history. Fix add_entry to actually add new entry after removing an existing one. Implement directory deletion.
diff --git a/desktop/global_history.c b/desktop/global_history.c
index 573bf84..05822d7 100644
--- a/desktop/global_history.c
+++ b/desktop/global_history.c
@@ -462,7 +462,6 @@ static bool global_history_add_entry(nsurl *url,
const struct url_data *data)
{
int slot;
- struct global_history_entry *e;
time_t visit_date;
time_t earliest_date = gh_ctx.today - (N_DAYS - 1) * N_SEC_PER_DAY;
bool got_treeview = gh_ctx.tree != NULL;
@@ -483,13 +482,12 @@ static bool global_history_add_entry(nsurl *url,
if (got_treeview == true) {
/* The treeview for global history already exists */
+ struct global_history_entry *e;
- /* See if there's already an entry for this URL */
+ /* Delete any existing entry for this URL */
e = global_history_find(url);
if (e != NULL) {
- /* Existing entry. */
treeview_delete_node(gh_ctx.tree, e->entry);
- return true;
}
}
@@ -643,12 +641,26 @@ static nserror global_history_init_entries(void)
static nserror global_history_tree_node_folder_cb(
struct treeview_node_msg msg, void *data)
{
+ struct global_history_folder *f = data;
+
+ switch (msg.msg) {
+ case TREE_MSG_NODE_DELETE:
+ f->folder = NULL;
+ break;
+
+ case TREE_MSG_NODE_EDIT:
+ break;
+
+ case TREE_MSG_NODE_LAUNCH:
+ break;
+ }
+
return NSERROR_OK;
}
static nserror global_history_tree_node_entry_cb(
struct treeview_node_msg msg, void *data)
{
- struct global_history_entry *e = (struct global_history_entry *)data;
+ struct global_history_entry *e = data;
switch (msg.msg) {
case TREE_MSG_NODE_DELETE:
@@ -782,6 +794,23 @@ nserror global_history_fini(void)
/* Exported interface, documented in global_history.h */
+nserror global_history_add(nsurl *url)
+{
+ const struct url_data *data;
+
+ data = urldb_get_url_data(url);
+ if (data == NULL) {
+ LOG(("Can't add URL to history that's not present in urldb."));
+ return NSERROR_BAD_PARAMETER;
+ }
+
+ global_history_add_entry(url, data);
+
+ return NSERROR_OK;
+}
+
+
+/* Exported interface, documented in global_history.h */
void global_history_redraw(int x, int y, struct rect *clip,
const struct redraw_context *ctx)
{
diff --git a/desktop/global_history.h b/desktop/global_history.h
index 591b1fe..3863e81 100644
--- a/desktop/global_history.h
+++ b/desktop/global_history.h
@@ -22,6 +22,7 @@
#include <stdbool.h>
#include "desktop/core_window.h"
+#include "utils/nsurl.h"
/**
@@ -51,6 +52,16 @@ nserror global_history_init(struct core_window_callback_table *cw_t,
nserror global_history_fini(void);
/**
+ * Add an entry to the global history.
+ *
+ * If the URL already exists in the global history, the old node is removed.
+ *
+ * \param url URL for node being added
+ * \return NSERROR_OK on success, appropriate error otherwise
+ */
+nserror global_history_add(nsurl *url);
+
+/**
* Redraw the global history.
*
* \param x X coordinate to render treeview at
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=28a04f6da778afe03bc...
commit 28a04f6da778afe03bc2639c0ecce947b5f36b7f
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Reset entry url's urldb visit data when user deletes entry from global history.
diff --git a/desktop/global_history.c b/desktop/global_history.c
index a60cccd..573bf84 100644
--- a/desktop/global_history.c
+++ b/desktop/global_history.c
@@ -61,6 +61,8 @@ struct global_history_ctx {
struct global_history_ctx gh_ctx;
struct global_history_entry {
+ bool user_delete;
+
int slot;
nsurl *url;
time_t t;
@@ -349,6 +351,7 @@ static nserror global_history_add_entry_internal(nsurl *url, int slot,
return false;
}
+ e->user_delete = false;
e->slot = slot;
e->url = nsurl_ref(url);
e->t = data->last_visit;
@@ -433,11 +436,18 @@ static void global_history_delete_entry_internal(
e->next->prev = e->prev;
}
- /* Destroy */
+ if (e->user_delete) {
+ /* User requested delete, so delete from urldb too. */
+ urldb_reset_url_visit_data(e->url);
+ }
+
+ /* Destroy fields */
free((void *)e->data[0].value); /* Eww */
free((void *)e->data[2].value); /* Eww */
free((void *)e->data[3].value); /* Eww */
nsurl_unref(e->url);
+
+ /* Destroy entry */
free(e);
}
@@ -477,7 +487,7 @@ static bool global_history_add_entry(nsurl *url,
/* See if there's already an entry for this URL */
e = global_history_find(url);
if (e != NULL) {
- /* Existing entry. Delete it. */
+ /* Existing entry. */
treeview_delete_node(gh_ctx.tree, e->entry);
return true;
}
@@ -643,6 +653,7 @@ static nserror global_history_tree_node_entry_cb(
switch (msg.msg) {
case TREE_MSG_NODE_DELETE:
e->entry = NULL;
+ e->user_delete = msg.data.delete.user;
global_history_delete_entry_internal(e);
break;
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=ec9608c4ded5f286d91...
commit ec9608c4ded5f286d91fcb3df09906b8ac8ec025
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Make node delete callback msg differentiate between deletes caused by user interaction and other deletes (e.g. treeview destruction).
diff --git a/desktop/treeview.c b/desktop/treeview.c
index c15c9ee..b920073 100644
--- a/desktop/treeview.c
+++ b/desktop/treeview.c
@@ -576,6 +576,7 @@ static nserror treeview_walk_internal(treeview_node *root, bool full,
struct treeview_node_delete {
treeview *tree;
int height_reduction;
+ bool user_interaction;
};
/** Treewalk node callback deleting nodes. */
static nserror treeview_delete_node_walk_cb(treeview_node *n,
@@ -584,6 +585,7 @@ static nserror treeview_delete_node_walk_cb(treeview_node *n,
struct treeview_node_delete *nd = (struct treeview_node_delete *)ctx;
struct treeview_node_msg msg;
msg.msg = TREE_MSG_NODE_DELETE;
+ msg.data.delete.user = nd->user_interaction;
assert(n->children == NULL);
@@ -651,7 +653,8 @@ static nserror treeview_delete_node_internal(treeview *tree, treeview_node *n,
treeview_node *p = n->parent;
struct treeview_node_delete nd = {
.tree = tree,
- .height_reduction = 0
+ .height_reduction = 0,
+ .user_interaction = interaction
};
if (interaction && (tree->flags & TREEVIEW_NO_DELETES)) {
@@ -691,13 +694,14 @@ static nserror treeview_delete_node_internal(treeview *tree, treeview_node *n,
* Delete a treeview node
*
* \param tree Treeview object to delete empty nodes from
+ * \param interaction Delete is result of user interaction with treeview
* \return NSERROR_OK on success, appropriate error otherwise
*
* Note this must not be called within a treeview_walk. It may delete the
* walker's 'current' node, making it impossible to move on without invalid
* reads.
*/
-static nserror treeview_delete_empty_nodes(treeview *tree)
+static nserror treeview_delete_empty_nodes(treeview *tree, bool interaction)
{
treeview_node *node, *child, *parent, *next_sibling;
treeview_node *root = tree->root;
@@ -705,7 +709,8 @@ static nserror treeview_delete_empty_nodes(treeview *tree)
nserror err;
struct treeview_node_delete nd = {
.tree = tree,
- .height_reduction = 0
+ .height_reduction = 0,
+ .user_interaction = interaction
};
node = root;
@@ -778,7 +783,7 @@ nserror treeview_delete_node(treeview *tree, treeview_node *n)
if (tree->flags & TREEVIEW_DEL_EMPTY_DIRS) {
/* Delete any empty nodes */
- err = treeview_delete_empty_nodes(tree);
+ err = treeview_delete_empty_nodes(tree, false);
if (err != NSERROR_OK)
return err;
}
@@ -1686,7 +1691,7 @@ bool treeview_keypress(treeview *tree, uint32_t key)
if (tree->flags & TREEVIEW_DEL_EMPTY_DIRS) {
/* Delete any empty nodes */
- err = treeview_delete_empty_nodes(tree);
+ err = treeview_delete_empty_nodes(tree, true);
r.y0 = 0;
}
break;
diff --git a/desktop/treeview.h b/desktop/treeview.h
index 5662dfa..82a7af1 100644
--- a/desktop/treeview.h
+++ b/desktop/treeview.h
@@ -60,6 +60,9 @@ struct treeview_node_msg {
enum treeview_msg msg; /**< The message type */
union {
struct {
+ bool user; /* True iff delete by user interaction */
+ } delete;
+ struct {
lwc_string *feild; /* The field being edited */
const char *text; /* The proposed new value */
} node_edit; /* Client may call treeview_update_node_* */
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=9f72b5e04639e904e71...
commit 9f72b5e04639e904e71f55cc2385a6ff30ebdc3b
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Fix namespace of old global history add function.
diff --git a/desktop/browser.c b/desktop/browser.c
index 1cc3693..2ab93c9 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -1248,7 +1248,7 @@ static nserror browser_window_callback(hlcache_handle *c,
urldb_set_url_content_type(url,
content_get_type(c));
/* This is safe as we've just added the URL */
- global_history_add(urldb_get_url(url));
+ history_global_add(urldb_get_url(url));
}
}
diff --git a/desktop/history_global_core.c b/desktop/history_global_core.c
index 2a941e0..ce43830 100644
--- a/desktop/history_global_core.c
+++ b/desktop/history_global_core.c
@@ -90,7 +90,7 @@ static struct node *history_global_find(const char *url)
* \param data URL data associated with URL
* \return true (for urldb_iterate_entries)
*/
-static bool global_history_add_internal(nsurl *url, const struct url_data *data)
+static bool history_global_add_internal(nsurl *url, const struct url_data *data)
{
int i, j;
struct node *parent = NULL;
@@ -281,7 +281,7 @@ bool history_global_initialise(struct tree *tree, const char* folder_icon_name)
LOG(("Building history tree"));
global_history_initialised = true;
- urldb_iterate_entries(global_history_add_internal);
+ urldb_iterate_entries(history_global_add_internal);
global_history_initialised = false;
tree_set_node_expanded(global_history_tree, global_history_tree_root,
false, true, true);
@@ -316,7 +316,7 @@ void history_global_cleanup(void)
*
* \param url the url to be added
*/
-void global_history_add(nsurl *url)
+void history_global_add(nsurl *url)
{
const struct url_data *data;
@@ -324,7 +324,7 @@ void global_history_add(nsurl *url)
if (data == NULL)
return;
- global_history_add_internal(url, data);
+ history_global_add_internal(url, data);
}
diff --git a/desktop/history_global_core.h b/desktop/history_global_core.h
index c55a23c..9bf5a0b 100644
--- a/desktop/history_global_core.h
+++ b/desktop/history_global_core.h
@@ -28,7 +28,7 @@ bool history_global_initialise(struct tree *tree, const char* folder_icon_name);
unsigned int history_global_get_tree_flags(void);
void history_global_cleanup(void);
-void global_history_add(nsurl *url);
+void history_global_add(nsurl *url);
bool history_global_export(const char *path);
void history_global_delete_selected(void);
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=094ef9a64b1d4c89f11...
commit 094ef9a64b1d4c89f116fc09780781985738e5e3
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Minor wrapping fix.
diff --git a/desktop/browser.c b/desktop/browser.c
index 7ca91d3..1cc3693 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -1767,7 +1767,8 @@ nserror browser_window_navigate(struct browser_window *bw,
if ((bw->current_content != NULL) &&
(hlcache_handle_get_url(bw->current_content) != NULL)) {
same_url = nsurl_compare(url,
- hlcache_handle_get_url(bw->current_content),
+ hlcache_handle_get_url(
+ bw->current_content),
NSURL_COMPLETE);
}
@@ -1792,7 +1793,8 @@ nserror browser_window_navigate(struct browser_window *bw,
if (bw->current_content != NULL) {
browser_window_refresh_url_bar(bw,
- hlcache_handle_get_url(bw->current_content),
+ hlcache_handle_get_url(
+ bw->current_content),
bw->frag_id);
}
return NSERROR_OK;
-----------------------------------------------------------------------
Summary of changes:
desktop/browser.c | 13 ++++++++--
desktop/global_history.c | 52 ++++++++++++++++++++++++++++++++++++----
desktop/global_history.h | 11 ++++++++
desktop/history_global_core.c | 8 +++---
desktop/history_global_core.h | 2 +-
desktop/treeview.c | 15 ++++++++----
desktop/treeview.h | 3 ++
7 files changed, 85 insertions(+), 19 deletions(-)
diff --git a/desktop/browser.c b/desktop/browser.c
index 7ca91d3..9f3636e 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -45,6 +45,7 @@
#include "desktop/browser_private.h"
#include "desktop/download.h"
#include "desktop/frames.h"
+#include "desktop/global_history.h"
#include "desktop/gui.h"
#include "desktop/history_global_core.h"
#include "desktop/hotlist.h"
@@ -1247,8 +1248,12 @@ static nserror browser_window_callback(hlcache_handle *c,
urldb_update_url_visit_data(url);
urldb_set_url_content_type(url,
content_get_type(c));
+
/* This is safe as we've just added the URL */
- global_history_add(urldb_get_url(url));
+ if (nsoption_bool(temp_treeview_test) == false)
+ history_global_add(urldb_get_url(url));
+ else
+ global_history_add(urldb_get_url(url));
}
}
@@ -1767,7 +1772,8 @@ nserror browser_window_navigate(struct browser_window *bw,
if ((bw->current_content != NULL) &&
(hlcache_handle_get_url(bw->current_content) != NULL)) {
same_url = nsurl_compare(url,
- hlcache_handle_get_url(bw->current_content),
+ hlcache_handle_get_url(
+ bw->current_content),
NSURL_COMPLETE);
}
@@ -1792,7 +1798,8 @@ nserror browser_window_navigate(struct browser_window *bw,
if (bw->current_content != NULL) {
browser_window_refresh_url_bar(bw,
- hlcache_handle_get_url(bw->current_content),
+ hlcache_handle_get_url(
+ bw->current_content),
bw->frag_id);
}
return NSERROR_OK;
diff --git a/desktop/global_history.c b/desktop/global_history.c
index a60cccd..05822d7 100644
--- a/desktop/global_history.c
+++ b/desktop/global_history.c
@@ -61,6 +61,8 @@ struct global_history_ctx {
struct global_history_ctx gh_ctx;
struct global_history_entry {
+ bool user_delete;
+
int slot;
nsurl *url;
time_t t;
@@ -349,6 +351,7 @@ static nserror global_history_add_entry_internal(nsurl *url, int slot,
return false;
}
+ e->user_delete = false;
e->slot = slot;
e->url = nsurl_ref(url);
e->t = data->last_visit;
@@ -433,11 +436,18 @@ static void global_history_delete_entry_internal(
e->next->prev = e->prev;
}
- /* Destroy */
+ if (e->user_delete) {
+ /* User requested delete, so delete from urldb too. */
+ urldb_reset_url_visit_data(e->url);
+ }
+
+ /* Destroy fields */
free((void *)e->data[0].value); /* Eww */
free((void *)e->data[2].value); /* Eww */
free((void *)e->data[3].value); /* Eww */
nsurl_unref(e->url);
+
+ /* Destroy entry */
free(e);
}
@@ -452,7 +462,6 @@ static bool global_history_add_entry(nsurl *url,
const struct url_data *data)
{
int slot;
- struct global_history_entry *e;
time_t visit_date;
time_t earliest_date = gh_ctx.today - (N_DAYS - 1) * N_SEC_PER_DAY;
bool got_treeview = gh_ctx.tree != NULL;
@@ -473,13 +482,12 @@ static bool global_history_add_entry(nsurl *url,
if (got_treeview == true) {
/* The treeview for global history already exists */
+ struct global_history_entry *e;
- /* See if there's already an entry for this URL */
+ /* Delete any existing entry for this URL */
e = global_history_find(url);
if (e != NULL) {
- /* Existing entry. Delete it. */
treeview_delete_node(gh_ctx.tree, e->entry);
- return true;
}
}
@@ -633,16 +641,31 @@ static nserror global_history_init_entries(void)
static nserror global_history_tree_node_folder_cb(
struct treeview_node_msg msg, void *data)
{
+ struct global_history_folder *f = data;
+
+ switch (msg.msg) {
+ case TREE_MSG_NODE_DELETE:
+ f->folder = NULL;
+ break;
+
+ case TREE_MSG_NODE_EDIT:
+ break;
+
+ case TREE_MSG_NODE_LAUNCH:
+ break;
+ }
+
return NSERROR_OK;
}
static nserror global_history_tree_node_entry_cb(
struct treeview_node_msg msg, void *data)
{
- struct global_history_entry *e = (struct global_history_entry *)data;
+ struct global_history_entry *e = data;
switch (msg.msg) {
case TREE_MSG_NODE_DELETE:
e->entry = NULL;
+ e->user_delete = msg.data.delete.user;
global_history_delete_entry_internal(e);
break;
@@ -771,6 +794,23 @@ nserror global_history_fini(void)
/* Exported interface, documented in global_history.h */
+nserror global_history_add(nsurl *url)
+{
+ const struct url_data *data;
+
+ data = urldb_get_url_data(url);
+ if (data == NULL) {
+ LOG(("Can't add URL to history that's not present in urldb."));
+ return NSERROR_BAD_PARAMETER;
+ }
+
+ global_history_add_entry(url, data);
+
+ return NSERROR_OK;
+}
+
+
+/* Exported interface, documented in global_history.h */
void global_history_redraw(int x, int y, struct rect *clip,
const struct redraw_context *ctx)
{
diff --git a/desktop/global_history.h b/desktop/global_history.h
index 591b1fe..3863e81 100644
--- a/desktop/global_history.h
+++ b/desktop/global_history.h
@@ -22,6 +22,7 @@
#include <stdbool.h>
#include "desktop/core_window.h"
+#include "utils/nsurl.h"
/**
@@ -51,6 +52,16 @@ nserror global_history_init(struct core_window_callback_table *cw_t,
nserror global_history_fini(void);
/**
+ * Add an entry to the global history.
+ *
+ * If the URL already exists in the global history, the old node is removed.
+ *
+ * \param url URL for node being added
+ * \return NSERROR_OK on success, appropriate error otherwise
+ */
+nserror global_history_add(nsurl *url);
+
+/**
* Redraw the global history.
*
* \param x X coordinate to render treeview at
diff --git a/desktop/history_global_core.c b/desktop/history_global_core.c
index 2a941e0..ce43830 100644
--- a/desktop/history_global_core.c
+++ b/desktop/history_global_core.c
@@ -90,7 +90,7 @@ static struct node *history_global_find(const char *url)
* \param data URL data associated with URL
* \return true (for urldb_iterate_entries)
*/
-static bool global_history_add_internal(nsurl *url, const struct url_data *data)
+static bool history_global_add_internal(nsurl *url, const struct url_data *data)
{
int i, j;
struct node *parent = NULL;
@@ -281,7 +281,7 @@ bool history_global_initialise(struct tree *tree, const char* folder_icon_name)
LOG(("Building history tree"));
global_history_initialised = true;
- urldb_iterate_entries(global_history_add_internal);
+ urldb_iterate_entries(history_global_add_internal);
global_history_initialised = false;
tree_set_node_expanded(global_history_tree, global_history_tree_root,
false, true, true);
@@ -316,7 +316,7 @@ void history_global_cleanup(void)
*
* \param url the url to be added
*/
-void global_history_add(nsurl *url)
+void history_global_add(nsurl *url)
{
const struct url_data *data;
@@ -324,7 +324,7 @@ void global_history_add(nsurl *url)
if (data == NULL)
return;
- global_history_add_internal(url, data);
+ history_global_add_internal(url, data);
}
diff --git a/desktop/history_global_core.h b/desktop/history_global_core.h
index c55a23c..9bf5a0b 100644
--- a/desktop/history_global_core.h
+++ b/desktop/history_global_core.h
@@ -28,7 +28,7 @@ bool history_global_initialise(struct tree *tree, const char* folder_icon_name);
unsigned int history_global_get_tree_flags(void);
void history_global_cleanup(void);
-void global_history_add(nsurl *url);
+void history_global_add(nsurl *url);
bool history_global_export(const char *path);
void history_global_delete_selected(void);
diff --git a/desktop/treeview.c b/desktop/treeview.c
index c15c9ee..b920073 100644
--- a/desktop/treeview.c
+++ b/desktop/treeview.c
@@ -576,6 +576,7 @@ static nserror treeview_walk_internal(treeview_node *root, bool full,
struct treeview_node_delete {
treeview *tree;
int height_reduction;
+ bool user_interaction;
};
/** Treewalk node callback deleting nodes. */
static nserror treeview_delete_node_walk_cb(treeview_node *n,
@@ -584,6 +585,7 @@ static nserror treeview_delete_node_walk_cb(treeview_node *n,
struct treeview_node_delete *nd = (struct treeview_node_delete *)ctx;
struct treeview_node_msg msg;
msg.msg = TREE_MSG_NODE_DELETE;
+ msg.data.delete.user = nd->user_interaction;
assert(n->children == NULL);
@@ -651,7 +653,8 @@ static nserror treeview_delete_node_internal(treeview *tree, treeview_node *n,
treeview_node *p = n->parent;
struct treeview_node_delete nd = {
.tree = tree,
- .height_reduction = 0
+ .height_reduction = 0,
+ .user_interaction = interaction
};
if (interaction && (tree->flags & TREEVIEW_NO_DELETES)) {
@@ -691,13 +694,14 @@ static nserror treeview_delete_node_internal(treeview *tree, treeview_node *n,
* Delete a treeview node
*
* \param tree Treeview object to delete empty nodes from
+ * \param interaction Delete is result of user interaction with treeview
* \return NSERROR_OK on success, appropriate error otherwise
*
* Note this must not be called within a treeview_walk. It may delete the
* walker's 'current' node, making it impossible to move on without invalid
* reads.
*/
-static nserror treeview_delete_empty_nodes(treeview *tree)
+static nserror treeview_delete_empty_nodes(treeview *tree, bool interaction)
{
treeview_node *node, *child, *parent, *next_sibling;
treeview_node *root = tree->root;
@@ -705,7 +709,8 @@ static nserror treeview_delete_empty_nodes(treeview *tree)
nserror err;
struct treeview_node_delete nd = {
.tree = tree,
- .height_reduction = 0
+ .height_reduction = 0,
+ .user_interaction = interaction
};
node = root;
@@ -778,7 +783,7 @@ nserror treeview_delete_node(treeview *tree, treeview_node *n)
if (tree->flags & TREEVIEW_DEL_EMPTY_DIRS) {
/* Delete any empty nodes */
- err = treeview_delete_empty_nodes(tree);
+ err = treeview_delete_empty_nodes(tree, false);
if (err != NSERROR_OK)
return err;
}
@@ -1686,7 +1691,7 @@ bool treeview_keypress(treeview *tree, uint32_t key)
if (tree->flags & TREEVIEW_DEL_EMPTY_DIRS) {
/* Delete any empty nodes */
- err = treeview_delete_empty_nodes(tree);
+ err = treeview_delete_empty_nodes(tree, true);
r.y0 = 0;
}
break;
diff --git a/desktop/treeview.h b/desktop/treeview.h
index 5662dfa..82a7af1 100644
--- a/desktop/treeview.h
+++ b/desktop/treeview.h
@@ -60,6 +60,9 @@ struct treeview_node_msg {
enum treeview_msg msg; /**< The message type */
union {
struct {
+ bool user; /* True iff delete by user interaction */
+ } delete;
+ struct {
lwc_string *feild; /* The field being edited */
const char *text; /* The proposed new value */
} node_edit; /* Client may call treeview_update_node_* */
--
NetSurf Browser
10 years, 2 months
netsurf: branch master updated. release/3.0-312-g716776a
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/716776a181de46648aa6f...
...commit http://git.netsurf-browser.org/netsurf.git/commit/716776a181de46648aa6f65...
...tree http://git.netsurf-browser.org/netsurf.git/tree/716776a181de46648aa6f65a2...
The branch, master has been updated
via 716776a181de46648aa6f65a2931bd5789330682 (commit)
from 55592d5a8d25a8cb92310bb49913c63336f7a0ae (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=716776a181de46648aa...
commit 716776a181de46648aa6f65a2931bd5789330682
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Remove forward declaration.
diff --git a/desktop/browser.c b/desktop/browser.c
index 949dca0..7ca91d3 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -74,23 +74,6 @@ bool browser_reformat_pending;
/** maximum frame depth */
#define FRAME_DEPTH 8
-static nserror browser_window_callback(hlcache_handle *c,
- const hlcache_event *event, void *pw);
-static void browser_window_refresh(void *p);
-static bool browser_window_check_throbber(struct browser_window *bw);
-static void browser_window_convert_to_download(struct browser_window *bw,
- llcache_handle *stream);
-static void browser_window_start_throbber(struct browser_window *bw);
-static void browser_window_stop_throbber(struct browser_window *bw);
-static void browser_window_destroy_children(struct browser_window *bw);
-static void browser_window_destroy_internal(struct browser_window *bw);
-static void browser_window_set_scale_internal(struct browser_window *bw,
- float scale);
-static void browser_window_find_target_internal(struct browser_window *bw,
- const char *target, int depth, struct browser_window *page,
- int *rdepth, struct browser_window **bw_target);
-static void browser_window_mouse_drag_end(struct browser_window *bw,
- browser_mouse_state mouse, int x, int y);
/**
@@ -839,174 +822,63 @@ browser_window_download(struct browser_window *bw,
return error;
}
-/* exported interface documented in desktop/browser.h */
-nserror browser_window_navigate(struct browser_window *bw,
- nsurl *url,
- nsurl *referrer,
- enum browser_window_nav_flags flags,
- char *post_urlenc,
- struct fetch_multipart_data *post_multipart,
- hlcache_handle *parent)
-{
- hlcache_handle *c;
- int depth = 0;
- struct browser_window *cur;
- uint32_t fetch_flags = 0;
- bool fetch_is_post = (post_urlenc != NULL || post_multipart != NULL);
- llcache_post_data post;
- hlcache_child_context child;
- nserror error;
-
- assert(bw);
- assert(url);
-
- LOG(("bw %p, url %s", bw, nsurl_access(url)));
-
- /* don't allow massively nested framesets */
- for (cur = bw; cur->parent; cur = cur->parent) {
- depth++;
- }
- if (depth > FRAME_DEPTH) {
- LOG(("frame depth too high."));
- return NSERROR_FRAME_DEPTH;
- }
-
- /* Set up retrieval parameters */
- if ((flags & BROWSER_WINDOW_VERIFIABLE) != 0) {
- fetch_flags |= LLCACHE_RETRIEVE_VERIFIABLE;
- }
-
- if (post_multipart != NULL) {
- post.type = LLCACHE_POST_MULTIPART;
- post.data.multipart = post_multipart;
- } else if (post_urlenc != NULL) {
- post.type = LLCACHE_POST_URL_ENCODED;
- post.data.urlenc = post_urlenc;
- }
-
- if ((parent != NULL) && (content_get_type(parent) == CONTENT_HTML)) {
- child.charset = html_get_encoding(parent);
- child.quirks = content_get_quirks(parent);
- }
- url = nsurl_ref(url);
+static bool browser_window_check_throbber(struct browser_window *bw)
+{
+ int children, index;
- if (referrer != NULL) {
- referrer = nsurl_ref(referrer);
- }
+ if (bw->throbbing)
+ return true;
- /* Get download out of the way */
- if ((flags & BROWSER_WINDOW_DOWNLOAD) != 0) {
- error = browser_window_download(bw,
- url,
- referrer,
- fetch_flags,
- fetch_is_post,
- &post);
- nsurl_unref(url);
- if (referrer != NULL) {
- nsurl_unref(referrer);
+ if (bw->children) {
+ children = bw->rows * bw->cols;
+ for (index = 0; index < children; index++) {
+ if (browser_window_check_throbber(&bw->children[index]))
+ return true;
}
- return error;
}
-
- if (bw->frag_id != NULL) {
- lwc_string_unref(bw->frag_id);
- }
- bw->frag_id = NULL;
-
- if (nsurl_has_component(url, NSURL_FRAGMENT)) {
- bool same_url = false;
-
- bw->frag_id = nsurl_get_component(url, NSURL_FRAGMENT);
-
- /* Compare new URL with existing one (ignoring fragments) */
- if ((bw->current_content != NULL) &&
- (hlcache_handle_get_url(bw->current_content) != NULL)) {
- same_url = nsurl_compare(url,
- hlcache_handle_get_url(bw->current_content),
- NSURL_COMPLETE);
- }
-
- /* if we're simply moving to another ID on the same page,
- * don't bother to fetch, just update the window.
- */
- if ((same_url) &&
- (fetch_is_post == false) &&
- (nsurl_has_component(url, NSURL_QUERY) == false)) {
- nsurl_unref(url);
-
- if (referrer != NULL) {
- nsurl_unref(referrer);
- }
-
- if ((flags & BROWSER_WINDOW_HISTORY) != 0) {
- history_add(bw->history,
- bw->current_content, bw->frag_id);
- }
-
- browser_window_update(bw, false);
-
- if (bw->current_content != NULL) {
- browser_window_refresh_url_bar(bw,
- hlcache_handle_get_url(bw->current_content),
- bw->frag_id);
- }
- return NSERROR_OK;
+ if (bw->iframes) {
+ for (index = 0; index < bw->iframe_count; index++) {
+ if (browser_window_check_throbber(&bw->iframes[index]))
+ return true;
}
}
+ return false;
+}
- browser_window_stop(bw);
- browser_window_remove_caret(bw, false);
- browser_window_destroy_children(bw);
-
- LOG(("Loading '%s'", nsurl_access(url)));
-
- browser_window_set_status(bw, messages_get("Loading"));
- bw->history_add = (flags & BROWSER_WINDOW_HISTORY);
- /* Verifiable fetches may trigger a download */
- if ((flags & BROWSER_WINDOW_VERIFIABLE) != 0) {
- fetch_flags |= HLCACHE_RETRIEVE_MAY_DOWNLOAD;
- }
+/**
+ * Start the busy indicator.
+ *
+ * \param bw browser window
+ */
- error = hlcache_handle_retrieve(url,
- fetch_flags | HLCACHE_RETRIEVE_SNIFF_TYPE,
- referrer,
- fetch_is_post ? &post : NULL,
- browser_window_callback, bw,
- parent != NULL ? &child : NULL,
- CONTENT_ANY, &c);
+static void browser_window_start_throbber(struct browser_window *bw)
+{
+ bw->throbbing = true;
- switch (error) {
- case NSERROR_OK:
- bw->loading_content = c;
- browser_window_start_throbber(bw);
- browser_window_refresh_url_bar(bw, url, NULL);
- break;
+ while (bw->parent)
+ bw = bw->parent;
- case NSERROR_NO_FETCH_HANDLER: /* no handler for this type */
- /** @todo does this always try and download even unverifiable content? */
- gui_launch_url(nsurl_access(url));
- break;
+ gui_window_start_throbber(bw->window);
+}
- 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);
- break;
- }
+/**
+ * Stop the busy indicator.
+ *
+ * \param bw browser window
+ */
- nsurl_unref(url);
- if (referrer != NULL) {
- nsurl_unref(referrer);
- }
+static void browser_window_stop_throbber(struct browser_window *bw)
+{
+ bw->throbbing = false;
- /* Record time */
- bw->last_action = wallclock();
+ while (bw->parent)
+ bw = bw->parent;
- return error;
+ if (!browser_window_check_throbber(bw))
+ gui_window_stop_throbber(bw->window);
}
@@ -1203,53 +1075,138 @@ browser_window_callback_errorcode(hlcache_handle *c,
browser_window_stop_throbber(bw);
}
+
/**
- * Callback for fetchcache() for browser window fetches.
+ * Handle meta http-equiv refresh time elapsing by loading a new page.
+ *
+ * \param p browser window to refresh with new page
*/
-nserror browser_window_callback(hlcache_handle *c,
- const hlcache_event *event, void *pw)
+static void browser_window_refresh(void *p)
{
- struct browser_window *bw = pw;
-
- switch (event->type) {
- case CONTENT_MSG_DOWNLOAD:
- assert(bw->loading_content == c);
-
- browser_window_convert_to_download(bw, event->data.download);
-
- if (bw->current_content != NULL) {
- browser_window_refresh_url_bar(bw,
- hlcache_handle_get_url(bw->current_content),
- bw->frag_id);
- }
- break;
+ struct browser_window *bw = p;
+ nsurl *url;
+ nsurl *refresh;
+ hlcache_handle *parent = NULL;
+ enum browser_window_nav_flags flags = BROWSER_WINDOW_NONE;
- case CONTENT_MSG_LOADING:
- assert(bw->loading_content == c);
+ assert(bw->current_content != NULL &&
+ (content_get_status(bw->current_content) ==
+ CONTENT_STATUS_READY ||
+ content_get_status(bw->current_content) ==
+ CONTENT_STATUS_DONE));
-#ifdef WITH_THEME_INSTALL
- if (content_get_type(c) == CONTENT_THEME) {
- theme_install_start(c);
- bw->loading_content = NULL;
- browser_window_stop_throbber(bw);
- } else
-#endif
- {
- bw->refresh_interval = -1;
- browser_window_set_status(bw,
- content_get_status_message(c));
- }
- break;
+ /* Ignore if the refresh URL has gone
+ * (may happen if a fetch error occurred) */
+ refresh = content_get_refresh_url(bw->current_content);
+ if (refresh == NULL)
+ return;
- case CONTENT_MSG_READY:
- {
- int width, height;
+ /* mark this content as invalid so it gets flushed from the cache */
+ content_invalidate_reuse_data(bw->current_content);
- assert(bw->loading_content == c);
+ url = hlcache_handle_get_url(bw->current_content);
+ if ((url == NULL) || (nsurl_compare(url, refresh, NSURL_COMPLETE))) {
+ flags |= BROWSER_WINDOW_HISTORY;
+ }
- if (bw->current_content != NULL) {
- content_status status =
+ /* Treat an (almost) immediate refresh in a top-level browser window as
+ * if it were an HTTP redirect, and thus make the resulting fetch
+ * verifiable.
+ *
+ * See fetchcache.c for why redirected fetches should be verifiable at
+ * all.
+ */
+ if (bw->refresh_interval <= 100 && bw->parent == NULL) {
+ flags |= BROWSER_WINDOW_VERIFIABLE;
+ } else {
+ parent = bw->current_content;
+ }
+
+ browser_window_navigate(bw,
+ refresh,
+ url,
+ flags,
+ NULL,
+ NULL,
+ parent);
+
+}
+
+
+/**
+ * Transfer the loading_content to a new download window.
+ */
+
+static void browser_window_convert_to_download(struct browser_window *bw,
+ llcache_handle *stream)
+{
+ struct browser_window *root = browser_window_get_root(bw);
+ nserror error;
+
+ assert(root != NULL);
+
+ error = download_context_create(stream, root->window);
+ if (error != NSERROR_OK) {
+ llcache_handle_abort(stream);
+ llcache_handle_release(stream);
+ }
+
+ /* remove content from browser window */
+ hlcache_handle_release(bw->loading_content);
+ bw->loading_content = NULL;
+
+ browser_window_stop_throbber(bw);
+}
+
+
+/**
+ * Callback for fetchcache() for browser window fetches.
+ */
+
+static nserror browser_window_callback(hlcache_handle *c,
+ const hlcache_event *event, void *pw)
+{
+ struct browser_window *bw = pw;
+
+ switch (event->type) {
+ case CONTENT_MSG_DOWNLOAD:
+ assert(bw->loading_content == c);
+
+ browser_window_convert_to_download(bw, event->data.download);
+
+ if (bw->current_content != NULL) {
+ browser_window_refresh_url_bar(bw,
+ hlcache_handle_get_url(bw->current_content),
+ bw->frag_id);
+ }
+ break;
+
+ case CONTENT_MSG_LOADING:
+ assert(bw->loading_content == c);
+
+#ifdef WITH_THEME_INSTALL
+ if (content_get_type(c) == CONTENT_THEME) {
+ theme_install_start(c);
+ bw->loading_content = NULL;
+ browser_window_stop_throbber(bw);
+ } else
+#endif
+ {
+ bw->refresh_interval = -1;
+ browser_window_set_status(bw,
+ content_get_status_message(c));
+ }
+ break;
+
+ case CONTENT_MSG_READY:
+ {
+ int width, height;
+
+ assert(bw->loading_content == c);
+
+ if (bw->current_content != NULL) {
+ content_status status =
content_get_status(bw->current_content);
if (status == CONTENT_STATUS_READY ||
@@ -1427,7 +1384,8 @@ nserror browser_window_callback(hlcache_handle *c,
&icon_str) == lwc_error_ok) {
if (lwc_string_caseless_isequal(
event->data.rfc5988_link->rel,
- icon_str, &icon_match) != lwc_error_ok) {
+ icon_str,
+ &icon_match) != lwc_error_ok) {
icon_match = false;
}
lwc_string_unref(icon_str);
@@ -1582,196 +1540,368 @@ nserror browser_window_callback(hlcache_handle *c,
}
-/*
- * Get the dimensions of the area a browser window occupies
+/* Have to forward declare browser_window_destroy_internal */
+static void browser_window_destroy_internal(struct browser_window *bw);
+
+/**
+ * Close and destroy all child browser window.
*
- * \param bw The browser window to get dimensions of
- * \param width Updated to the browser window viewport width
- * \param height Updated to the browser window viewport height
- * \param scaled Whether we want the height with scale applied
+ * \param bw browser window
*/
-
-void browser_window_get_dimensions(struct browser_window *bw,
- int *width, int *height, bool scaled)
+static void browser_window_destroy_children(struct browser_window *bw)
{
- assert(bw);
+ int i;
- if (bw->window == NULL) {
- /* Core managed browser window */
- *width = bw->width;
- *height = bw->height;
- } else {
- /* Front end window */
- gui_window_get_dimensions(bw->window, width, height, scaled);
+ if (bw->children) {
+ for (i = 0; i < (bw->rows * bw->cols); i++)
+ browser_window_destroy_internal(&bw->children[i]);
+ free(bw->children);
+ bw->children = NULL;
+ bw->rows = 0;
+ bw->cols = 0;
+ }
+ if (bw->iframes) {
+ for (i = 0; i < bw->iframe_count; i++)
+ browser_window_destroy_internal(&bw->iframes[i]);
+ free(bw->iframes);
+ bw->iframes = NULL;
+ bw->iframe_count = 0;
}
}
-/*
- * Set the dimensions of the area a browser window occupies
+/**
+ * Release all memory associated with a browser window.
*
- * \param bw The browser window to set dimensions of
- * \param width Width in pixels
- * \param height Height in pixels
+ * \param bw browser window
*/
-
-void browser_window_set_dimensions(struct browser_window *bw,
- int width, int height)
+void browser_window_destroy_internal(struct browser_window *bw)
{
assert(bw);
- if (bw->window == NULL) {
- /* Core managed browser window */
- bw->width = width;
- bw->height = height;
- } else {
- LOG(("Asked to set dimensions of front end window."));
- assert(0);
- }
-}
+ LOG(("Destroying window"));
+ if (bw->children != NULL || bw->iframes != NULL)
+ browser_window_destroy_children(bw);
-/**
- * Transfer the loading_content to a new download window.
- */
+ schedule_remove(browser_window_refresh, bw);
-void browser_window_convert_to_download(struct browser_window *bw,
- llcache_handle *stream)
-{
- struct browser_window *root = browser_window_get_root(bw);
- nserror error;
+ /* If this brower window is not the root window, and has focus, unset
+ * the root browser window's focus pointer. */
+ if (!bw->window) {
+ struct browser_window *top = browser_window_get_root(bw);
- assert(root != NULL);
+ if (top->focus == bw)
+ top->focus = top;
- error = download_context_create(stream, root->window);
- if (error != NSERROR_OK) {
- llcache_handle_abort(stream);
- llcache_handle_release(stream);
+ if (top->selection.bw == bw) {
+ browser_window_set_selection(top, false, false);
+ }
}
- /* remove content from browser window */
- hlcache_handle_release(bw->loading_content);
- bw->loading_content = NULL;
-
- browser_window_stop_throbber(bw);
-}
+ /* Destruction order is important: we must ensure that the frontend
+ * destroys any window(s) associated with this browser window before
+ * we attempt any destructive cleanup.
+ */
+ if (bw->window) {
+ /* Only the root window has a GUI window */
+ gui_window_destroy(bw->window);
+ }
-/**
- * Handle meta http-equiv refresh time elapsing by loading a new page.
- *
- * \param p browser window to refresh with new page
- */
+ if (bw->loading_content != NULL) {
+ hlcache_handle_abort(bw->loading_content);
+ hlcache_handle_release(bw->loading_content);
+ bw->loading_content = NULL;
+ }
-void browser_window_refresh(void *p)
-{
- struct browser_window *bw = p;
- nsurl *url;
- nsurl *refresh;
- hlcache_handle *parent = NULL;
- enum browser_window_nav_flags flags = BROWSER_WINDOW_NONE;
+ if (bw->current_content != NULL) {
+ content_status status = content_get_status(bw->current_content);
+ if (status == CONTENT_STATUS_READY ||
+ status == CONTENT_STATUS_DONE)
+ content_close(bw->current_content);
- assert(bw->current_content != NULL &&
- (content_get_status(bw->current_content) ==
- CONTENT_STATUS_READY ||
- content_get_status(bw->current_content) ==
- CONTENT_STATUS_DONE));
+ hlcache_handle_release(bw->current_content);
+ bw->current_content = NULL;
+ }
- /* Ignore if the refresh URL has gone
- * (may happen if a fetch error occurred) */
- refresh = content_get_refresh_url(bw->current_content);
- if (refresh == NULL)
- return;
+ if (bw->loading_favicon != NULL) {
+ hlcache_handle_abort(bw->loading_favicon);
+ hlcache_handle_release(bw->loading_favicon);
+ bw->loading_favicon = NULL;
+ }
- /* mark this content as invalid so it gets flushed from the cache */
- content_invalidate_reuse_data(bw->current_content);
+ if (bw->current_favicon != NULL) {
+ content_status status = content_get_status(bw->current_favicon);
- url = hlcache_handle_get_url(bw->current_content);
- if ((url == NULL) || (nsurl_compare(url, refresh, NSURL_COMPLETE))) {
- flags |= BROWSER_WINDOW_HISTORY;
- }
+ if (status == CONTENT_STATUS_READY ||
+ status == CONTENT_STATUS_DONE)
+ content_close(bw->current_favicon);
- /* Treat an (almost) immediate refresh in a top-level browser window as
- * if it were an HTTP redirect, and thus make the resulting fetch
- * verifiable.
- *
- * See fetchcache.c for why redirected fetches should be verifiable at
- * all.
- */
- if (bw->refresh_interval <= 100 && bw->parent == NULL) {
- flags |= BROWSER_WINDOW_VERIFIABLE;
- } else {
- parent = bw->current_content;
+ hlcache_handle_release(bw->current_favicon);
+ bw->current_favicon = NULL;
}
- browser_window_navigate(bw,
- refresh,
- url,
- flags,
- NULL,
- NULL,
- parent);
+ if (bw->box != NULL) {
+ bw->box->iframe = NULL;
+ bw->box = NULL;
+ }
+ if (bw->jsctx != NULL) {
+ js_destroycontext(bw->jsctx);
+ }
+
+ /* These simply free memory, so are safe here */
+
+ if (bw->frag_id != NULL)
+ lwc_string_unref(bw->frag_id);
+
+ history_destroy(bw->history);
+
+ free(bw->name);
+ free(bw->status_text);
+ bw->status_text = NULL;
+ LOG(("Status text cache match:miss %d:%d",
+ bw->status_match, bw->status_miss));
}
/**
- * Start the busy indicator.
+ * Close and destroy a browser window.
*
* \param bw browser window
*/
+void browser_window_destroy(struct browser_window *bw)
+{
+ /* can't destoy child windows on their own */
+ assert(!bw->parent);
-void browser_window_start_throbber(struct browser_window *bw)
+ /* destroy */
+ browser_window_destroy_internal(bw);
+ free(bw);
+}
+
+
+/* exported interface documented in desktop/browser.h */
+nserror browser_window_navigate(struct browser_window *bw,
+ nsurl *url,
+ nsurl *referrer,
+ enum browser_window_nav_flags flags,
+ char *post_urlenc,
+ struct fetch_multipart_data *post_multipart,
+ hlcache_handle *parent)
{
- bw->throbbing = true;
+ hlcache_handle *c;
+ int depth = 0;
+ struct browser_window *cur;
+ uint32_t fetch_flags = 0;
+ bool fetch_is_post = (post_urlenc != NULL || post_multipart != NULL);
+ llcache_post_data post;
+ hlcache_child_context child;
+ nserror error;
- while (bw->parent)
- bw = bw->parent;
+ assert(bw);
+ assert(url);
- gui_window_start_throbber(bw->window);
+ LOG(("bw %p, url %s", bw, nsurl_access(url)));
+
+ /* don't allow massively nested framesets */
+ for (cur = bw; cur->parent; cur = cur->parent) {
+ depth++;
+ }
+ if (depth > FRAME_DEPTH) {
+ LOG(("frame depth too high."));
+ return NSERROR_FRAME_DEPTH;
+ }
+
+ /* Set up retrieval parameters */
+ if ((flags & BROWSER_WINDOW_VERIFIABLE) != 0) {
+ fetch_flags |= LLCACHE_RETRIEVE_VERIFIABLE;
+ }
+
+ if (post_multipart != NULL) {
+ post.type = LLCACHE_POST_MULTIPART;
+ post.data.multipart = post_multipart;
+ } else if (post_urlenc != NULL) {
+ post.type = LLCACHE_POST_URL_ENCODED;
+ post.data.urlenc = post_urlenc;
+ }
+
+ if ((parent != NULL) && (content_get_type(parent) == CONTENT_HTML)) {
+ child.charset = html_get_encoding(parent);
+ child.quirks = content_get_quirks(parent);
+ }
+
+ url = nsurl_ref(url);
+
+ if (referrer != NULL) {
+ referrer = nsurl_ref(referrer);
+ }
+
+ /* Get download out of the way */
+ if ((flags & BROWSER_WINDOW_DOWNLOAD) != 0) {
+ error = browser_window_download(bw,
+ url,
+ referrer,
+ fetch_flags,
+ fetch_is_post,
+ &post);
+ nsurl_unref(url);
+ if (referrer != NULL) {
+ nsurl_unref(referrer);
+ }
+ return error;
+ }
+
+ if (bw->frag_id != NULL) {
+ lwc_string_unref(bw->frag_id);
+ }
+ bw->frag_id = NULL;
+
+ if (nsurl_has_component(url, NSURL_FRAGMENT)) {
+ bool same_url = false;
+
+ bw->frag_id = nsurl_get_component(url, NSURL_FRAGMENT);
+
+ /* Compare new URL with existing one (ignoring fragments) */
+ if ((bw->current_content != NULL) &&
+ (hlcache_handle_get_url(bw->current_content) != NULL)) {
+ same_url = nsurl_compare(url,
+ hlcache_handle_get_url(bw->current_content),
+ NSURL_COMPLETE);
+ }
+
+ /* if we're simply moving to another ID on the same page,
+ * don't bother to fetch, just update the window.
+ */
+ if ((same_url) &&
+ (fetch_is_post == false) &&
+ (nsurl_has_component(url, NSURL_QUERY) == false)) {
+ nsurl_unref(url);
+
+ if (referrer != NULL) {
+ nsurl_unref(referrer);
+ }
+
+ if ((flags & BROWSER_WINDOW_HISTORY) != 0) {
+ history_add(bw->history,
+ bw->current_content, bw->frag_id);
+ }
+
+ browser_window_update(bw, false);
+
+ if (bw->current_content != NULL) {
+ browser_window_refresh_url_bar(bw,
+ hlcache_handle_get_url(bw->current_content),
+ bw->frag_id);
+ }
+ return NSERROR_OK;
+ }
+ }
+
+ browser_window_stop(bw);
+ browser_window_remove_caret(bw, false);
+ browser_window_destroy_children(bw);
+
+ LOG(("Loading '%s'", nsurl_access(url)));
+
+ browser_window_set_status(bw, messages_get("Loading"));
+ bw->history_add = (flags & BROWSER_WINDOW_HISTORY);
+
+ /* Verifiable fetches may trigger a download */
+ if ((flags & BROWSER_WINDOW_VERIFIABLE) != 0) {
+ fetch_flags |= HLCACHE_RETRIEVE_MAY_DOWNLOAD;
+ }
+
+ error = hlcache_handle_retrieve(url,
+ fetch_flags | HLCACHE_RETRIEVE_SNIFF_TYPE,
+ referrer,
+ fetch_is_post ? &post : NULL,
+ browser_window_callback, bw,
+ parent != NULL ? &child : NULL,
+ CONTENT_ANY, &c);
+
+ switch (error) {
+ case NSERROR_OK:
+ bw->loading_content = c;
+ browser_window_start_throbber(bw);
+ browser_window_refresh_url_bar(bw, url, NULL);
+ break;
+
+ case NSERROR_NO_FETCH_HANDLER: /* no handler for this type */
+ /** @todo does this always try and download even unverifiable content? */
+ gui_launch_url(nsurl_access(url));
+ break;
+
+ 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);
+ break;
+
+ }
+
+ nsurl_unref(url);
+ if (referrer != NULL) {
+ nsurl_unref(referrer);
+ }
+
+ /* Record time */
+ bw->last_action = wallclock();
+
+ return error;
}
-/**
- * Stop the busy indicator.
+/*
+ * Get the dimensions of the area a browser window occupies
*
- * \param bw browser window
+ * \param bw The browser window to get dimensions of
+ * \param width Updated to the browser window viewport width
+ * \param height Updated to the browser window viewport height
+ * \param scaled Whether we want the height with scale applied
*/
-void browser_window_stop_throbber(struct browser_window *bw)
+void browser_window_get_dimensions(struct browser_window *bw,
+ int *width, int *height, bool scaled)
{
- bw->throbbing = false;
-
- while (bw->parent)
- bw = bw->parent;
+ assert(bw);
- if (!browser_window_check_throbber(bw))
- gui_window_stop_throbber(bw->window);
+ if (bw->window == NULL) {
+ /* Core managed browser window */
+ *width = bw->width;
+ *height = bw->height;
+ } else {
+ /* Front end window */
+ gui_window_get_dimensions(bw->window, width, height, scaled);
+ }
}
-bool browser_window_check_throbber(struct browser_window *bw)
-{
- int children, index;
- if (bw->throbbing)
- return true;
+/*
+ * Set the dimensions of the area a browser window occupies
+ *
+ * \param bw The browser window to set dimensions of
+ * \param width Width in pixels
+ * \param height Height in pixels
+ */
- if (bw->children) {
- children = bw->rows * bw->cols;
- for (index = 0; index < children; index++) {
- if (browser_window_check_throbber(&bw->children[index]))
- return true;
- }
- }
- if (bw->iframes) {
- for (index = 0; index < bw->iframe_count; index++) {
- if (browser_window_check_throbber(&bw->iframes[index]))
- return true;
- }
+void browser_window_set_dimensions(struct browser_window *bw,
+ int width, int height)
+{
+ assert(bw);
+
+ if (bw->window == NULL) {
+ /* Core managed browser window */
+ bw->width = width;
+ bw->height = height;
+ } else {
+ LOG(("Asked to set dimensions of front end window."));
+ assert(0);
}
- return false;
}
+
/**
* Redraw browser window, set extent to content, and update title.
*
@@ -2043,172 +2173,30 @@ void browser_window_set_pointer(struct browser_window *bw,
bool loading;
assert(root);
- assert(root->window);
-
- loading = (bw->loading_content != NULL || (bw->current_content &&
- content_get_status(bw->current_content) ==
- CONTENT_STATUS_READY));
-
- if (wallclock() - bw->last_action < 100 && loading) {
- /* If loading and less than 1 second since last link followed,
- * force progress indicator pointer */
- gui_shape = GUI_POINTER_PROGRESS;
-
- } else if (shape == BROWSER_POINTER_AUTO) {
- /* Up to browser window to decide */
- if (loading)
- gui_shape = GUI_POINTER_PROGRESS;
- else
- gui_shape = GUI_POINTER_DEFAULT;
-
- } else {
- /* Use what we were told */
- gui_shape = (gui_pointer_shape)shape;
- }
-
- gui_window_set_pointer(root->window, gui_shape);
-}
-
-
-/**
- * Close and destroy a browser window.
- *
- * \param bw browser window
- */
-
-void browser_window_destroy(struct browser_window *bw)
-{
- /* can't destoy child windows on their own */
- assert(!bw->parent);
-
- /* destroy */
- browser_window_destroy_internal(bw);
- free(bw);
-}
-
-
-/**
- * Close and destroy all child browser window.
- *
- * \param bw browser window
- */
-
-void browser_window_destroy_children(struct browser_window *bw)
-{
- int i;
-
- if (bw->children) {
- for (i = 0; i < (bw->rows * bw->cols); i++)
- browser_window_destroy_internal(&bw->children[i]);
- free(bw->children);
- bw->children = NULL;
- bw->rows = 0;
- bw->cols = 0;
- }
- if (bw->iframes) {
- for (i = 0; i < bw->iframe_count; i++)
- browser_window_destroy_internal(&bw->iframes[i]);
- free(bw->iframes);
- bw->iframes = NULL;
- bw->iframe_count = 0;
- }
-}
-
-
-/**
- * Release all memory associated with a browser window.
- *
- * \param bw browser window
- */
-
-void browser_window_destroy_internal(struct browser_window *bw)
-{
- assert(bw);
-
- LOG(("Destroying window"));
-
- if (bw->children != NULL || bw->iframes != NULL)
- browser_window_destroy_children(bw);
-
- schedule_remove(browser_window_refresh, bw);
-
- /* If this brower window is not the root window, and has focus, unset
- * the root browser window's focus pointer. */
- if (!bw->window) {
- struct browser_window *top = browser_window_get_root(bw);
-
- if (top->focus == bw)
- top->focus = top;
-
- if (top->selection.bw == bw) {
- browser_window_set_selection(top, false, false);
- }
- }
-
- /* Destruction order is important: we must ensure that the frontend
- * destroys any window(s) associated with this browser window before
- * we attempt any destructive cleanup.
- */
-
- if (bw->window) {
- /* Only the root window has a GUI window */
- gui_window_destroy(bw->window);
- }
-
- if (bw->loading_content != NULL) {
- hlcache_handle_abort(bw->loading_content);
- hlcache_handle_release(bw->loading_content);
- bw->loading_content = NULL;
- }
-
- if (bw->current_content != NULL) {
- content_status status = content_get_status(bw->current_content);
- if (status == CONTENT_STATUS_READY ||
- status == CONTENT_STATUS_DONE)
- content_close(bw->current_content);
-
- hlcache_handle_release(bw->current_content);
- bw->current_content = NULL;
- }
-
- if (bw->loading_favicon != NULL) {
- hlcache_handle_abort(bw->loading_favicon);
- hlcache_handle_release(bw->loading_favicon);
- bw->loading_favicon = NULL;
- }
-
- if (bw->current_favicon != NULL) {
- content_status status = content_get_status(bw->current_favicon);
-
- if (status == CONTENT_STATUS_READY ||
- status == CONTENT_STATUS_DONE)
- content_close(bw->current_favicon);
-
- hlcache_handle_release(bw->current_favicon);
- bw->current_favicon = NULL;
- }
-
- if (bw->box != NULL) {
- bw->box->iframe = NULL;
- bw->box = NULL;
- }
+ assert(root->window);
- if (bw->jsctx != NULL) {
- js_destroycontext(bw->jsctx);
- }
+ loading = (bw->loading_content != NULL || (bw->current_content &&
+ content_get_status(bw->current_content) ==
+ CONTENT_STATUS_READY));
- /* These simply free memory, so are safe here */
+ if (wallclock() - bw->last_action < 100 && loading) {
+ /* If loading and less than 1 second since last link followed,
+ * force progress indicator pointer */
+ gui_shape = GUI_POINTER_PROGRESS;
- if (bw->frag_id != NULL)
- lwc_string_unref(bw->frag_id);
+ } else if (shape == BROWSER_POINTER_AUTO) {
+ /* Up to browser window to decide */
+ if (loading)
+ gui_shape = GUI_POINTER_PROGRESS;
+ else
+ gui_shape = GUI_POINTER_DEFAULT;
- history_destroy(bw->history);
+ } else {
+ /* Use what we were told */
+ gui_shape = (gui_pointer_shape)shape;
+ }
- free(bw->name);
- free(bw->status_text);
- bw->status_text = NULL;
- LOG(("Status text cache match:miss %d:%d",
- bw->status_match, bw->status_miss));
+ gui_window_set_pointer(root->window, gui_shape);
}
@@ -2246,29 +2234,8 @@ void browser_window_reformat(struct browser_window *bw, bool background,
content_reformat(c, background, width, height);
}
-
-/**
- * Sets the scale of a browser window
- *
- * \param bw The browser window to scale
- * \param scale The new scale
- * \param all Scale all windows in the tree (ie work up aswell as down)
- */
-
-void browser_window_set_scale(struct browser_window *bw, float scale, bool all)
-{
- while (bw->parent && all)
- bw = bw->parent;
-
- browser_window_set_scale_internal(bw, scale);
-
- if (bw->parent)
- bw = bw->parent;
-
- browser_window_recalculate_frameset(bw);
-}
-
-void browser_window_set_scale_internal(struct browser_window *bw, float scale)
+static void browser_window_set_scale_internal(struct browser_window *bw,
+ float scale)
{
int i;
hlcache_handle *c;
@@ -2296,6 +2263,28 @@ void browser_window_set_scale_internal(struct browser_window *bw, float scale)
/**
+ * Sets the scale of a browser window
+ *
+ * \param bw The browser window to scale
+ * \param scale The new scale
+ * \param all Scale all windows in the tree (ie work up aswell as down)
+ */
+
+void browser_window_set_scale(struct browser_window *bw, float scale, bool all)
+{
+ while (bw->parent && all)
+ bw = bw->parent;
+
+ browser_window_set_scale_internal(bw, scale);
+
+ if (bw->parent)
+ bw = bw->parent;
+
+ browser_window_recalculate_frameset(bw);
+}
+
+
+/**
* Gets the scale of a browser window
*
* \param bw The browser window to scale
@@ -2347,6 +2336,52 @@ void browser_window_refresh_url_bar(struct browser_window *bw, nsurl *url,
}
}
+
+static void browser_window_find_target_internal(struct browser_window *bw,
+ const char *target, int depth, struct browser_window *page,
+ int *rdepth, struct browser_window **bw_target)
+{
+ int i;
+
+ if ((bw->name) && (!strcasecmp(bw->name, target))) {
+ if ((bw == page) || (depth > *rdepth)) {
+ *rdepth = depth;
+ *bw_target = bw;
+ }
+ }
+
+ if ((!bw->children) && (!bw->iframes))
+ return;
+
+ depth++;
+
+ if (bw->children != NULL) {
+ for (i = 0; i < (bw->cols * bw->rows); i++) {
+ if ((bw->children[i].name) &&
+ (!strcasecmp(bw->children[i].name,
+ target))) {
+ if ((page == &bw->children[i]) ||
+ (depth > *rdepth)) {
+ *rdepth = depth;
+ *bw_target = &bw->children[i];
+ }
+ }
+ if (bw->children[i].children)
+ browser_window_find_target_internal(
+ &bw->children[i],
+ target, depth, page,
+ rdepth, bw_target);
+ }
+ }
+
+ if (bw->iframes != NULL) {
+ for (i = 0; i < bw->iframe_count; i++)
+ browser_window_find_target_internal(&bw->iframes[i],
+ target, depth, page, rdepth, bw_target);
+ }
+}
+
+
/**
* Locate a browser window in the specified stack according.
*
@@ -2492,47 +2527,58 @@ struct browser_window *browser_window_find_target(struct browser_window *bw,
return bw_target;
}
-void browser_window_find_target_internal(struct browser_window *bw,
- const char *target, int depth, struct browser_window *page,
- int *rdepth, struct browser_window **bw_target)
+
+/**
+ * Handles the end of a drag operation in a browser window.
+ *
+ * \param bw browser window
+ * \param mouse state of mouse buttons and modifier keys
+ * \param x coordinate of mouse
+ * \param y coordinate of mouse
+ *
+ * TODO: Remove this function, once these things are associated with content,
+ * rather than bw.
+ */
+
+static void browser_window_mouse_drag_end(struct browser_window *bw,
+ browser_mouse_state mouse, int x, int y)
{
- int i;
+ int scr_x, scr_y;
- if ((bw->name) && (!strcasecmp(bw->name, target))) {
- if ((bw == page) || (depth > *rdepth)) {
- *rdepth = depth;
- *bw_target = bw;
- }
- }
+ switch (bw->drag_type) {
+ case DRAGGING_SELECTION:
+ case DRAGGING_OTHER:
+ case DRAGGING_CONTENT_SCROLLBAR:
+ /* Drag handled by content handler */
+ break;
- if ((!bw->children) && (!bw->iframes))
- return;
+ case DRAGGING_SCR_X:
- depth++;
+ browser_window_get_scrollbar_pos(bw, true, &scr_x, &scr_y);
- if (bw->children != NULL) {
- for (i = 0; i < (bw->cols * bw->rows); i++) {
- if ((bw->children[i].name) &&
- (!strcasecmp(bw->children[i].name,
- target))) {
- if ((page == &bw->children[i]) ||
- (depth > *rdepth)) {
- *rdepth = depth;
- *bw_target = &bw->children[i];
- }
- }
- if (bw->children[i].children)
- browser_window_find_target_internal(
- &bw->children[i],
- target, depth, page,
- rdepth, bw_target);
- }
- }
+ scr_x = x - scr_x - scrollbar_get_offset(bw->scroll_x);
+ scr_y = y - scr_y - scrollbar_get_offset(bw->scroll_y);
- if (bw->iframes != NULL) {
- for (i = 0; i < bw->iframe_count; i++)
- browser_window_find_target_internal(&bw->iframes[i],
- target, depth, page, rdepth, bw_target);
+ scrollbar_mouse_drag_end(bw->scroll_x, mouse, scr_x, scr_y);
+
+ bw->drag_type = DRAGGING_NONE;
+ break;
+
+ case DRAGGING_SCR_Y:
+
+ browser_window_get_scrollbar_pos(bw, false, &scr_x, &scr_y);
+
+ scr_x = x - scr_x - scrollbar_get_offset(bw->scroll_x);
+ scr_y = y - scr_y - scrollbar_get_offset(bw->scroll_y);
+
+ scrollbar_mouse_drag_end(bw->scroll_y, mouse, scr_x, scr_y);
+
+ bw->drag_type = DRAGGING_NONE;
+ break;
+
+ default:
+ browser_window_set_drag_type(bw, DRAGGING_NONE, NULL);
+ break;
}
}
@@ -2826,61 +2872,6 @@ void browser_window_mouse_click(struct browser_window *bw,
/**
- * Handles the end of a drag operation in a browser window.
- *
- * \param bw browser window
- * \param mouse state of mouse buttons and modifier keys
- * \param x coordinate of mouse
- * \param y coordinate of mouse
- *
- * TODO: Remove this function, once these things are associated with content,
- * rather than bw.
- */
-
-void browser_window_mouse_drag_end(struct browser_window *bw,
- browser_mouse_state mouse, int x, int y)
-{
- int scr_x, scr_y;
-
- switch (bw->drag_type) {
- case DRAGGING_SELECTION:
- case DRAGGING_OTHER:
- case DRAGGING_CONTENT_SCROLLBAR:
- /* Drag handled by content handler */
- break;
-
- case DRAGGING_SCR_X:
-
- browser_window_get_scrollbar_pos(bw, true, &scr_x, &scr_y);
-
- scr_x = x - scr_x - scrollbar_get_offset(bw->scroll_x);
- scr_y = y - scr_y - scrollbar_get_offset(bw->scroll_y);
-
- scrollbar_mouse_drag_end(bw->scroll_x, mouse, scr_x, scr_y);
-
- bw->drag_type = DRAGGING_NONE;
- break;
-
- case DRAGGING_SCR_Y:
-
- browser_window_get_scrollbar_pos(bw, false, &scr_x, &scr_y);
-
- scr_x = x - scr_x - scrollbar_get_offset(bw->scroll_x);
- scr_y = y - scr_y - scrollbar_get_offset(bw->scroll_y);
-
- scrollbar_mouse_drag_end(bw->scroll_y, mouse, scr_x, scr_y);
-
- bw->drag_type = DRAGGING_NONE;
- break;
-
- default:
- browser_window_set_drag_type(bw, DRAGGING_NONE, NULL);
- break;
- }
-}
-
-
-/**
* Redraw a rectangular region of a browser window
*
* \param bw browser window to be redrawn
-----------------------------------------------------------------------
Summary of changes:
desktop/browser.c | 1219 ++++++++++++++++++++++++++---------------------------
1 files changed, 605 insertions(+), 614 deletions(-)
diff --git a/desktop/browser.c b/desktop/browser.c
index 949dca0..7ca91d3 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -74,23 +74,6 @@ bool browser_reformat_pending;
/** maximum frame depth */
#define FRAME_DEPTH 8
-static nserror browser_window_callback(hlcache_handle *c,
- const hlcache_event *event, void *pw);
-static void browser_window_refresh(void *p);
-static bool browser_window_check_throbber(struct browser_window *bw);
-static void browser_window_convert_to_download(struct browser_window *bw,
- llcache_handle *stream);
-static void browser_window_start_throbber(struct browser_window *bw);
-static void browser_window_stop_throbber(struct browser_window *bw);
-static void browser_window_destroy_children(struct browser_window *bw);
-static void browser_window_destroy_internal(struct browser_window *bw);
-static void browser_window_set_scale_internal(struct browser_window *bw,
- float scale);
-static void browser_window_find_target_internal(struct browser_window *bw,
- const char *target, int depth, struct browser_window *page,
- int *rdepth, struct browser_window **bw_target);
-static void browser_window_mouse_drag_end(struct browser_window *bw,
- browser_mouse_state mouse, int x, int y);
/**
@@ -839,174 +822,63 @@ browser_window_download(struct browser_window *bw,
return error;
}
-/* exported interface documented in desktop/browser.h */
-nserror browser_window_navigate(struct browser_window *bw,
- nsurl *url,
- nsurl *referrer,
- enum browser_window_nav_flags flags,
- char *post_urlenc,
- struct fetch_multipart_data *post_multipart,
- hlcache_handle *parent)
-{
- hlcache_handle *c;
- int depth = 0;
- struct browser_window *cur;
- uint32_t fetch_flags = 0;
- bool fetch_is_post = (post_urlenc != NULL || post_multipart != NULL);
- llcache_post_data post;
- hlcache_child_context child;
- nserror error;
-
- assert(bw);
- assert(url);
-
- LOG(("bw %p, url %s", bw, nsurl_access(url)));
-
- /* don't allow massively nested framesets */
- for (cur = bw; cur->parent; cur = cur->parent) {
- depth++;
- }
- if (depth > FRAME_DEPTH) {
- LOG(("frame depth too high."));
- return NSERROR_FRAME_DEPTH;
- }
-
- /* Set up retrieval parameters */
- if ((flags & BROWSER_WINDOW_VERIFIABLE) != 0) {
- fetch_flags |= LLCACHE_RETRIEVE_VERIFIABLE;
- }
-
- if (post_multipart != NULL) {
- post.type = LLCACHE_POST_MULTIPART;
- post.data.multipart = post_multipart;
- } else if (post_urlenc != NULL) {
- post.type = LLCACHE_POST_URL_ENCODED;
- post.data.urlenc = post_urlenc;
- }
-
- if ((parent != NULL) && (content_get_type(parent) == CONTENT_HTML)) {
- child.charset = html_get_encoding(parent);
- child.quirks = content_get_quirks(parent);
- }
- url = nsurl_ref(url);
+static bool browser_window_check_throbber(struct browser_window *bw)
+{
+ int children, index;
- if (referrer != NULL) {
- referrer = nsurl_ref(referrer);
- }
+ if (bw->throbbing)
+ return true;
- /* Get download out of the way */
- if ((flags & BROWSER_WINDOW_DOWNLOAD) != 0) {
- error = browser_window_download(bw,
- url,
- referrer,
- fetch_flags,
- fetch_is_post,
- &post);
- nsurl_unref(url);
- if (referrer != NULL) {
- nsurl_unref(referrer);
+ if (bw->children) {
+ children = bw->rows * bw->cols;
+ for (index = 0; index < children; index++) {
+ if (browser_window_check_throbber(&bw->children[index]))
+ return true;
}
- return error;
}
-
- if (bw->frag_id != NULL) {
- lwc_string_unref(bw->frag_id);
- }
- bw->frag_id = NULL;
-
- if (nsurl_has_component(url, NSURL_FRAGMENT)) {
- bool same_url = false;
-
- bw->frag_id = nsurl_get_component(url, NSURL_FRAGMENT);
-
- /* Compare new URL with existing one (ignoring fragments) */
- if ((bw->current_content != NULL) &&
- (hlcache_handle_get_url(bw->current_content) != NULL)) {
- same_url = nsurl_compare(url,
- hlcache_handle_get_url(bw->current_content),
- NSURL_COMPLETE);
- }
-
- /* if we're simply moving to another ID on the same page,
- * don't bother to fetch, just update the window.
- */
- if ((same_url) &&
- (fetch_is_post == false) &&
- (nsurl_has_component(url, NSURL_QUERY) == false)) {
- nsurl_unref(url);
-
- if (referrer != NULL) {
- nsurl_unref(referrer);
- }
-
- if ((flags & BROWSER_WINDOW_HISTORY) != 0) {
- history_add(bw->history,
- bw->current_content, bw->frag_id);
- }
-
- browser_window_update(bw, false);
-
- if (bw->current_content != NULL) {
- browser_window_refresh_url_bar(bw,
- hlcache_handle_get_url(bw->current_content),
- bw->frag_id);
- }
- return NSERROR_OK;
+ if (bw->iframes) {
+ for (index = 0; index < bw->iframe_count; index++) {
+ if (browser_window_check_throbber(&bw->iframes[index]))
+ return true;
}
}
+ return false;
+}
- browser_window_stop(bw);
- browser_window_remove_caret(bw, false);
- browser_window_destroy_children(bw);
-
- LOG(("Loading '%s'", nsurl_access(url)));
-
- browser_window_set_status(bw, messages_get("Loading"));
- bw->history_add = (flags & BROWSER_WINDOW_HISTORY);
- /* Verifiable fetches may trigger a download */
- if ((flags & BROWSER_WINDOW_VERIFIABLE) != 0) {
- fetch_flags |= HLCACHE_RETRIEVE_MAY_DOWNLOAD;
- }
+/**
+ * Start the busy indicator.
+ *
+ * \param bw browser window
+ */
- error = hlcache_handle_retrieve(url,
- fetch_flags | HLCACHE_RETRIEVE_SNIFF_TYPE,
- referrer,
- fetch_is_post ? &post : NULL,
- browser_window_callback, bw,
- parent != NULL ? &child : NULL,
- CONTENT_ANY, &c);
+static void browser_window_start_throbber(struct browser_window *bw)
+{
+ bw->throbbing = true;
- switch (error) {
- case NSERROR_OK:
- bw->loading_content = c;
- browser_window_start_throbber(bw);
- browser_window_refresh_url_bar(bw, url, NULL);
- break;
+ while (bw->parent)
+ bw = bw->parent;
- case NSERROR_NO_FETCH_HANDLER: /* no handler for this type */
- /** @todo does this always try and download even unverifiable content? */
- gui_launch_url(nsurl_access(url));
- break;
+ gui_window_start_throbber(bw->window);
+}
- 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);
- break;
- }
+/**
+ * Stop the busy indicator.
+ *
+ * \param bw browser window
+ */
- nsurl_unref(url);
- if (referrer != NULL) {
- nsurl_unref(referrer);
- }
+static void browser_window_stop_throbber(struct browser_window *bw)
+{
+ bw->throbbing = false;
- /* Record time */
- bw->last_action = wallclock();
+ while (bw->parent)
+ bw = bw->parent;
- return error;
+ if (!browser_window_check_throbber(bw))
+ gui_window_stop_throbber(bw->window);
}
@@ -1203,53 +1075,138 @@ browser_window_callback_errorcode(hlcache_handle *c,
browser_window_stop_throbber(bw);
}
+
/**
- * Callback for fetchcache() for browser window fetches.
+ * Handle meta http-equiv refresh time elapsing by loading a new page.
+ *
+ * \param p browser window to refresh with new page
*/
-nserror browser_window_callback(hlcache_handle *c,
- const hlcache_event *event, void *pw)
+static void browser_window_refresh(void *p)
{
- struct browser_window *bw = pw;
-
- switch (event->type) {
- case CONTENT_MSG_DOWNLOAD:
- assert(bw->loading_content == c);
-
- browser_window_convert_to_download(bw, event->data.download);
-
- if (bw->current_content != NULL) {
- browser_window_refresh_url_bar(bw,
- hlcache_handle_get_url(bw->current_content),
- bw->frag_id);
- }
- break;
+ struct browser_window *bw = p;
+ nsurl *url;
+ nsurl *refresh;
+ hlcache_handle *parent = NULL;
+ enum browser_window_nav_flags flags = BROWSER_WINDOW_NONE;
- case CONTENT_MSG_LOADING:
- assert(bw->loading_content == c);
+ assert(bw->current_content != NULL &&
+ (content_get_status(bw->current_content) ==
+ CONTENT_STATUS_READY ||
+ content_get_status(bw->current_content) ==
+ CONTENT_STATUS_DONE));
-#ifdef WITH_THEME_INSTALL
- if (content_get_type(c) == CONTENT_THEME) {
- theme_install_start(c);
- bw->loading_content = NULL;
- browser_window_stop_throbber(bw);
- } else
-#endif
- {
- bw->refresh_interval = -1;
- browser_window_set_status(bw,
- content_get_status_message(c));
- }
- break;
+ /* Ignore if the refresh URL has gone
+ * (may happen if a fetch error occurred) */
+ refresh = content_get_refresh_url(bw->current_content);
+ if (refresh == NULL)
+ return;
- case CONTENT_MSG_READY:
- {
- int width, height;
+ /* mark this content as invalid so it gets flushed from the cache */
+ content_invalidate_reuse_data(bw->current_content);
- assert(bw->loading_content == c);
+ url = hlcache_handle_get_url(bw->current_content);
+ if ((url == NULL) || (nsurl_compare(url, refresh, NSURL_COMPLETE))) {
+ flags |= BROWSER_WINDOW_HISTORY;
+ }
- if (bw->current_content != NULL) {
- content_status status =
+ /* Treat an (almost) immediate refresh in a top-level browser window as
+ * if it were an HTTP redirect, and thus make the resulting fetch
+ * verifiable.
+ *
+ * See fetchcache.c for why redirected fetches should be verifiable at
+ * all.
+ */
+ if (bw->refresh_interval <= 100 && bw->parent == NULL) {
+ flags |= BROWSER_WINDOW_VERIFIABLE;
+ } else {
+ parent = bw->current_content;
+ }
+
+ browser_window_navigate(bw,
+ refresh,
+ url,
+ flags,
+ NULL,
+ NULL,
+ parent);
+
+}
+
+
+/**
+ * Transfer the loading_content to a new download window.
+ */
+
+static void browser_window_convert_to_download(struct browser_window *bw,
+ llcache_handle *stream)
+{
+ struct browser_window *root = browser_window_get_root(bw);
+ nserror error;
+
+ assert(root != NULL);
+
+ error = download_context_create(stream, root->window);
+ if (error != NSERROR_OK) {
+ llcache_handle_abort(stream);
+ llcache_handle_release(stream);
+ }
+
+ /* remove content from browser window */
+ hlcache_handle_release(bw->loading_content);
+ bw->loading_content = NULL;
+
+ browser_window_stop_throbber(bw);
+}
+
+
+/**
+ * Callback for fetchcache() for browser window fetches.
+ */
+
+static nserror browser_window_callback(hlcache_handle *c,
+ const hlcache_event *event, void *pw)
+{
+ struct browser_window *bw = pw;
+
+ switch (event->type) {
+ case CONTENT_MSG_DOWNLOAD:
+ assert(bw->loading_content == c);
+
+ browser_window_convert_to_download(bw, event->data.download);
+
+ if (bw->current_content != NULL) {
+ browser_window_refresh_url_bar(bw,
+ hlcache_handle_get_url(bw->current_content),
+ bw->frag_id);
+ }
+ break;
+
+ case CONTENT_MSG_LOADING:
+ assert(bw->loading_content == c);
+
+#ifdef WITH_THEME_INSTALL
+ if (content_get_type(c) == CONTENT_THEME) {
+ theme_install_start(c);
+ bw->loading_content = NULL;
+ browser_window_stop_throbber(bw);
+ } else
+#endif
+ {
+ bw->refresh_interval = -1;
+ browser_window_set_status(bw,
+ content_get_status_message(c));
+ }
+ break;
+
+ case CONTENT_MSG_READY:
+ {
+ int width, height;
+
+ assert(bw->loading_content == c);
+
+ if (bw->current_content != NULL) {
+ content_status status =
content_get_status(bw->current_content);
if (status == CONTENT_STATUS_READY ||
@@ -1427,7 +1384,8 @@ nserror browser_window_callback(hlcache_handle *c,
&icon_str) == lwc_error_ok) {
if (lwc_string_caseless_isequal(
event->data.rfc5988_link->rel,
- icon_str, &icon_match) != lwc_error_ok) {
+ icon_str,
+ &icon_match) != lwc_error_ok) {
icon_match = false;
}
lwc_string_unref(icon_str);
@@ -1582,196 +1540,368 @@ nserror browser_window_callback(hlcache_handle *c,
}
-/*
- * Get the dimensions of the area a browser window occupies
+/* Have to forward declare browser_window_destroy_internal */
+static void browser_window_destroy_internal(struct browser_window *bw);
+
+/**
+ * Close and destroy all child browser window.
*
- * \param bw The browser window to get dimensions of
- * \param width Updated to the browser window viewport width
- * \param height Updated to the browser window viewport height
- * \param scaled Whether we want the height with scale applied
+ * \param bw browser window
*/
-
-void browser_window_get_dimensions(struct browser_window *bw,
- int *width, int *height, bool scaled)
+static void browser_window_destroy_children(struct browser_window *bw)
{
- assert(bw);
+ int i;
- if (bw->window == NULL) {
- /* Core managed browser window */
- *width = bw->width;
- *height = bw->height;
- } else {
- /* Front end window */
- gui_window_get_dimensions(bw->window, width, height, scaled);
+ if (bw->children) {
+ for (i = 0; i < (bw->rows * bw->cols); i++)
+ browser_window_destroy_internal(&bw->children[i]);
+ free(bw->children);
+ bw->children = NULL;
+ bw->rows = 0;
+ bw->cols = 0;
+ }
+ if (bw->iframes) {
+ for (i = 0; i < bw->iframe_count; i++)
+ browser_window_destroy_internal(&bw->iframes[i]);
+ free(bw->iframes);
+ bw->iframes = NULL;
+ bw->iframe_count = 0;
}
}
-/*
- * Set the dimensions of the area a browser window occupies
+/**
+ * Release all memory associated with a browser window.
*
- * \param bw The browser window to set dimensions of
- * \param width Width in pixels
- * \param height Height in pixels
+ * \param bw browser window
*/
-
-void browser_window_set_dimensions(struct browser_window *bw,
- int width, int height)
+void browser_window_destroy_internal(struct browser_window *bw)
{
assert(bw);
- if (bw->window == NULL) {
- /* Core managed browser window */
- bw->width = width;
- bw->height = height;
- } else {
- LOG(("Asked to set dimensions of front end window."));
- assert(0);
- }
-}
+ LOG(("Destroying window"));
+ if (bw->children != NULL || bw->iframes != NULL)
+ browser_window_destroy_children(bw);
-/**
- * Transfer the loading_content to a new download window.
- */
+ schedule_remove(browser_window_refresh, bw);
-void browser_window_convert_to_download(struct browser_window *bw,
- llcache_handle *stream)
-{
- struct browser_window *root = browser_window_get_root(bw);
- nserror error;
+ /* If this brower window is not the root window, and has focus, unset
+ * the root browser window's focus pointer. */
+ if (!bw->window) {
+ struct browser_window *top = browser_window_get_root(bw);
- assert(root != NULL);
+ if (top->focus == bw)
+ top->focus = top;
- error = download_context_create(stream, root->window);
- if (error != NSERROR_OK) {
- llcache_handle_abort(stream);
- llcache_handle_release(stream);
+ if (top->selection.bw == bw) {
+ browser_window_set_selection(top, false, false);
+ }
}
- /* remove content from browser window */
- hlcache_handle_release(bw->loading_content);
- bw->loading_content = NULL;
-
- browser_window_stop_throbber(bw);
-}
+ /* Destruction order is important: we must ensure that the frontend
+ * destroys any window(s) associated with this browser window before
+ * we attempt any destructive cleanup.
+ */
+ if (bw->window) {
+ /* Only the root window has a GUI window */
+ gui_window_destroy(bw->window);
+ }
-/**
- * Handle meta http-equiv refresh time elapsing by loading a new page.
- *
- * \param p browser window to refresh with new page
- */
+ if (bw->loading_content != NULL) {
+ hlcache_handle_abort(bw->loading_content);
+ hlcache_handle_release(bw->loading_content);
+ bw->loading_content = NULL;
+ }
-void browser_window_refresh(void *p)
-{
- struct browser_window *bw = p;
- nsurl *url;
- nsurl *refresh;
- hlcache_handle *parent = NULL;
- enum browser_window_nav_flags flags = BROWSER_WINDOW_NONE;
+ if (bw->current_content != NULL) {
+ content_status status = content_get_status(bw->current_content);
+ if (status == CONTENT_STATUS_READY ||
+ status == CONTENT_STATUS_DONE)
+ content_close(bw->current_content);
- assert(bw->current_content != NULL &&
- (content_get_status(bw->current_content) ==
- CONTENT_STATUS_READY ||
- content_get_status(bw->current_content) ==
- CONTENT_STATUS_DONE));
+ hlcache_handle_release(bw->current_content);
+ bw->current_content = NULL;
+ }
- /* Ignore if the refresh URL has gone
- * (may happen if a fetch error occurred) */
- refresh = content_get_refresh_url(bw->current_content);
- if (refresh == NULL)
- return;
+ if (bw->loading_favicon != NULL) {
+ hlcache_handle_abort(bw->loading_favicon);
+ hlcache_handle_release(bw->loading_favicon);
+ bw->loading_favicon = NULL;
+ }
- /* mark this content as invalid so it gets flushed from the cache */
- content_invalidate_reuse_data(bw->current_content);
+ if (bw->current_favicon != NULL) {
+ content_status status = content_get_status(bw->current_favicon);
- url = hlcache_handle_get_url(bw->current_content);
- if ((url == NULL) || (nsurl_compare(url, refresh, NSURL_COMPLETE))) {
- flags |= BROWSER_WINDOW_HISTORY;
- }
+ if (status == CONTENT_STATUS_READY ||
+ status == CONTENT_STATUS_DONE)
+ content_close(bw->current_favicon);
- /* Treat an (almost) immediate refresh in a top-level browser window as
- * if it were an HTTP redirect, and thus make the resulting fetch
- * verifiable.
- *
- * See fetchcache.c for why redirected fetches should be verifiable at
- * all.
- */
- if (bw->refresh_interval <= 100 && bw->parent == NULL) {
- flags |= BROWSER_WINDOW_VERIFIABLE;
- } else {
- parent = bw->current_content;
+ hlcache_handle_release(bw->current_favicon);
+ bw->current_favicon = NULL;
}
- browser_window_navigate(bw,
- refresh,
- url,
- flags,
- NULL,
- NULL,
- parent);
+ if (bw->box != NULL) {
+ bw->box->iframe = NULL;
+ bw->box = NULL;
+ }
+ if (bw->jsctx != NULL) {
+ js_destroycontext(bw->jsctx);
+ }
+
+ /* These simply free memory, so are safe here */
+
+ if (bw->frag_id != NULL)
+ lwc_string_unref(bw->frag_id);
+
+ history_destroy(bw->history);
+
+ free(bw->name);
+ free(bw->status_text);
+ bw->status_text = NULL;
+ LOG(("Status text cache match:miss %d:%d",
+ bw->status_match, bw->status_miss));
}
/**
- * Start the busy indicator.
+ * Close and destroy a browser window.
*
* \param bw browser window
*/
+void browser_window_destroy(struct browser_window *bw)
+{
+ /* can't destoy child windows on their own */
+ assert(!bw->parent);
-void browser_window_start_throbber(struct browser_window *bw)
+ /* destroy */
+ browser_window_destroy_internal(bw);
+ free(bw);
+}
+
+
+/* exported interface documented in desktop/browser.h */
+nserror browser_window_navigate(struct browser_window *bw,
+ nsurl *url,
+ nsurl *referrer,
+ enum browser_window_nav_flags flags,
+ char *post_urlenc,
+ struct fetch_multipart_data *post_multipart,
+ hlcache_handle *parent)
{
- bw->throbbing = true;
+ hlcache_handle *c;
+ int depth = 0;
+ struct browser_window *cur;
+ uint32_t fetch_flags = 0;
+ bool fetch_is_post = (post_urlenc != NULL || post_multipart != NULL);
+ llcache_post_data post;
+ hlcache_child_context child;
+ nserror error;
- while (bw->parent)
- bw = bw->parent;
+ assert(bw);
+ assert(url);
- gui_window_start_throbber(bw->window);
+ LOG(("bw %p, url %s", bw, nsurl_access(url)));
+
+ /* don't allow massively nested framesets */
+ for (cur = bw; cur->parent; cur = cur->parent) {
+ depth++;
+ }
+ if (depth > FRAME_DEPTH) {
+ LOG(("frame depth too high."));
+ return NSERROR_FRAME_DEPTH;
+ }
+
+ /* Set up retrieval parameters */
+ if ((flags & BROWSER_WINDOW_VERIFIABLE) != 0) {
+ fetch_flags |= LLCACHE_RETRIEVE_VERIFIABLE;
+ }
+
+ if (post_multipart != NULL) {
+ post.type = LLCACHE_POST_MULTIPART;
+ post.data.multipart = post_multipart;
+ } else if (post_urlenc != NULL) {
+ post.type = LLCACHE_POST_URL_ENCODED;
+ post.data.urlenc = post_urlenc;
+ }
+
+ if ((parent != NULL) && (content_get_type(parent) == CONTENT_HTML)) {
+ child.charset = html_get_encoding(parent);
+ child.quirks = content_get_quirks(parent);
+ }
+
+ url = nsurl_ref(url);
+
+ if (referrer != NULL) {
+ referrer = nsurl_ref(referrer);
+ }
+
+ /* Get download out of the way */
+ if ((flags & BROWSER_WINDOW_DOWNLOAD) != 0) {
+ error = browser_window_download(bw,
+ url,
+ referrer,
+ fetch_flags,
+ fetch_is_post,
+ &post);
+ nsurl_unref(url);
+ if (referrer != NULL) {
+ nsurl_unref(referrer);
+ }
+ return error;
+ }
+
+ if (bw->frag_id != NULL) {
+ lwc_string_unref(bw->frag_id);
+ }
+ bw->frag_id = NULL;
+
+ if (nsurl_has_component(url, NSURL_FRAGMENT)) {
+ bool same_url = false;
+
+ bw->frag_id = nsurl_get_component(url, NSURL_FRAGMENT);
+
+ /* Compare new URL with existing one (ignoring fragments) */
+ if ((bw->current_content != NULL) &&
+ (hlcache_handle_get_url(bw->current_content) != NULL)) {
+ same_url = nsurl_compare(url,
+ hlcache_handle_get_url(bw->current_content),
+ NSURL_COMPLETE);
+ }
+
+ /* if we're simply moving to another ID on the same page,
+ * don't bother to fetch, just update the window.
+ */
+ if ((same_url) &&
+ (fetch_is_post == false) &&
+ (nsurl_has_component(url, NSURL_QUERY) == false)) {
+ nsurl_unref(url);
+
+ if (referrer != NULL) {
+ nsurl_unref(referrer);
+ }
+
+ if ((flags & BROWSER_WINDOW_HISTORY) != 0) {
+ history_add(bw->history,
+ bw->current_content, bw->frag_id);
+ }
+
+ browser_window_update(bw, false);
+
+ if (bw->current_content != NULL) {
+ browser_window_refresh_url_bar(bw,
+ hlcache_handle_get_url(bw->current_content),
+ bw->frag_id);
+ }
+ return NSERROR_OK;
+ }
+ }
+
+ browser_window_stop(bw);
+ browser_window_remove_caret(bw, false);
+ browser_window_destroy_children(bw);
+
+ LOG(("Loading '%s'", nsurl_access(url)));
+
+ browser_window_set_status(bw, messages_get("Loading"));
+ bw->history_add = (flags & BROWSER_WINDOW_HISTORY);
+
+ /* Verifiable fetches may trigger a download */
+ if ((flags & BROWSER_WINDOW_VERIFIABLE) != 0) {
+ fetch_flags |= HLCACHE_RETRIEVE_MAY_DOWNLOAD;
+ }
+
+ error = hlcache_handle_retrieve(url,
+ fetch_flags | HLCACHE_RETRIEVE_SNIFF_TYPE,
+ referrer,
+ fetch_is_post ? &post : NULL,
+ browser_window_callback, bw,
+ parent != NULL ? &child : NULL,
+ CONTENT_ANY, &c);
+
+ switch (error) {
+ case NSERROR_OK:
+ bw->loading_content = c;
+ browser_window_start_throbber(bw);
+ browser_window_refresh_url_bar(bw, url, NULL);
+ break;
+
+ case NSERROR_NO_FETCH_HANDLER: /* no handler for this type */
+ /** @todo does this always try and download even unverifiable content? */
+ gui_launch_url(nsurl_access(url));
+ break;
+
+ 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);
+ break;
+
+ }
+
+ nsurl_unref(url);
+ if (referrer != NULL) {
+ nsurl_unref(referrer);
+ }
+
+ /* Record time */
+ bw->last_action = wallclock();
+
+ return error;
}
-/**
- * Stop the busy indicator.
+/*
+ * Get the dimensions of the area a browser window occupies
*
- * \param bw browser window
+ * \param bw The browser window to get dimensions of
+ * \param width Updated to the browser window viewport width
+ * \param height Updated to the browser window viewport height
+ * \param scaled Whether we want the height with scale applied
*/
-void browser_window_stop_throbber(struct browser_window *bw)
+void browser_window_get_dimensions(struct browser_window *bw,
+ int *width, int *height, bool scaled)
{
- bw->throbbing = false;
-
- while (bw->parent)
- bw = bw->parent;
+ assert(bw);
- if (!browser_window_check_throbber(bw))
- gui_window_stop_throbber(bw->window);
+ if (bw->window == NULL) {
+ /* Core managed browser window */
+ *width = bw->width;
+ *height = bw->height;
+ } else {
+ /* Front end window */
+ gui_window_get_dimensions(bw->window, width, height, scaled);
+ }
}
-bool browser_window_check_throbber(struct browser_window *bw)
-{
- int children, index;
- if (bw->throbbing)
- return true;
+/*
+ * Set the dimensions of the area a browser window occupies
+ *
+ * \param bw The browser window to set dimensions of
+ * \param width Width in pixels
+ * \param height Height in pixels
+ */
- if (bw->children) {
- children = bw->rows * bw->cols;
- for (index = 0; index < children; index++) {
- if (browser_window_check_throbber(&bw->children[index]))
- return true;
- }
- }
- if (bw->iframes) {
- for (index = 0; index < bw->iframe_count; index++) {
- if (browser_window_check_throbber(&bw->iframes[index]))
- return true;
- }
+void browser_window_set_dimensions(struct browser_window *bw,
+ int width, int height)
+{
+ assert(bw);
+
+ if (bw->window == NULL) {
+ /* Core managed browser window */
+ bw->width = width;
+ bw->height = height;
+ } else {
+ LOG(("Asked to set dimensions of front end window."));
+ assert(0);
}
- return false;
}
+
/**
* Redraw browser window, set extent to content, and update title.
*
@@ -2043,172 +2173,30 @@ void browser_window_set_pointer(struct browser_window *bw,
bool loading;
assert(root);
- assert(root->window);
-
- loading = (bw->loading_content != NULL || (bw->current_content &&
- content_get_status(bw->current_content) ==
- CONTENT_STATUS_READY));
-
- if (wallclock() - bw->last_action < 100 && loading) {
- /* If loading and less than 1 second since last link followed,
- * force progress indicator pointer */
- gui_shape = GUI_POINTER_PROGRESS;
-
- } else if (shape == BROWSER_POINTER_AUTO) {
- /* Up to browser window to decide */
- if (loading)
- gui_shape = GUI_POINTER_PROGRESS;
- else
- gui_shape = GUI_POINTER_DEFAULT;
-
- } else {
- /* Use what we were told */
- gui_shape = (gui_pointer_shape)shape;
- }
-
- gui_window_set_pointer(root->window, gui_shape);
-}
-
-
-/**
- * Close and destroy a browser window.
- *
- * \param bw browser window
- */
-
-void browser_window_destroy(struct browser_window *bw)
-{
- /* can't destoy child windows on their own */
- assert(!bw->parent);
-
- /* destroy */
- browser_window_destroy_internal(bw);
- free(bw);
-}
-
-
-/**
- * Close and destroy all child browser window.
- *
- * \param bw browser window
- */
-
-void browser_window_destroy_children(struct browser_window *bw)
-{
- int i;
-
- if (bw->children) {
- for (i = 0; i < (bw->rows * bw->cols); i++)
- browser_window_destroy_internal(&bw->children[i]);
- free(bw->children);
- bw->children = NULL;
- bw->rows = 0;
- bw->cols = 0;
- }
- if (bw->iframes) {
- for (i = 0; i < bw->iframe_count; i++)
- browser_window_destroy_internal(&bw->iframes[i]);
- free(bw->iframes);
- bw->iframes = NULL;
- bw->iframe_count = 0;
- }
-}
-
-
-/**
- * Release all memory associated with a browser window.
- *
- * \param bw browser window
- */
-
-void browser_window_destroy_internal(struct browser_window *bw)
-{
- assert(bw);
-
- LOG(("Destroying window"));
-
- if (bw->children != NULL || bw->iframes != NULL)
- browser_window_destroy_children(bw);
-
- schedule_remove(browser_window_refresh, bw);
-
- /* If this brower window is not the root window, and has focus, unset
- * the root browser window's focus pointer. */
- if (!bw->window) {
- struct browser_window *top = browser_window_get_root(bw);
-
- if (top->focus == bw)
- top->focus = top;
-
- if (top->selection.bw == bw) {
- browser_window_set_selection(top, false, false);
- }
- }
-
- /* Destruction order is important: we must ensure that the frontend
- * destroys any window(s) associated with this browser window before
- * we attempt any destructive cleanup.
- */
-
- if (bw->window) {
- /* Only the root window has a GUI window */
- gui_window_destroy(bw->window);
- }
-
- if (bw->loading_content != NULL) {
- hlcache_handle_abort(bw->loading_content);
- hlcache_handle_release(bw->loading_content);
- bw->loading_content = NULL;
- }
-
- if (bw->current_content != NULL) {
- content_status status = content_get_status(bw->current_content);
- if (status == CONTENT_STATUS_READY ||
- status == CONTENT_STATUS_DONE)
- content_close(bw->current_content);
-
- hlcache_handle_release(bw->current_content);
- bw->current_content = NULL;
- }
-
- if (bw->loading_favicon != NULL) {
- hlcache_handle_abort(bw->loading_favicon);
- hlcache_handle_release(bw->loading_favicon);
- bw->loading_favicon = NULL;
- }
-
- if (bw->current_favicon != NULL) {
- content_status status = content_get_status(bw->current_favicon);
-
- if (status == CONTENT_STATUS_READY ||
- status == CONTENT_STATUS_DONE)
- content_close(bw->current_favicon);
-
- hlcache_handle_release(bw->current_favicon);
- bw->current_favicon = NULL;
- }
-
- if (bw->box != NULL) {
- bw->box->iframe = NULL;
- bw->box = NULL;
- }
+ assert(root->window);
- if (bw->jsctx != NULL) {
- js_destroycontext(bw->jsctx);
- }
+ loading = (bw->loading_content != NULL || (bw->current_content &&
+ content_get_status(bw->current_content) ==
+ CONTENT_STATUS_READY));
- /* These simply free memory, so are safe here */
+ if (wallclock() - bw->last_action < 100 && loading) {
+ /* If loading and less than 1 second since last link followed,
+ * force progress indicator pointer */
+ gui_shape = GUI_POINTER_PROGRESS;
- if (bw->frag_id != NULL)
- lwc_string_unref(bw->frag_id);
+ } else if (shape == BROWSER_POINTER_AUTO) {
+ /* Up to browser window to decide */
+ if (loading)
+ gui_shape = GUI_POINTER_PROGRESS;
+ else
+ gui_shape = GUI_POINTER_DEFAULT;
- history_destroy(bw->history);
+ } else {
+ /* Use what we were told */
+ gui_shape = (gui_pointer_shape)shape;
+ }
- free(bw->name);
- free(bw->status_text);
- bw->status_text = NULL;
- LOG(("Status text cache match:miss %d:%d",
- bw->status_match, bw->status_miss));
+ gui_window_set_pointer(root->window, gui_shape);
}
@@ -2246,29 +2234,8 @@ void browser_window_reformat(struct browser_window *bw, bool background,
content_reformat(c, background, width, height);
}
-
-/**
- * Sets the scale of a browser window
- *
- * \param bw The browser window to scale
- * \param scale The new scale
- * \param all Scale all windows in the tree (ie work up aswell as down)
- */
-
-void browser_window_set_scale(struct browser_window *bw, float scale, bool all)
-{
- while (bw->parent && all)
- bw = bw->parent;
-
- browser_window_set_scale_internal(bw, scale);
-
- if (bw->parent)
- bw = bw->parent;
-
- browser_window_recalculate_frameset(bw);
-}
-
-void browser_window_set_scale_internal(struct browser_window *bw, float scale)
+static void browser_window_set_scale_internal(struct browser_window *bw,
+ float scale)
{
int i;
hlcache_handle *c;
@@ -2296,6 +2263,28 @@ void browser_window_set_scale_internal(struct browser_window *bw, float scale)
/**
+ * Sets the scale of a browser window
+ *
+ * \param bw The browser window to scale
+ * \param scale The new scale
+ * \param all Scale all windows in the tree (ie work up aswell as down)
+ */
+
+void browser_window_set_scale(struct browser_window *bw, float scale, bool all)
+{
+ while (bw->parent && all)
+ bw = bw->parent;
+
+ browser_window_set_scale_internal(bw, scale);
+
+ if (bw->parent)
+ bw = bw->parent;
+
+ browser_window_recalculate_frameset(bw);
+}
+
+
+/**
* Gets the scale of a browser window
*
* \param bw The browser window to scale
@@ -2347,6 +2336,52 @@ void browser_window_refresh_url_bar(struct browser_window *bw, nsurl *url,
}
}
+
+static void browser_window_find_target_internal(struct browser_window *bw,
+ const char *target, int depth, struct browser_window *page,
+ int *rdepth, struct browser_window **bw_target)
+{
+ int i;
+
+ if ((bw->name) && (!strcasecmp(bw->name, target))) {
+ if ((bw == page) || (depth > *rdepth)) {
+ *rdepth = depth;
+ *bw_target = bw;
+ }
+ }
+
+ if ((!bw->children) && (!bw->iframes))
+ return;
+
+ depth++;
+
+ if (bw->children != NULL) {
+ for (i = 0; i < (bw->cols * bw->rows); i++) {
+ if ((bw->children[i].name) &&
+ (!strcasecmp(bw->children[i].name,
+ target))) {
+ if ((page == &bw->children[i]) ||
+ (depth > *rdepth)) {
+ *rdepth = depth;
+ *bw_target = &bw->children[i];
+ }
+ }
+ if (bw->children[i].children)
+ browser_window_find_target_internal(
+ &bw->children[i],
+ target, depth, page,
+ rdepth, bw_target);
+ }
+ }
+
+ if (bw->iframes != NULL) {
+ for (i = 0; i < bw->iframe_count; i++)
+ browser_window_find_target_internal(&bw->iframes[i],
+ target, depth, page, rdepth, bw_target);
+ }
+}
+
+
/**
* Locate a browser window in the specified stack according.
*
@@ -2492,47 +2527,58 @@ struct browser_window *browser_window_find_target(struct browser_window *bw,
return bw_target;
}
-void browser_window_find_target_internal(struct browser_window *bw,
- const char *target, int depth, struct browser_window *page,
- int *rdepth, struct browser_window **bw_target)
+
+/**
+ * Handles the end of a drag operation in a browser window.
+ *
+ * \param bw browser window
+ * \param mouse state of mouse buttons and modifier keys
+ * \param x coordinate of mouse
+ * \param y coordinate of mouse
+ *
+ * TODO: Remove this function, once these things are associated with content,
+ * rather than bw.
+ */
+
+static void browser_window_mouse_drag_end(struct browser_window *bw,
+ browser_mouse_state mouse, int x, int y)
{
- int i;
+ int scr_x, scr_y;
- if ((bw->name) && (!strcasecmp(bw->name, target))) {
- if ((bw == page) || (depth > *rdepth)) {
- *rdepth = depth;
- *bw_target = bw;
- }
- }
+ switch (bw->drag_type) {
+ case DRAGGING_SELECTION:
+ case DRAGGING_OTHER:
+ case DRAGGING_CONTENT_SCROLLBAR:
+ /* Drag handled by content handler */
+ break;
- if ((!bw->children) && (!bw->iframes))
- return;
+ case DRAGGING_SCR_X:
- depth++;
+ browser_window_get_scrollbar_pos(bw, true, &scr_x, &scr_y);
- if (bw->children != NULL) {
- for (i = 0; i < (bw->cols * bw->rows); i++) {
- if ((bw->children[i].name) &&
- (!strcasecmp(bw->children[i].name,
- target))) {
- if ((page == &bw->children[i]) ||
- (depth > *rdepth)) {
- *rdepth = depth;
- *bw_target = &bw->children[i];
- }
- }
- if (bw->children[i].children)
- browser_window_find_target_internal(
- &bw->children[i],
- target, depth, page,
- rdepth, bw_target);
- }
- }
+ scr_x = x - scr_x - scrollbar_get_offset(bw->scroll_x);
+ scr_y = y - scr_y - scrollbar_get_offset(bw->scroll_y);
- if (bw->iframes != NULL) {
- for (i = 0; i < bw->iframe_count; i++)
- browser_window_find_target_internal(&bw->iframes[i],
- target, depth, page, rdepth, bw_target);
+ scrollbar_mouse_drag_end(bw->scroll_x, mouse, scr_x, scr_y);
+
+ bw->drag_type = DRAGGING_NONE;
+ break;
+
+ case DRAGGING_SCR_Y:
+
+ browser_window_get_scrollbar_pos(bw, false, &scr_x, &scr_y);
+
+ scr_x = x - scr_x - scrollbar_get_offset(bw->scroll_x);
+ scr_y = y - scr_y - scrollbar_get_offset(bw->scroll_y);
+
+ scrollbar_mouse_drag_end(bw->scroll_y, mouse, scr_x, scr_y);
+
+ bw->drag_type = DRAGGING_NONE;
+ break;
+
+ default:
+ browser_window_set_drag_type(bw, DRAGGING_NONE, NULL);
+ break;
}
}
@@ -2826,61 +2872,6 @@ void browser_window_mouse_click(struct browser_window *bw,
/**
- * Handles the end of a drag operation in a browser window.
- *
- * \param bw browser window
- * \param mouse state of mouse buttons and modifier keys
- * \param x coordinate of mouse
- * \param y coordinate of mouse
- *
- * TODO: Remove this function, once these things are associated with content,
- * rather than bw.
- */
-
-void browser_window_mouse_drag_end(struct browser_window *bw,
- browser_mouse_state mouse, int x, int y)
-{
- int scr_x, scr_y;
-
- switch (bw->drag_type) {
- case DRAGGING_SELECTION:
- case DRAGGING_OTHER:
- case DRAGGING_CONTENT_SCROLLBAR:
- /* Drag handled by content handler */
- break;
-
- case DRAGGING_SCR_X:
-
- browser_window_get_scrollbar_pos(bw, true, &scr_x, &scr_y);
-
- scr_x = x - scr_x - scrollbar_get_offset(bw->scroll_x);
- scr_y = y - scr_y - scrollbar_get_offset(bw->scroll_y);
-
- scrollbar_mouse_drag_end(bw->scroll_x, mouse, scr_x, scr_y);
-
- bw->drag_type = DRAGGING_NONE;
- break;
-
- case DRAGGING_SCR_Y:
-
- browser_window_get_scrollbar_pos(bw, false, &scr_x, &scr_y);
-
- scr_x = x - scr_x - scrollbar_get_offset(bw->scroll_x);
- scr_y = y - scr_y - scrollbar_get_offset(bw->scroll_y);
-
- scrollbar_mouse_drag_end(bw->scroll_y, mouse, scr_x, scr_y);
-
- bw->drag_type = DRAGGING_NONE;
- break;
-
- default:
- browser_window_set_drag_type(bw, DRAGGING_NONE, NULL);
- break;
- }
-}
-
-
-/**
* Redraw a rectangular region of a browser window
*
* \param bw browser window to be redrawn
--
NetSurf Browser
10 years, 2 months
netsurf: branch master updated. release/3.0-311-g55592d5
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/55592d5a8d25a8cb92310...
...commit http://git.netsurf-browser.org/netsurf.git/commit/55592d5a8d25a8cb92310bb...
...tree http://git.netsurf-browser.org/netsurf.git/tree/55592d5a8d25a8cb92310bb49...
The branch, master has been updated
via 55592d5a8d25a8cb92310bb49913c63336f7a0ae (commit)
via d6d9378e9b1cc082a51725cfc9901549e4b84727 (commit)
from 8d3a89b62db7ee14df788f1ea06a8beb1b283471 (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=55592d5a8d25a8cb923...
commit 55592d5a8d25a8cb92310bb49913c63336f7a0ae
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Move hotlist_visted from browser.h to hotlist.h
diff --git a/desktop/browser.h b/desktop/browser.h
index 8ffb40b..ee55e72 100644
--- a/desktop/browser.h
+++ b/desktop/browser.h
@@ -344,10 +344,6 @@ char * browser_window_get_selection(struct browser_window *bw);
*/
void browser_window_debug_dump(struct browser_window *bw, FILE *f);
-
-/* In platform specific hotlist.c. */
-void hotlist_visited(struct hlcache_handle *c);
-
/* In platform specific theme_install.c. */
#ifdef WITH_THEME_INSTALL
void theme_install_start(struct hlcache_handle *c);
diff --git a/desktop/hotlist.h b/desktop/hotlist.h
index 6092291..fa7fee2 100644
--- a/desktop/hotlist.h
+++ b/desktop/hotlist.h
@@ -42,6 +42,8 @@ bool hotlist_initialise(struct tree *tree, const char *hotlist_path, const char*
unsigned int hotlist_get_tree_flags(void);
void hotlist_cleanup(const char *hotlist_path);
+void hotlist_visited(struct hlcache_handle *c);
+
bool hotlist_export(const char *path);
void hotlist_edit_selected(void);
void hotlist_delete_selected(void);
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=d6d9378e9b1cc082a51...
commit d6d9378e9b1cc082a51725cfc9901549e4b84727
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
Move global_history_add out of browser.h into global_history_core.h
diff --git a/desktop/browser.c b/desktop/browser.c
index aa7da1f..949dca0 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -45,10 +45,11 @@
#include "desktop/browser_private.h"
#include "desktop/download.h"
#include "desktop/frames.h"
-#include "desktop/local_history.h"
-#include "desktop/hotlist.h"
#include "desktop/gui.h"
+#include "desktop/history_global_core.h"
+#include "desktop/hotlist.h"
#include "desktop/knockout.h"
+#include "desktop/local_history.h"
#include "utils/nsoption.h"
#include "desktop/scrollbar.h"
#include "desktop/selection.h"
diff --git a/desktop/browser.h b/desktop/browser.h
index 44eac99..8ffb40b 100644
--- a/desktop/browser.h
+++ b/desktop/browser.h
@@ -348,9 +348,6 @@ void browser_window_debug_dump(struct browser_window *bw, FILE *f);
/* In platform specific hotlist.c. */
void hotlist_visited(struct hlcache_handle *c);
-/* In platform specific global_history.c. */
-void global_history_add(nsurl *url);
-
/* In platform specific theme_install.c. */
#ifdef WITH_THEME_INSTALL
void theme_install_start(struct hlcache_handle *c);
diff --git a/desktop/history_global_core.h b/desktop/history_global_core.h
index 7b8e682..c55a23c 100644
--- a/desktop/history_global_core.h
+++ b/desktop/history_global_core.h
@@ -28,6 +28,8 @@ bool history_global_initialise(struct tree *tree, const char* folder_icon_name);
unsigned int history_global_get_tree_flags(void);
void history_global_cleanup(void);
+void global_history_add(nsurl *url);
+
bool history_global_export(const char *path);
void history_global_delete_selected(void);
void history_global_delete_all(void);
-----------------------------------------------------------------------
Summary of changes:
desktop/browser.c | 5 +++--
desktop/browser.h | 7 -------
desktop/history_global_core.h | 2 ++
desktop/hotlist.h | 2 ++
4 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/desktop/browser.c b/desktop/browser.c
index aa7da1f..949dca0 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -45,10 +45,11 @@
#include "desktop/browser_private.h"
#include "desktop/download.h"
#include "desktop/frames.h"
-#include "desktop/local_history.h"
-#include "desktop/hotlist.h"
#include "desktop/gui.h"
+#include "desktop/history_global_core.h"
+#include "desktop/hotlist.h"
#include "desktop/knockout.h"
+#include "desktop/local_history.h"
#include "utils/nsoption.h"
#include "desktop/scrollbar.h"
#include "desktop/selection.h"
diff --git a/desktop/browser.h b/desktop/browser.h
index 44eac99..ee55e72 100644
--- a/desktop/browser.h
+++ b/desktop/browser.h
@@ -344,13 +344,6 @@ char * browser_window_get_selection(struct browser_window *bw);
*/
void browser_window_debug_dump(struct browser_window *bw, FILE *f);
-
-/* In platform specific hotlist.c. */
-void hotlist_visited(struct hlcache_handle *c);
-
-/* In platform specific global_history.c. */
-void global_history_add(nsurl *url);
-
/* In platform specific theme_install.c. */
#ifdef WITH_THEME_INSTALL
void theme_install_start(struct hlcache_handle *c);
diff --git a/desktop/history_global_core.h b/desktop/history_global_core.h
index 7b8e682..c55a23c 100644
--- a/desktop/history_global_core.h
+++ b/desktop/history_global_core.h
@@ -28,6 +28,8 @@ bool history_global_initialise(struct tree *tree, const char* folder_icon_name);
unsigned int history_global_get_tree_flags(void);
void history_global_cleanup(void);
+void global_history_add(nsurl *url);
+
bool history_global_export(const char *path);
void history_global_delete_selected(void);
void history_global_delete_all(void);
diff --git a/desktop/hotlist.h b/desktop/hotlist.h
index 6092291..fa7fee2 100644
--- a/desktop/hotlist.h
+++ b/desktop/hotlist.h
@@ -42,6 +42,8 @@ bool hotlist_initialise(struct tree *tree, const char *hotlist_path, const char*
unsigned int hotlist_get_tree_flags(void);
void hotlist_cleanup(const char *hotlist_path);
+void hotlist_visited(struct hlcache_handle *c);
+
bool hotlist_export(const char *path);
void hotlist_edit_selected(void);
void hotlist_delete_selected(void);
--
NetSurf Browser
10 years, 2 months