diff options
-rw-r--r-- | Makefile | 14 | ||||
-rw-r--r-- | config.mk | 1 | ||||
-rw-r--r-- | lib/head.html | 89 | ||||
-rw-r--r-- | lib/info.html | 96 | ||||
-rw-r--r-- | lib/settings.html | 11 | ||||
-rw-r--r-- | src/html.c | 42 |
6 files changed, 140 insertions, 113 deletions
@@ -9,19 +9,17 @@ clean: @$(MAKE) clean -C $(SRCDIR) install: all install-man install-data - @echo "Installing $(TARGET) to $(DESTDIR)$(BINDIR)/$(TARGET)" - @install -Dm 755 $(SRCDIR)/$(TARGET) $(DESTDIR)$(BINDIR)/$(TARGET) + install -Dm 755 $(SRCDIR)/$(TARGET) $(DESTDIR)$(BINDIR)/$(TARGET) install-man: - @echo "Installing manpage to $(DESTDIR)$(MAN1DIR)" - @install -Dm 644 $(DOCDIR)/$(MANFILE) $(DESTDIR)$(MAN1DIR)/$(MANFILE) + install -Dm 644 $(DOCDIR)/$(MANFILE) $(DESTDIR)$(MAN1DIR)/$(MANFILE) install-data: - @echo "Installing $(SHAREDIR)/hints.js to $(DESTDIR)$(DATADIR)/$(REAL_NAME)/scripts/hints.js" - @install -Dm 644 $(SHAREDIR)/hints.js $(DESTDIR)$(DATADIR)/$(REAL_NAME)/scripts/hints.js - @echo "Installing $(SHAREDIR)/selection.js to $(DESTDIR)$(DATADIR)/$(REAL_NAME)/scripts/selection.js" - @install -Dm 644 $(SHAREDIR)/selection.js $(DESTDIR)$(DATADIR)/$(REAL_NAME)/scripts/selection.js + install -Dm 644 $(SHAREDIR)/hints.js $(DESTDIR)$(DATADIR)/$(REAL_NAME)/scripts/hints.js + install -Dm 644 $(SHAREDIR)/selection.js $(DESTDIR)$(DATADIR)/$(REAL_NAME)/scripts/selection.js install -Dm 644 $(LIBDIR)/info.html $(DESTDIR)$(DATADIR)/$(REAL_NAME)/$(LIBDIR)/info.html + install -Dm 644 $(LIBDIR)/settings.html $(DESTDIR)$(DATADIR)/$(REAL_NAME)/$(LIBDIR)/settings.html + install -Dm 644 $(LIBDIR)/head.html $(DESTDIR)$(DATADIR)/$(REAL_NAME)/$(LIBDIR)/head.html uninstall: uninstall-man uninstall-data @echo "Removing executable from $(subst //,/,$(DESTDIR)$(BINDIR))" @@ -8,7 +8,6 @@ SHAREDIR=data EXAMPLEDIR=examples LIBDIR=lib - HG_VERSION=$(shell hg id -n 2>/dev/null) VERSION=$(shell if [ $(HG_VERSION) ]; then echo "rev.\ $(HG_VERSION)"; else echo "$(REAL_VERSION)"; fi) diff --git a/lib/head.html b/lib/head.html new file mode 100644 index 00000000..7da0e7f7 --- /dev/null +++ b/lib/head.html @@ -0,0 +1,89 @@ +<head> + <title>dwb - %s</title> + <style type="text/css"> + body { + background:white; + color:black; + } + #bar { + position: fixed; + top: 0pt; + left: 0pt; + background: #333; + color: #000000; + width: 100%; + z-index: 2; + -webkit-user-select: none; + background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAABACAAAAAD+ekKcAAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAAAEgAAABIAEbJaz4AAABqSURBVAjXDcPBCkEBAACwJUmSJEmSJEmSJEmSJEmSJEmSHCRJkiTJx3urEQgJi4iKiUtISknLyMrJKygqKauoqqlraGpp6+jq6RsYGhmbmJqZW1haWdvY2tk7ODo7BS+ubu4enl7ePr5+f3zID0eV/ZdFAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDExLTAzLTEwVDAzOjExOjExKzAxOjAwCEbCmgAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxMS0wMy0xMFQwMzoxMToxMSswMTowMHkbeiYAAAAASUVORK5CYII=); + } + .dwb_button, .dwb_sbutton { + position: relative; + display: inline; + padding-left: 20px; + padding-right: 20px; + font: normal bold 14px sans-serif; + color: #909090; + padding-top: 15px; + padding-bottom: 12px; + } + .dwb_sbutton { float: right; } + .dwb_button { float:left; } + #bar a:hover { color: #fff; } + #bar a { + color: #909090; + text-decoration: none; + } + /* a:active { color: #fff } */ + .dwb_infopanel { + display: table; + width: 100%; + position: absolute; + padding-left: 15px; + padding-right: 15px; + padding-bottom: 15px; + top: 70px; + left: 0px; + } + .dwb_infopanel a { + text-decoration: none; + font-weight: bold; + color: #326f32; + padding-left: 10px; + } + .dwb_infopanel a:visited { color: #666666; text-decoration: none; } + .dwb_infopanel a:hover { text-decoration: underline; } + .dwb_qm { + font-weight: bold; + color: #333; + float: left; + min-width: 25px; + text-align: center; + height: 23px; + border: 1px outset #aaa; + border-color: #aaa; + -webkit-border-radius: 5px; + } + .dwb_line0,.dwb_line1 { + position: relative; + font: normal 13px helvetica; + line-height:25px; + } + .dwb_line0 { + background: #dddddd; + } + .dwb_line1 { + background: #efefef; + } + #buttonbox { + float:left; + padding-top: 15px; + padding-bottom: 15px; + } + #dwb_icon { + float: left; + padding-right: 20px; + padding-left: 20px; + padding-top: 8px; + } + </style> +</head> diff --git a/lib/info.html b/lib/info.html index 7e3bb190..8971c806 100644 --- a/lib/info.html +++ b/lib/info.html @@ -1,99 +1,11 @@ <!-- vim: set tw=0 --> -<head> - <title>dwb - %s</title> - <style type="text/css"> - body { - background:white; - color:black; - } - #bar { - position: fixed; - top: 0pt; - left: 0pt; - background: #333; - color: #000000; - width: 100%; - z-index: 2; - -webkit-user-select: none; - background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAABACAAAAAD+ekKcAAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAAAEgAAABIAEbJaz4AAABqSURBVAjXDcPBCkEBAACwJUmSJEmSJEmSJEmSJEmSJEmSHCRJkiTJx3urEQgJi4iKiUtISknLyMrJKygqKauoqqlraGpp6+jq6RsYGhmbmJqZW1haWdvY2tk7ODo7BS+ubu4enl7ePr5+f3zID0eV/ZdFAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDExLTAzLTEwVDAzOjExOjExKzAxOjAwCEbCmgAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxMS0wMy0xMFQwMzoxMToxMSswMTowMHkbeiYAAAAASUVORK5CYII=); - } - .dwb_button, .dwb_sbutton { - position: relative; - display: inline; - padding-left: 20px; - padding-right: 20px; - font: normal bold 14px sans-serif; - color: #909090; - padding-top: 15px; - padding-bottom: 12px; - } - .dwb_sbutton { float: right; } - .dwb_button { float:left; } - .dwb_button a, .dwb_sbutton a { - color: #909090; - text-decoration: none; - } - .dwb_button[currentState=a] a,.dwb_button a:hover, .dwb_sbutton a:hover, .dwb_sbutton[currentState=a] { color: #fff; } - .dwb_infopanel { - display: table; - width: 100%; - position: absolute; - padding-left: 15px; - padding-right: 15px; - padding-bottom: 15px; - top: 70px; - left: 0px; - } - .dwb_infopanel a { - text-decoration: none; - font-weight: bold; - color: #326f32; - padding-left: 10px; - } - .dwb_infopanel a:visited { color: #666666; text-decoration: none; } - .dwb_infopanel a:hover { text-decoration: underline; } - .dwb_qm { - font-weight: bold; - color: #333; - float: left; - min-width: 25px; - text-align: center; - height: 23px; - border: 1px outset #aaa; - border-color: #aaa; - -webkit-border-radius: 5px; - } - .dwb_line0,.dwb_line1 { - position: relative; - font: normal 13px helvetica; - line-height:25px; - } - .dwb_line0 { - background: #dddddd; - } - .dwb_line1 { - background: #efefef; - } - #buttonbox { - float:left; - padding-top: 15px; - padding-bottom: 15px; - } - #dwb_icon { - float: left; - padding-right: 20px; - padding-left: 20px; - padding-top: 8px; - } - </style> -</head> <body> <div id="bar"> <img id="dwb_icon" src=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeEAQAAADBqbpqAAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAAAEgAAABIAEbJaz4AAANUSURBVEjH7ZR7TFN3FMc/9wEFQkWpIEwWplUS39EuMINbAdHEZSmawNSQ+WiixOka3dw/Gtkjezi3ZWEmCzhRo5tETSU+olMCUZnLNGi1Yz7Gio+owyIK0sBa2/72RxmPpXcZY2HJxje5yb3nfM/3e3/nnHthCP91SFqJx2UAEXG8GGH2p/JrqyeQG3zWu186Qp3RqMVnJURtwyrndCSheO77TNIt/+ZwfDmc6QcNsHatXr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><a href="dwb://bookmarks">Bookmarks</a></div> - <div class='dwb_button' currentState='%c' ><a href="dwb://quickmarks">Quickmarks</a></div> - <div class='dwb_button' currentState='%c' ><a href="dwb://history">History</a></div> - <div class='dwb_sbutton' currentState='%c' ><a href="dwb://settings">Settings</a></div> + <div class='dwb_button' ><a href="dwb://bookmarks">Bookmarks</a></div> + <div class='dwb_button' ><a href="dwb://quickmarks">Quickmarks</a></div> + <div class='dwb_button' ><a href="dwb://history">History</a></div> + <div class='dwb_sbutton' ><a href="dwb://settings">Settings</a></div> </div> <!--content goes here--> <div class='dwb_infopanel'> diff --git a/lib/settings.html b/lib/settings.html new file mode 100644 index 00000000..1bf7718d --- /dev/null +++ b/lib/settings.html @@ -0,0 +1,11 @@ +<!-- vim: set tw=0 --> +<body> + <div id="bar"> + <img id="dwb_icon" src=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeEAQAAADBqbpqAAAAAmJLR0QAAKqNIzIAAAAJcEhZcwAAAEgAAABIAEbJaz4AAANUSURBVEjH7ZR7TFN3FMc/9wEFQkWpIEwWplUS39EuMINbAdHEZSmawNSQ+WiixOka3dw/Gtkjezi3ZWEmCzhRo5tETSU+olMCUZnLNGi1Yz7Gio+owyIK0sBa2/72RxmPpXcZY2HJxje5yb3nfM/3e3/nnHthCP91SFqJx2UAEXG8GGH2p/JrqyeQG3zWu186Qp3RqMVnJURtwyrndCSheO77TNIt/+ZwfDmc6QcNsHatXrl8+8Pnr3fUum9drd0UbP/sNWWKWq/1ovqVYHdMGn31kj3xuv10dUtL7Svy1wWx/WqD/n2ItloXjC0K/DD+OSHyrglRb6pxPnBGJLlcWlXK+vhme1raeSHGGYR4Ty/E3e3r0rT4arhg+0aAuB8bkScDxGZDUAZ1FuDQMpa/epgw4uTDrqcH20E+CGRrsPvVin8Q/z9jtb8F+qPQ9qViAPVNsmjyPENM8M6T5KfHiGXAjb9s3Dp75HHfuqwc9umaUSkHGFYZODT/skn5JvUPpm3i46y6yJ83n3vdHWPPKxXzAnujL0iSbuo7G6DqGPBRdyt3gpppitP7F81wL1fyABgO4gZ0lINaZNrmmPhT3mppsezCTTGAcpNilHBz8VvOJb/kWHr27YVRr+qaAsNhtRvyjQmTQBzvzXVcg7LdheeDZwvB3BX8FKJmQe4vADohkIUA7Wt6shDO0TVOITBC4ZreuXd3CeEuLVwDGKHG+Wc6IET8IyFOWIRQ8Q7uUnXPuPvODCnNxLY9cb3Q3vDYAKOa4Kmqvyuc8DKguzenec/9JBjWAsYzgKdnbF2QgPX1/tRjh20HID0AW00DOVHBF3Di1FZTSMt2APx9VrXnO46HaKuonjiuc6Z1g78CvJUDMY70QfJ33sqNHf4K6JwJojq8MaBMkSulKrOhbK/FNid7WkZPAiItiVt8n+eXLNyRvqJPjQ2UCekrXKX5JaNciVu6hReBenFaxqYUi+0Nu9kglch9DiKFtg34FpakweR2kBbAaQ8cbQyRUt6Cok8gKgfqlsC+gh6B+TGQOR18xVCuQuPsUDw3A+Z+D+yEhoRQLjgP4h9BxdLexoOE343/zX/1lVWDaSiPlUyde65MUCEzcjCNpVwiWg96pYErDWEIGvgNdLVGBQKQtg8AAAAldEVYdGRhdGU6Y3JlYXRlADIwMTEtMDItMDhUMjA6NDU6MjMrMDE6MDAWGaRfAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDExLTAyLTA4VDIwOjQ1OjIzKzAxOjAwZ0Qc4wAAAABJRU5ErkJggg== /> + <div class='dwb_button' ><a href="dwb://settings/general">General</a></div> + </div> + <!--content goes here--> + <div class='dwb_infopanel'> + %s + </div> +</body> @@ -2,37 +2,51 @@ #include "html.h" #include "util.h" +#define INFO_FILE "info.html" +#define SETTINGS_FILE "settings.html" +#define HEAD_FILE "head.html" + typedef struct _HtmlTable HtmlTable; struct _HtmlTable { const char *uri; const char *title; - const char *state; + const char *file; + int type; void (*func)(WebKitWebView *, HtmlTable *); }; void dwb_html_bookmarks(WebKitWebView *, HtmlTable *); void dwb_html_history(WebKitWebView *, HtmlTable *); void dwb_html_quickmarks(WebKitWebView *, HtmlTable *); +void dwb_html_settings(WebKitWebView *, HtmlTable *); static HtmlTable table[] = { - { "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 }, + { "dwb://bookmarks", "Bookmarks", INFO_FILE, 0, dwb_html_bookmarks }, + { "dwb://quickmarks", "Quickmarks", INFO_FILE, 0, dwb_html_quickmarks }, + { "dwb://history", "History", INFO_FILE, 0, dwb_html_history }, + { "dwb://settings", "Settings", SETTINGS_FILE, 0, dwb_html_settings }, }; void dwb_html_load_page(WebKitWebView *wv, HtmlTable *t, char *panel) { - char *filecontent, *content; - char *path = dwb_util_get_data_file("info.html"); - if (path) { + char *filecontent; + GString *content = g_string_new(NULL); + char *path = dwb_util_get_data_file(t->file); + char *headpath = dwb_util_get_data_file(HEAD_FILE); + if (path && headpath) { + /* load head */ + g_file_get_contents(headpath, &filecontent, NULL, NULL); + g_string_append_printf(content, filecontent, t->title); + g_free(filecontent); + FREE(headpath); + /* load content */ g_file_get_contents(path, &filecontent, NULL, NULL); - 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_string_append_printf(content, filecontent, panel); + webkit_web_frame_load_alternate_string(webkit_web_view_get_main_frame(wv), content->str, t->uri, "about:blank"); + g_string_free(content, true); g_free(filecontent); - g_free(path); + FREE(path); } } void @@ -56,6 +70,10 @@ dwb_html_history(WebKitWebView *wv, HtmlTable *table) { dwb_html_navigation(wv, dwb.fc.history, table); } void +dwb_html_settings(WebKitWebView *wv, HtmlTable *table) { + dwb_html_load_page(wv, table, "blub"); +} +void dwb_html_quickmarks(WebKitWebView *wv, HtmlTable *table) { int i=0; GString *panels = g_string_new(NULL); |