-searchtext(Client *c, const Arg *arg) {
- gboolean forward = *(gboolean *)arg;
- webkit_web_view_search_text(c->view,
- gtk_entry_get_text(GTK_ENTRY(c->searchbar)),
- FALSE,
- forward,
- TRUE);
+setatom(Client *c, Atom a, const char *v) {
+ XSync(dpy, False);
+ ignore_once = TRUE;
+ XChangeProperty(dpy, GDK_WINDOW_XID(GTK_WIDGET(c->win)->window), a,
+ XA_STRING, 8, PropModeReplace, (unsigned char *)v,
+ strlen(v) + 1);
+}
+
+void
+setup(void) {
+ SoupSession *s;
+
+ /* clean up any zombies immediately */
+ sigchld(0);
+ gtk_init(NULL, NULL);
+ if (!g_thread_supported())
+ g_thread_init(NULL);
+
+ dpy = GDK_DISPLAY();
+ session = webkit_get_default_session();
+ uriprop = XInternAtom(dpy, "_SURF_URI", False);
+ findprop = XInternAtom(dpy, "_SURF_FIND", False);
+
+ /* create dirs and files */
+ cookiefile = buildpath(cookiefile);
+ dldir = buildpath(dldir);
+ scriptfile = buildpath(scriptfile);
+ stylefile = buildpath(stylefile);
+
+ /* cookie persistance */
+ s = webkit_get_default_session();
+ cookies = soup_cookie_jar_new();
+ soup_session_add_feature(s, SOUP_SESSION_FEATURE(cookies));
+ g_signal_connect(cookies, "changed", G_CALLBACK(changecookie), NULL);
+ reloadcookies();
+}
+
+void
+source(Client *c, const Arg *arg) {
+ Arg a = { .b = FALSE };
+ gboolean s;
+
+ s = webkit_web_view_get_view_source_mode(c->view);
+ webkit_web_view_set_view_source_mode(c->view, !s);
+ reload(c, &a);