diff options
author | portix <portix@gmx.net> | 2012-01-08 18:12:17 +0100 |
---|---|---|
committer | portix <portix@gmx.net> | 2012-01-08 18:12:17 +0100 |
commit | d7509713b43de28d3df9eeb29a97c22d28f50c49 (patch) | |
tree | ed0c1c8f9abe235b89dac4263396d2a2a00f5b88 /src/session.c | |
parent | bfd37678c4b07256317ece7436e0236cbda15991 (diff) | |
download | dwb-d7509713b43de28d3df9eeb29a97c22d28f50c49.zip |
Save locked/protectd/visible state between sessions
Diffstat (limited to 'src/session.c')
-rw-r--r-- | src/session.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/session.c b/src/session.c index f4284dcd..ae58aa9b 100644 --- a/src/session.c +++ b/src/session.c @@ -99,18 +99,27 @@ session_restore(const char *name) { } char **lines = g_strsplit(group, "\n", -1); g_free(group); - GList *currentview, *lastview = NULL; + GList *currentview = NULL, *lastview = NULL; WebKitWebBackForwardList *bf_list = NULL; int last = 1; char *uri = NULL; + char *end; + int locked_state = 0; int length = g_strv_length(lines) - 1; for (int i=1; i<=length; i++) { char **line = g_strsplit(lines[i], " ", 4); if (line[0] && line[1] && line[2]) { - int current = strtol(line[0], NULL, 10); + int current = strtol(line[0], &end, 10); + if (current == 0 && *end == '|') { + locked_state = strtol(end+1, NULL, 10); + if (lastview != NULL) + VIEW(currentview)->status->lockprotect = locked_state; + } + if (current <= last) { currentview = view_add(NULL, false); + locked_state = 0; bf_list = webkit_web_view_get_back_forward_list(WEBVIEW(currentview)); if (lastview) { session_load_webview(lastview, uri, last); @@ -156,8 +165,11 @@ session_save(const char *name) { for (int i= -webkit_web_back_forward_list_get_back_length(bf_list); i<=webkit_web_back_forward_list_get_forward_length(bf_list); i++) { WebKitWebHistoryItem *item = webkit_web_back_forward_list_get_nth_item(bf_list, i); if (item) { - g_string_append_printf(buffer, "%d %s %s\n", - i, webkit_web_history_item_get_uri(item), webkit_web_history_item_get_title(item)); + g_string_append_printf(buffer, "%d", i); + if (i == 0) + g_string_append_printf(buffer, "|%d", VIEW(l)->status->lockprotect); + g_string_append_printf(buffer, " %s %s\n", + webkit_web_history_item_get_uri(item), webkit_web_history_item_get_title(item)); } } } |