-gboolean
-initdownload(WebKitWebView *view, WebKitDownload *o, Client *c) {
- const gchar *filename;
- gchar *uri, *html;
-
- stop(c, NULL);
- c->download = o;
- filename = webkit_download_get_suggested_filename(o);
- uri = g_strconcat("file://", dldir, "/", filename, NULL);
- webkit_download_set_destination_uri(c->download, uri);
- c->progress = 0;
- g_free(uri);
- html = g_strdup_printf("Download <b>%s</b>...", filename);
- webkit_web_view_load_html_string(c->view, html,
- webkit_download_get_uri(c->download));
- g_signal_connect(c->download, "notify::progress", G_CALLBACK(download), c);
- g_signal_connect(c->download, "notify::status", G_CALLBACK(download), c);
- webkit_download_start(c->download);
-
- c->title = copystr(&c->title, filename);
- update(c);
- g_free(html);
- return TRUE;
+const char *
+getcookies(SoupURI *uri) {
+ const char *c;
+ SoupCookieJar *j = soup_cookie_jar_text_new(cookiefile, TRUE);
+ c = soup_cookie_jar_get_cookies(j, uri, TRUE);
+ g_object_unref(j);
+ return c;
+}
+
+const char *
+getatom(Client *c, int a) {
+ static char buf[BUFSIZ];
+ Atom adummy;
+ int idummy;
+ unsigned long ldummy;
+ unsigned char *p = NULL;
+
+ XGetWindowProperty(dpy, GDK_WINDOW_XID(GTK_WIDGET(c->win)->window),
+ atoms[a], 0L, BUFSIZ, False, XA_STRING,
+ &adummy, &idummy, &ldummy, &ldummy, &p);
+ if(p)
+ strncpy(buf, (char *)p, LENGTH(buf)-1);
+ else
+ buf[0] = '\0';
+ XFree(p);
+ return buf;