aboutsummaryrefslogtreecommitdiff
path: root/main.F90
diff options
context:
space:
mode:
Diffstat (limited to 'main.F90')
-rw-r--r--main.F9055
1 files changed, 55 insertions, 0 deletions
diff --git a/main.F90 b/main.F90
index 7021195..fd618c3 100644
--- a/main.F90
+++ b/main.F90
@@ -42,6 +42,8 @@ use history
use wsa_network, only: windows_network_startup => startup
#endif
+use favorite_handling
+
implicit none
character(256)::initial_site
@@ -69,6 +71,8 @@ implicit none
type(line), pointer::first_line
type(location), pointer::locations_visited
+ type(favorite), dimension(:), allocatable::faves
+
#ifdef WINDOWS
call windows_network_startup()
#endif
@@ -101,6 +105,9 @@ implicit none
redo_layout = .false.
call r%initialize()
+ ! Load in any favorites
+ faves = load_favorites()
+
locations_visited => null()
desired_url = initial_site
current_url = " "
@@ -231,6 +238,10 @@ implicit none
loaded = .false.
+ case (render_action_favorite)
+ call add_favorite(faves, current_url, current_url)
+ call save_favorites(faves)
+
end select
end do
@@ -286,4 +297,48 @@ contains
end subroutine update_status
+ function load_favorites() result(faves)
+ use platform, only: get_favorites_file
+ use favorite_handling, only: read_favorites, favorite
+ implicit none
+
+ type(favorite), dimension(:), allocatable::faves
+
+ character(260)::filename
+ integer::ios, loadunit
+
+ call get_favorites_file(filename)
+
+ open(newunit=loadunit, file=filename, status='old', action='read', iostat=ios)
+ if(ios == 0) then
+
+ faves = read_favorites(loadunit)
+ close(loadunit)
+
+ end if
+
+ end function load_favorites
+
+ subroutine save_favorites(faves)
+ use platform, only: get_favorites_file
+ use favorite_handling, only: write_favorites, favorite
+ implicit none
+
+ type(favorite), dimension(:), allocatable::faves
+
+ character(260)::filename
+ integer::ios, loadunit
+
+ call get_favorites_file(filename)
+
+ open(newunit=loadunit, file=filename, status='unknown', action='write', iostat=ios)
+ if(ios == 0) then
+
+ call write_favorites(loadunit, faves)
+ close(loadunit)
+
+ end if
+
+ end subroutine save_favorites
+
end program gemini