Re: Dashboard integration patch (Draft)



Hi,

On Sun, 2004-01-11 at 16:31, Lee Willis wrote:
> I've taken Marco's patch he posted the other day, unfortunately it
> didn't seem to apply/build against head, so I took a look and I have
> what appears to be a working patch.
It seems okay if getting the whole page is all you want to do. However,
didn't you originally want also to get only content below <head> node
etc? I could also imagine list of links, images etc to be of interest to
dashboard... For all that there's currently no epiphany API, so you'd
need to directly use mozilla APIs for that.

I'd prefer to have API in Epiphany to get from EphyEmbed to its DOM
document(s) or maybe the docshell(s), and use that in the extension.
Then you're not limited to whatever epiphany provides, but can use the
full range of mozilla DOM apis on the document.

> Is there any of this that could be done in a cleaner way? Also is there
> a description of the available Embed persist flags - I *think* I'm using
> the right one's, but I'm not 100% sure.
EMBED_PERSIST_MAINDOC	: use the main document, not the focused document
(when there are frames)
EMBED_PERSIST_NO_VIEW	: download not displayed in downloader view

> I'll welcome any feedback on these as I'm sure they're not perfect! I'd
> like to get them to a stage where they can get committed to the relevant
> modules before the next release if possible

Let's have a look at the patch:

+	g_object_get (persist,
+		      "source", &uri,        
+		      "dest", &filename,
+		      "flags", &flags,
+		      "embed", &embed,
+		      "max_size", &max_size,
+		      NULL);
+
+	g_return_val_if_fail (!(flags & EMBED_PERSIST_COPY_PAGE)
+			      || embed != NULL, FALSE);	
+
+	EphyBrowser *browser = NULL;
+	if (embed)
+	{
+	        browser = (EphyBrowser *) _mozilla_embed_get_ephy_browser (MOZILLA_EMBED(embed));
+		g_return_val_if_fail (browser != NULL, FALSE);
+	}
+
+	/* we must have one of uri or browser */
+	g_assert (browser != NULL || uri != NULL);

You use browser later, so this is largely unneccessary; just assert
embed != NULL and get the browser from it.

I've noticed that in the dashboard extension the content will get
escaped ("<" -> "&lt;" etc.), you could do that already here, there is a
flag for nsIDocumentEncoder for that. Also, in which encoding does
dashboard expect its clues? You don't set any, so nsIDocumentEncoder
will (iirc) deliver the content in the document encoding.

Regards,
	Christian




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]