evolution-rss r491 - in trunk: . pixmaps src



Author: lucilanga
Date: Fri Apr  3 19:03:27 2009
New Revision: 491
URL: http://svn.gnome.org/viewvc/evolution-rss?rev=491&view=rev

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

* src/rss.c: (finish_image) - treat 404 and other error codes

Modified:
   trunk/ChangeLog
   trunk/TODO
   trunk/pixmaps/Makefile.am
   trunk/pixmaps/Makefile.in
   trunk/src/rss.c

Modified: trunk/TODO
==============================================================================
--- trunk/TODO	(original)
+++ trunk/TODO	Fri Apr  3 19:03:27 2009
@@ -45,7 +45,6 @@
     name=<value optimized out>, error=<value optimized out>, 
     emsg=<value optimized out>) at rss.c:273
         * implement right-click in browser
-	* coments updatable
 	* slow delete operation on large folders
 	* check operation cancel button
 	* add icon to feed setup panel
@@ -56,9 +55,9 @@
 	* trigger resync after folder rename and initial folder creation
 	* check webbuttons for webkit
 	* cancel operation should cancel fetching feed components
-	* fetch_image() handle 404				  <-
-	* count comments					   |
-	* perhaps make quoted text fancier			   |
-	* if immage cannto be server from cache try to fetch it ---|
+	* count comments					   
+	* coments updatable					  
+	* perhaps make quoted text fancier			  
+	* if immage cannto be served from cache try to fetch it 
 	* disable filters on setup_feed()
 	* check s&r progress bar on Complete.

Modified: trunk/pixmaps/Makefile.am
==============================================================================
--- trunk/pixmaps/Makefile.am	(original)
+++ trunk/pixmaps/Makefile.am	Fri Apr  3 19:03:27 2009
@@ -2,7 +2,8 @@
 
 pixmapdir = $(ICON_DIR)
 
-pixmap_DATA = rss.png 		\
+pixmap_DATA =   pix.png		\
+		rss.png 	\
 		rss-16.png 	\
 		rss-22.png 	\
 		rss-24.png	\

Modified: trunk/pixmaps/Makefile.in
==============================================================================
--- trunk/pixmaps/Makefile.in	(original)
+++ trunk/pixmaps/Makefile.in	Fri Apr  3 19:03:27 2009
@@ -268,7 +268,8 @@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
 pixmapdir = $(ICON_DIR)
-pixmap_DATA = rss.png 		\
+pixmap_DATA = pix.png		\
+		rss.png 	\
 		rss-16.png 	\
 		rss-22.png 	\
 		rss-24.png	\

Modified: trunk/src/rss.c
==============================================================================
--- trunk/src/rss.c	(original)
+++ trunk/src/rss.c	Fri Apr  3 19:03:27 2009
@@ -171,6 +171,9 @@
 GtkWidget *evo_window;
 static GdkPixbuf *folder_icon;
 GHashTable *icons = NULL;
+gchar *pixfile;
+char *pixfilebuf;
+gsize pixfilelen;
 extern int xmlSubstituteEntitiesDefaultValue;
 
 rssfeed *rf = NULL;
@@ -1571,6 +1574,17 @@
 #endif
 
 static gboolean
