evolution-rss r501 - in trunk: . src



Author: lucilanga
Date: Wed Apr 15 12:15:15 2009
New Revision: 501
URL: http://svn.gnome.org/viewvc/evolution-rss?rev=501&view=rev

Log:
2009-04-14  Lucian Langa  <lucilanga gnome org>

* src/rss.c (mycall), (org_gnome_rss_browser), (pfree),
(finish_website):
* src/rss.h: prefetch website data

Modified:
   trunk/ChangeLog
   trunk/TODO
   trunk/configure.ac
   trunk/src/Makefile.am
   trunk/src/Makefile.in
   trunk/src/network-soup.c
   trunk/src/network.h
   trunk/src/rss.c

Modified: trunk/TODO
==============================================================================
--- trunk/TODO	(original)
+++ trunk/TODO	Wed Apr 15 12:15:15 2009
@@ -60,3 +60,5 @@
 	* check s&r progress bar on Complete.
 	* support https proxy
 	* support list of ignored hosts
+	* store feed in an alternate file to serve images from
+	* migrate fetch_blocking -> fetch_unblocking

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Wed Apr 15 12:15:15 2009
@@ -62,6 +62,7 @@
    gtk+-2.0 >= $LIBGTK_REQUIRED dnl
    libsoup$SOUP >= $LIBSOUP_REQUIRED dnl
    evolution-plugin$EVOLUTION_BASE_VERSION_S >= $EVOLUTION_REQUIRED dnl
+   evolution-shell$EVOLUTION_BASE_VERSION_S >= $EVOLUTION_REQUIRED dnl
    libglade-2.0 dnl
 ])
 

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Wed Apr 15 12:15:15 2009
@@ -144,6 +144,7 @@
 	rss-config-factory.h			\
 	rss-icon-factory.c			\
 	rss-icon-factory.h			\
+	strptime.c				\
 	evolution-import-rss.c			\
 	evolution-rss.schemas.in		\
 	org-gnome-evolution-rss.eplug.xml	\

Modified: trunk/src/Makefile.in
==============================================================================
--- trunk/src/Makefile.in	(original)
+++ trunk/src/Makefile.in	Wed Apr 15 12:15:15 2009
@@ -399,6 +399,7 @@
 	rss-config-factory.h			\
 	rss-icon-factory.c			\
 	rss-icon-factory.h			\
+	strptime.c				\
 	evolution-import-rss.c			\
 	evolution-rss.schemas.in		\
 	org-gnome-evolution-rss.eplug.xml	\

Modified: trunk/src/network-soup.c
==============================================================================
--- trunk/src/network-soup.c	(original)
+++ trunk/src/network-soup.c	Wed Apr 15 12:15:15 2009
@@ -36,6 +36,7 @@
 	NetStatusCallback user_cb;
 	gpointer user_data;
 	int current, total;
+	gchar *chunk;
 } CallbackInfo;
 
 static void
@@ -97,10 +98,13 @@
 #else
 	info->current += chunk->length;
 #endif
+	info->chunk = chunk->data;
 	progress = g_new0(NetStatusProgress, 1);
 
 	progress->current = info->current;
 	progress->total = info->total;
+	progress->chunk = chunk->data;
+	progress->chunksize = chunk->length;
 	info->user_cb(NET_STATUS_PROGRESS, progress, info->user_data);
 	g_free(progress);
 }
@@ -567,9 +571,11 @@
 #endif
 	g_free(agstr);
 
-	if (info)
+	if (info) {
 		g_signal_connect(G_OBJECT(msg), "got_chunk",
 			G_CALLBACK(got_chunk_cb), info);	//FIXME Find a way to free this maybe weak_ref
+	g_print("connected for %s\n", url);
+	}
 
 	soup_session_queue_message (soup_sess, msg,
            cb2, cbdata2);

Modified: trunk/src/network.h
==============================================================================
--- trunk/src/network.h	(original)
+++ trunk/src/network.h	Wed Apr 15 12:15:15 2009
@@ -106,6 +106,8 @@
 typedef struct {
     guint32 current;
     guint32 total;
+    gchar *chunk;
+    gchar *chunksize;
 } NetStatusProgress;
 
 typedef void (*NetStatusCallback)(NetStatusType status,

Modified: trunk/src/rss.c
==============================================================================
--- trunk/src/rss.c	(original)
+++ trunk/src/rss.c	Wed Apr 15 12:15:15 2009
@@ -189,6 +189,7 @@
 guint32 frame_colour;
 guint32 content_colour;
 guint32 text_colour;
+gboolean browser_fetching = 0; //mycall event could be triggered many times in first step (fetching)
 
 gboolean setup_feed(add_feed *feed);
 gchar *display_doc (RDF *r);
@@ -488,6 +489,39 @@
 }
 
 static void
