diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-09 23:03:34 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-09 23:03:34 +0300 |
commit | cfcd6bd672829edfbb325e3d264570c034ccc0f1 (patch) | |
tree | d899e48469aa3a48a75e4ef8a31874608d61809a /src/history.c | |
parent | a5407bb3026da0972be19dfc89bb59dac6d5ee0c (diff) |
Closing and duplicating tabs
Diffstat (limited to 'src/history.c')
-rw-r--r-- | src/history.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/history.c b/src/history.c index c009f484..5be24608 100644 --- a/src/history.c +++ b/src/history.c | |||
@@ -17,6 +17,16 @@ void deinit_RecentUrl(iRecentUrl *d) { | |||
17 | delete_GmResponse(d->cachedResponse); | 17 | delete_GmResponse(d->cachedResponse); |
18 | } | 18 | } |
19 | 19 | ||
20 | iDefineTypeConstruction(RecentUrl) | ||
21 | |||
22 | iRecentUrl *copy_RecentUrl(const iRecentUrl *d) { | ||
23 | iRecentUrl *copy = new_RecentUrl(); | ||
24 | set_String(©->url, &d->url); | ||
25 | copy->scrollY = d->scrollY; | ||
26 | copy->cachedResponse = d->cachedResponse ? copy_GmResponse(d->cachedResponse) : NULL; | ||
27 | return copy; | ||
28 | } | ||
29 | |||
20 | /*----------------------------------------------------------------------------------------------*/ | 30 | /*----------------------------------------------------------------------------------------------*/ |
21 | 31 | ||
22 | struct Impl_History { | 32 | struct Impl_History { |
@@ -36,6 +46,15 @@ void deinit_History(iHistory *d) { | |||
36 | deinit_Array(&d->recent); | 46 | deinit_Array(&d->recent); |
37 | } | 47 | } |
38 | 48 | ||
49 | iHistory *copy_History(const iHistory *d) { | ||
50 | iHistory *copy = new_History(); | ||
51 | iConstForEach(Array, i, &d->recent) { | ||
52 | pushBack_Array(©->recent, copy_RecentUrl(i.value)); | ||
53 | } | ||
54 | copy->recentPos = d->recentPos; | ||
55 | return copy; | ||
56 | } | ||
57 | |||
39 | void save_History(const iHistory *d, const char *dirPath) { | 58 | void save_History(const iHistory *d, const char *dirPath) { |
40 | iString *line = new_String(); | 59 | iString *line = new_String(); |
41 | iFile *f = newCStr_File(concatPath_CStr(dirPath, "recent.txt")); | 60 | iFile *f = newCStr_File(concatPath_CStr(dirPath, "recent.txt")); |