예제 #1
0
void
liferea_htmlview_write (LifereaHtmlView *htmlview, const gchar *string, const gchar *base)
{ 
	const gchar	*baseURL = base;
	
	htmlview->priv->internal = TRUE;	/* enables special links */
	
	if (baseURL == NULL)
		baseURL = "file:///";

	if (debug_level & DEBUG_HTML) {
		gchar *filename = common_create_cache_filename (NULL, "output", "xhtml");
		g_file_set_contents (filename, string, -1, NULL);
		g_free (filename);
	}
	
	if (!g_utf8_validate (string, -1, NULL)) {
		/* It is really a bug if we get invalid encoded UTF-8 here!!! */
		g_error ("Invalid encoded UTF8 buffer passed to HTML widget!");
	} else {
		(RENDERER (htmlview)->write) (htmlview->priv->renderWidget, string, strlen (string), baseURL, "application/xhtml+xml");
	}

	/* We hide the toolbar as it should only be shown when loading external content */
	gtk_widget_hide (htmlview->priv->toolbar);
}
예제 #2
0
파일: node.c 프로젝트: lwindolf/liferea
void
node_load_icon (nodePtr node)
{
	/* Load pixbuf for all widget based rendering */
	if (node->icon)
		g_object_unref (node->icon);

	node->icon = favicon_load_from_cache (node->id, 32);

	/* Create filename for HTML rendering */
	g_free (node->iconFile);

	if (node->icon)
		node->iconFile = common_create_cache_filename ("favicons", node->id, "png");
	else
		node->iconFile = g_build_filename (PACKAGE_DATA_DIR, PACKAGE, "pixmaps", "default.png", NULL);
}
예제 #3
0
파일: net.c 프로젝트: LMephisto/liferea
void
network_init (void)
{
	gchar		*useragent;
	SoupCookieJar	*cookies;
	gchar		*filename;
	SoupLogger	*logger;
	SoupURI		*proxy;

	/* Set an appropriate user agent */
	if (g_getenv ("LANG")) {
		/* e.g. "Liferea/1.6.0 (Linux; de_DE; http://liferea.sf.net/)" */
		useragent = g_strdup_printf ("Liferea/%s (%s; %s; %s)", VERSION, OSNAME, g_getenv ("LANG"), HOMEPAGE);
	} else {
		/* e.g. "Liferea/1.6.0 (Linux; http://liferea.sf.net/)" */
		useragent = g_strdup_printf ("Liferea/%s (%s; %s)", VERSION, OSNAME, HOMEPAGE);
	}

	/* Cookies */
	filename = common_create_cache_filename ("", "cookies", "txt");
	cookies = soup_cookie_jar_text_new (filename, FALSE);
	g_free (filename);

	/* Initialize libsoup */
	proxy = network_get_proxy_uri ();
	session = soup_session_async_new_with_options (SOUP_SESSION_USER_AGENT, useragent,
						       SOUP_SESSION_TIMEOUT, 120,
						       SOUP_SESSION_IDLE_TIMEOUT, 30,
						       SOUP_SESSION_PROXY_URI, proxy,
						       SOUP_SESSION_ADD_FEATURE, cookies,
						       NULL);
	if (proxy)
		soup_uri_free (proxy);
		
	g_signal_connect (session, "authenticate", G_CALLBACK (network_authenticate), NULL);

	/* Soup debugging */
	if (debug_level & DEBUG_NET) {
		logger = soup_logger_new (SOUP_LOGGER_LOG_HEADERS, -1);
		soup_session_add_feature (session, SOUP_SESSION_FEATURE (logger));
	}

	g_free (useragent);
}