+browserwrite(gchar *string, gint length)
+{
+	gchar *str = string;
+	gint len = length;
+	while (len > 0) {
+	if (len > 4096) {
+		gtk_moz_embed_append_data(GTK_MOZ_EMBED(rf->mozembed),
+			str, 4096);
+		str+=4096;
+	}
+	else
+		gtk_moz_embed_append_data(GTK_MOZ_EMBED(rf->mozembed),
+		str, len);
+	len-=4096;
+	}
+}
+
+static void
+browsercb(NetStatusType status, gpointer statusdata, gpointer data)
+{
+    NetStatusProgress *progress = (NetStatusProgress*)statusdata;
+    switch (status) {
+    case NET_STATUS_PROGRESS:
+//		g_print("chunk:%s\n", progress->chunk);
+		g_print("\n\n\nchunk write %d - %s - chunk write\n\n\n", progress->chunksize, progress->chunk);
+		browserwrite(progress->chunk, progress->chunksize);
+        break;
+    default:
+        g_warning("unhandled network status %d\n", status);
+    }
+}
+
+static void
 textcb(NetStatusType status, gpointer statusdata, gpointer data)
 {
     NetStatusProgress *progress;
@@ -1447,19 +1481,20 @@
 		if (po->mozembedwindow && rf->mozembed)
 			if(GTK_IS_WIDGET(po->mozembedwindow) && height > 0)
 			{
-				GString *content=g_string_new(NULL);
-				//GString *content = fetch_blocking(po->website, NULL, NULL, textcb, NULL, NULL);
-	fetch_unblocking(
-				po->website,
-				NULL,
-				NULL,
-				(gpointer)finish_website,
-				po->website,	// we need to dupe key here
-				1,
-				NULL);
-/*				gtk_moz_embed_open_stream(GTK_MOZ_EMBED(rf->mozembed),
-			    		"file://", "text/html");
-				gchar *str = content->str;
+				gtk_moz_embed_open_stream(GTK_MOZ_EMBED(rf->mozembed),
+		    		po->website, "text/html");
+				if (!browser_fetching) {
+					browser_fetching=1;
+					fetch_unblocking(
+						po->website,
+						browsercb,
+						1,
+						(gpointer)finish_website,
+						po->website,	// we need to dupe key here
+						1,
+						NULL);
+				}
+/*				gchar *str = content->str;
 				gint len = strlen(content->str);
 				while (len > 0) {
 					if (len > 4096) {
@@ -1474,7 +1509,6 @@
 				}
 				gtk_moz_embed_close_stream(GTK_MOZ_EMBED(rf->mozembed));*/
 				gtk_widget_set_size_request((GtkWidget *)po->mozembedwindow, width, height);
-gtk_widget_show(po->mozembedwindow);
 // apparently resizing gtkmozembed widget won't redraw if using xulrunner
 // there is no point in reload for the rest
 /*#if defined(HAVE_XULRUNNER)
@@ -1591,9 +1625,9 @@
 
 //	gtk_container_set_resize_mode(w, GTK_RESIZE_PARENT);
 //	gtk_scrolled_window_set_policy(w, GTK_POLICY_NEVER, GTK_POLICY_NEVER);
-//////	gtk_widget_show_all(moz);
+	gtk_widget_show_all(moz);
         gtk_container_add ((GtkContainer *) eb, moz);
-//////        gtk_container_check_resize ((GtkContainer *) eb);
+        gtk_container_check_resize ((GtkContainer *) eb);
 //	gtk_widget_set_size_request((GtkWidget *)rf->mozembed, 330, 330);
 //        gtk_container_add ((GtkContainer *) eb, rf->mozembed);
 	EMFormat *myf = (EMFormat *)efh;
@@ -1736,6 +1770,7 @@
 	}*/
 	gtk_widget_destroy(po->container);
 	g_free(po->website);
+	browser_fetching = 0;
 }
 
 EMFormat *fom;
@@ -1837,6 +1872,7 @@
 			goto out;
 		}
 #endif
+		//replace with unblocking
 		content = fetch_blocking(addr, NULL, NULL, textcb, NULL, &err);
 		if (err)
         	{
@@ -2723,7 +2759,7 @@
 #endif
 {
 	GString *response = g_string_new_len(msg->response_body->data, msg->response_body->length);
-	gtk_moz_embed_open_stream(GTK_MOZ_EMBED(rf->mozembed),
+/*	gtk_moz_embed_open_stream(GTK_MOZ_EMBED(rf->mozembed),
 		    		user_data, "text/html");
 			gchar *str = response->str;
 				gint len = strlen(response->str);
@@ -2737,7 +2773,7 @@
 						gtk_moz_embed_append_data(GTK_MOZ_EMBED(rf->mozembed),
 			    				str, len);
 				len-=4096;
-				}
+				}*/
 				gtk_moz_embed_close_stream(GTK_MOZ_EMBED(rf->mozembed));
 		gtk_widget_show(rf->mozembed);
 }
@@ -3967,6 +4003,10 @@
 	g_print("weak unref called on filter_uids\n");
 }
 
+#ifdef _WIN32
+#include "strptime.c"
+#endif
+
 void
 create_mail(create_feed *CF)
 {
@@ -4398,8 +4438,8 @@
 void
 migrate_crc_md5(const char *name, gchar *url)
 {
-	u_int32_t crc = gen_crc(name);
-	u_int32_t crc2 = gen_crc(url);
+	uint32_t crc = gen_crc(name);
+	uint32_t crc2 = gen_crc(url);
 	gchar *md5 = gen_md5(url);
 
 	gchar *feed_dir = rss_component_peek_base_directory(mail_component_peek());



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