+org_gnome_rss_rfrcomm (EMFormatHTML *efh, void *eb, EMFormatHTMLPObject *pobject)
+{
+        struct _org_gnome_rss_controls_pobject *po = (struct _org_gnome_rss_controls_pobject *) pobject;
+	GtkWidget *button = gtk_button_new_with_label(_("Refresh"));
+	gtk_widget_show(button);
+	if (GTK_IS_WIDGET(eb))
+        	gtk_container_add ((GtkContainer *) eb, button);
+        return TRUE;
+}
+
+static gboolean
 org_gnome_rss_controls (EMFormatHTML *efh, void *eb, EMFormatHTMLPObject *pobject)
 {
 	struct _org_gnome_rss_controls_pobject *po = (struct _org_gnome_rss_controls_pobject *) pobject;
@@ -1908,9 +1922,15 @@
 			if (commstream) {
 				gchar *result = print_comments(comments, commstream);
 				if (commcnt) {
+					char *rfrclsid = g_strdup_printf ("org-gnome-rss-controls-%d",
+						org_gnome_rss_controls_counter_id);
+					org_gnome_rss_controls_counter_id++;
+					pobj = (struct _org_gnome_rss_controls_pobject *) em_format_html_add_pobject ((EMFormatHTML *) t->format, sizeof(*pobj), rfrclsid, message, (EMFormatHTMLPObjectFunc)org_gnome_rss_rfrcomm);
+					//pobj->stream = fstream;
+//					pobj->object.free = free_rss_controls;
 					camel_stream_printf (fstream, 
-                        		"<b>(%d)</b> Refresh<div style=\"border: solid #%06x 0px; background-color: #%06x; padding: 10px; color: #%06x;\">%s",
-					commcnt, frame_colour & 0xffffff, content_colour & 0xffffff, text_colour & 0xffffff, result);
+                        		"<b>(%d)</b> <object height=20 classid=%s></object><div style=\"border: solid #%06x 0px; background-color: #%06x; padding: 10px; color: #%06x;\">%s",
+					commcnt, rfrclsid, frame_colour & 0xffffff, content_colour & 0xffffff, text_colour & 0xffffff, result);
 					commstream = NULL;
 				}
 			}
@@ -1957,6 +1977,7 @@
 {
 	static gboolean initialised = FALSE;
 	GdkPixbuf *icon, *pixbuf;
+
 	gchar *main_folder = get_main_folder();
 	if (t->folder_name == NULL 
 	  || g_ascii_strncasecmp(t->folder_name, main_folder, strlen(main_folder)))
@@ -1995,7 +2016,7 @@
 		goto out;
 	}
 
-normal:	if (!initialised)
+normal:	if (!initialised) //move this to startup
 	{
 		gchar *iconfile = g_build_filename (EVOLUTION_ICONDIR,
 	                                    "rss-16.png",
@@ -2488,9 +2509,7 @@
 
 	GString *response = g_string_new_len(msg->body, msg->length);
 
-//#ifdef RSS_DEBUG
 	g_print("feed %s\n", user_data);
-//#endif
 
 	while (gtk_events_pending ())
             gtk_main_iteration ();
@@ -3404,6 +3423,18 @@
 	}
 	custom_feed_timeout();
 
+	/* load transparency */
+	gchar *pixfile = g_build_filename (EVOLUTION_ICONDIR,
+                                            "pix.png",
+                                                NULL);
+	g_file_load_contents (g_file_parse_name(pixfile),
+                                                         NULL,
+                                                         &pixfilebuf,
+                                                         &pixfilelen,
+                                                         NULL,
+                                                         NULL);
+	g_free(pixfile);
+
         /* hook in rename event to catch feeds folder rename */
 	CamelStore *store = mail_component_peek_local_store(NULL);
 	camel_object_hook_event(store, "folder_renamed",
@@ -4165,6 +4196,9 @@
 finish_image (SoupSession *soup_sess, SoupMessage *msg, CamelStream *user_data)
 #endif
 {
+	// we might need to handle more error codes here
+	if (404 != msg->status_code &&
+	      7 != msg->status_code) {
 #if LIBSOUP_VERSION < 2003000
 		if (msg->response.body) {
 			camel_stream_write(user_data, msg->response.body, msg->response.length);
@@ -4175,6 +4209,11 @@
 			camel_stream_close(user_data);
 			camel_object_unref(user_data);
 		}
+	} else { 
+		camel_stream_write(user_data, pixfilebuf, pixfilelen);
+		camel_stream_close(user_data);
+		camel_object_unref(user_data);
+	}
 }
 
 static void



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