示例#1
0
bool nsgtk_history_add_internal(const char *url, const struct url_data *data)
{
	GtkTreeIter iter;
	gchar *domain, *path;
	if (url_host(url, &domain) != URL_FUNC_OK)
		strcpy(domain, messages_get("gtkUnknownHost"));

	if (data->visits > 0)
	{
		path = nsgtk_history_parent_get(domain);
		nsgtk_history_parent_update(path, data);
		
		gtk_list_store_append(history->history_list, &iter);
		gtk_list_store_set(history->history_list, &iter,
					SITE_TITLE, data->title ? data->title :
							url,
					SITE_DOMAIN, domain,
					SITE_ADDRESS, url,
					SITE_LASTVISIT, data->last_visit,
					SITE_TOTALVISITS, data->visits,
					SITE_THUMBNAIL,
					gtk_bitmap_get_primary(
					urldb_get_thumbnail(url)),
					-1);
	}
	return true;
}
示例#2
0
/*
	Given a URL, it returns a parsed_url, any fields of which may be null
	if they are not present or parsable in the URL.
*/
parsed_url url_parse(char *url)
{
	substr scheme, user, passwd, host, port, path;
	parsed_url r;
	char *cursor;

	scheme = user = passwd = host = port = path = (substr) { 0, 0 };

	cursor = url_scheme(url, &scheme);
	cursor = url_user_pass(cursor, &user, &passwd);
	cursor = url_host(cursor, &host);
	cursor = url_port(cursor, &port);
	url_path(cursor, &path);

	cut_piece(r.scheme, scheme);
	cut_piece(r.user, user);
	cut_piece(r.passwd, passwd);
	cut_piece(r.host, host);
	cut_piece(r.path, path);

	if(port.start != NULL)
		r.port = atoi(port.start);
	else
		r.port = 0;

	return r;
}
示例#3
0
/**
 * Open the login dialog
 */
void gui_401login_open(const char *url, const char *realm,
		nserror (*cb)(bool proceed, void *pw), void *cbpw)
{
	char *host;
	url_func_result res;

	res = url_host(url, &host);
	assert(res == URL_FUNC_OK);

	ro_gui_401login_open(url, host, realm, cb, cbpw);

	free(host);
}