diff options
author | portix <portix@gmx.net> | 2011-03-10 21:04:38 +0100 |
---|---|---|
committer | portix <portix@gmx.net> | 2011-03-10 21:04:38 +0100 |
commit | 323197ea494efee5266d5402375cd3359819f601 (patch) | |
tree | ef837fbc36e74b3053516d309b427e0b742b483b /src/html.c | |
parent | f258b9a18a2fce517468794c7cb92ac71f9a0745 (diff) | |
download | dwb-323197ea494efee5266d5402375cd3359819f601.zip |
add settings to infopanel
--HG--
branch : html
Diffstat (limited to 'src/html.c')
-rw-r--r-- | src/html.c | 44 |
1 files changed, 20 insertions, 24 deletions
@@ -16,9 +16,10 @@ void dwb_html_history(WebKitWebView *, HtmlTable *); void dwb_html_quickmarks(WebKitWebView *, HtmlTable *); static HtmlTable table[] = { - { "dwb://bookmarks", "Bookmarks", "aii", dwb_html_bookmarks }, - { "dwb://quickmarks", "Quickmarks", "iai", dwb_html_quickmarks }, - { "dwb://history", "History", "iia", dwb_html_history }, + { "dwb://bookmarks", "Bookmarks", "aiii", dwb_html_bookmarks }, + { "dwb://quickmarks", "Quickmarks", "iaii", dwb_html_quickmarks }, + { "dwb://history", "History", "iiai", dwb_html_history }, + { "dwb://settings", "Settings", "iiia", dwb_html_history }, }; void @@ -27,45 +28,40 @@ dwb_html_load_page(WebKitWebView *wv, HtmlTable *t, char *panel) { char *path = dwb_util_get_data_file("info.html"); if (path) { g_file_get_contents(path, &filecontent, NULL, NULL); - content = g_strdup_printf(filecontent, t->title, t->state[0], t->state[1], t->state[2], panel); - webkit_web_frame_load_alternate_string(webkit_web_view_get_main_frame(wv), content, t->uri, "dwb://"); + content = g_strdup_printf(filecontent, t->title, t->state[0], t->state[1], t->state[2], t->state[3], panel); + webkit_web_frame_load_alternate_string(webkit_web_view_get_main_frame(wv), content, t->uri, "about:blank"); g_free(content); g_free(filecontent); g_free(path); } } - void -dwb_html_history(WebKitWebView *wv, HtmlTable *table) { +dwb_html_navigation(WebKitWebView *wv, GList *gl, HtmlTable *table) { int i=0; GString *panels = g_string_new(NULL); - for (GList *gl = dwb.fc.history; gl; gl=gl->next, i++, i%=2) { - Navigation *n = gl->data; - g_string_append_printf(panels, "<div class='line%d'><div><a href='%s'>%s</a></div></div>\n", i, n->first, n->second); + for (GList *l = gl; l; l=l->next, i++, i%=2) { + Navigation *n = l->data; + g_string_append_printf(panels, "<div class='dwb_line%d'><div><a href='%s'>%s</a></div></div>\n", i, n->first, n->second); } dwb_html_load_page(wv, table, panels->str); g_string_free(panels, true); } void +dwb_html_bookmarks(WebKitWebView *wv, HtmlTable *table) { + dwb.fc.bookmarks = g_list_sort(dwb.fc.bookmarks, (GCompareFunc)dwb_util_navigation_compare_second); + dwb_html_navigation(wv, dwb.fc.bookmarks, table); +} +void +dwb_html_history(WebKitWebView *wv, HtmlTable *table) { + dwb_html_navigation(wv, dwb.fc.history, table); +} +void dwb_html_quickmarks(WebKitWebView *wv, HtmlTable *table) { int i=0; GString *panels = g_string_new(NULL); for (GList *gl = dwb.fc.quickmarks; gl; gl=gl->next, i++, i%=2) { Quickmark *q = gl->data; - g_string_append_printf(panels, "<div class='line%d'><div class=qm>%s</div><div><a href='%s'>%s</a></div></div>\n", i, q->key, q->nav->first, q->nav->second); - } - dwb_html_load_page(wv, table, panels->str); - g_string_free(panels, true); -} -void -dwb_html_bookmarks(WebKitWebView *wv, HtmlTable *table) { - int i=0; - GString *panels = g_string_new(NULL); - if (dwb.fc.bookmarks) - dwb.fc.bookmarks = g_list_sort(dwb.fc.bookmarks, (GCompareFunc)dwb_util_navigation_compare_second); - for (GList *gl = dwb.fc.bookmarks; gl; gl=gl->next, i++, i%=2) { - Navigation *n = gl->data; - g_string_append_printf(panels, "<div class='line%d'><div><a href='%s'>%s</a></div></div>\n", i, n->first, n->second); + g_string_append_printf(panels, "<div class='dwb_line%d'><div class=qm>%s</div><div><a href='%s'>%s</a></div></div>\n", i, q->key, q->nav->first, q->nav->second); } dwb_html_load_page(wv, table, panels->str); g_string_free(panels, true); |