Exemplo n.º 1
0
static int _ghtml_document_load(GHtml * ghtml, char const * url,
		char const * post)
{
	char const * q;
	History * h;

	_ghtml_stop(ghtml);
	if((q = _history_get_location(ghtml->current)) == NULL
			|| strcmp(q, url) != 0)
	{
		if((h = _history_new(url, post)) == NULL)
			return 1;
		ghtml->current = _history_append(h, ghtml->current);
		ghtml->history = g_list_first(ghtml->current);
	}
	gtk_text_buffer_set_text(ghtml->tbuffer, "", 0);
	free(ghtml->buffer);
	ghtml->buffer = NULL;
	ghtml->buffer_cnt = 0;
	ghtml->search = 0;
	surfer_set_location(ghtml->surfer, url);
	free(ghtml->title);
	ghtml->title = NULL;
	free(ghtml->base);
	ghtml->base = NULL;
	surfer_set_title(ghtml->surfer, NULL);
	if(strncmp(url, "file:", 5) == 0 || strncmp(url, "/", 1) == 0)
		return _document_load_file(ghtml, &url[5]);
	return _document_load_url(ghtml, url, post);
}
Exemplo n.º 2
0
/* on_load_committed */
static void _on_load_committed(WebKitWebView * view, WebKitWebFrame * frame,
		gpointer data)
{
	GHtml * ghtml;
	char const * location;

	ghtml = g_object_get_data(G_OBJECT(data), "ghtml");
	if(frame == webkit_web_view_get_main_frame(view)
			&& (location = webkit_web_frame_get_uri(frame)) != NULL)
		surfer_set_location(ghtml->surfer, location);
	surfer_set_security(ghtml->surfer, ghtml_get_security(ghtml->widget));
}