evolution-rss r275 - in trunk: . src



Author: lucilanga
Date: Tue May 13 18:52:35 2008
New Revision: 275
URL: http://svn.gnome.org/viewvc/evolution-rss?rev=275&view=rev

Log:
progress bar for add/edit

Modified:
   trunk/ChangeLog
   trunk/src/rss-config-factory.c
   trunk/src/rss.c
   trunk/src/rss.h

Modified: trunk/src/rss-config-factory.c
==============================================================================
--- trunk/src/rss-config-factory.c	(original)
+++ trunk/src/rss-config-factory.c	Tue May 13 18:52:35 2008
@@ -568,6 +568,11 @@
 	if (feed->dialog)
                 gtk_widget_destroy(feed->dialog);
         GtkWidget *msg_feeds = e_error_new(NULL, "org-gnome-evolution-rss:rssmsg", NULL);
+	GtkWidget *progress = gtk_progress_bar_new();
+        gtk_box_pack_start(GTK_BOX(((GtkDialog *)msg_feeds)->vbox), progress, FALSE, FALSE, 0);
+        gtk_progress_bar_set_fraction((GtkProgressBar *)progress, 0);
+        gtk_progress_bar_set_text((GtkProgressBar *)progress, _("0% done"));
+	feed->progress=progress;
         gtk_window_set_keep_above(GTK_WINDOW(msg_feeds), TRUE);
         g_signal_connect(msg_feeds, "response", G_CALLBACK(msg_feeds_response), NULL);
 	gtk_widget_show_all(msg_feeds);
@@ -931,6 +936,11 @@
                     	if (feed->dialog)
                                 gtk_widget_destroy(feed->dialog);
         		GtkWidget *msg_feeds = e_error_new(NULL, "org-gnome-evolution-rss:rssmsg", NULL);
+	GtkWidget *progress = gtk_progress_bar_new();
+        gtk_box_pack_start(GTK_BOX(((GtkDialog *)msg_feeds)->vbox), progress, FALSE, FALSE, 0);
+        gtk_progress_bar_set_fraction((GtkProgressBar *)progress, 0);
+        gtk_progress_bar_set_text((GtkProgressBar *)progress, _("0% done"));
+	feed->progress=progress;
         		gtk_window_set_keep_above(GTK_WINDOW(msg_feeds), TRUE);
         		g_signal_connect(msg_feeds, "response", G_CALLBACK(msg_feeds_response), NULL);
 			gtk_widget_show_all(msg_feeds);

Modified: trunk/src/rss.c
==============================================================================
--- trunk/src/rss.c	(original)
+++ trunk/src/rss.c	Tue May 13 18:52:35 2008
@@ -126,6 +126,7 @@
 #include "rss-config-factory.c"
 
 int pop = 0;
+int article;
 //#define RSS_DEBUG 1
 
 #define DEFAULT_FEEDS_FOLDER "News&Blogs"
@@ -174,7 +175,7 @@
 void check_folders(void);
 //u_int32_t 
 gchar *
-update_channel(const char *chn_name, char *url, char *main_date, GArray *item);
+update_channel(const char *chn_name, char *url, char *main_date, GArray *item, GtkWidget *progress);
 static char *layer_find (xmlNodePtr node, char *match, char *fail);
 static char *layer_find_innerelement (xmlNodePtr node, char *match, char *el, char *fail);
 static gchar *layer_find_innerhtml (xmlNodePtr node, char *match, char *submatch, char *fail);
@@ -608,6 +609,7 @@
 abort_all_soup(void)
 {
 	//abort all session
+	rf->cancel = 1;
 	rf->cancel_all = 1;
 	if (rf->abort_session)
 	{
@@ -2130,6 +2132,7 @@
 	{
         	r->cache = doc;
 		r->uri = feed->feed_url;
+		r->progress = feed->progress;
 
         	chn_name = display_doc (r);
 add:
@@ -3676,7 +3679,8 @@
 			t,
 			r->uri,
 			md2, 
-			item);
+			item,
+			r->progress);
 	if (md2)
 		g_free(md2);
 	g_array_free(item, TRUE);
@@ -3895,7 +3899,7 @@
 }
 
 gchar *
-update_channel(const char *chn_name, gchar *url, char *main_date, GArray *item)
+update_channel(const char *chn_name, gchar *url, char *main_date, GArray *item, GtkWidget *progress)
 {
         guint i;
 	gchar *sender = g_strdup_printf("%s <%s>", chn_name, chn_name);
@@ -3924,6 +3928,17 @@
 
 	for (i=0; NULL != (el = g_array_index(item, xmlNodePtr, i)); i++)
 	{
+		if (rf->cancel) goto out;
+
+		if (progress)
+		{
+			gdouble fraction = (gdouble)i/item->len;
+                	gtk_progress_bar_set_fraction((GtkProgressBar *)progress, fraction);
+			gchar *msg = g_strdup_printf("%2.0f%% done", fraction*100);
+                	gtk_progress_bar_set_text((GtkProgressBar *)progress, msg);
+			g_free(msg);
+		}
+		
                 char *p = layer_find (el->children, "title", "Untitled article");
 		//firstly try to parse as an ATOM author
 		//process person construct
@@ -4153,12 +4168,12 @@
                	}
 out:           	camel_message_info_free(info);
 	}
-       	camel_folder_freeze(folder);
+//       	camel_folder_freeze(folder);
 	if (min_date)
 		camel_folder_delete_message (folder, uids->pdata[imax]);
-      	camel_folder_sync (folder, TRUE, NULL);
-      	camel_folder_expunge (folder, NULL);
-       	camel_folder_thaw(folder);
+  //    	camel_folder_sync (folder, TRUE, NULL);
+//      	camel_folder_expunge (folder, NULL);
+  //     	camel_folder_thaw(folder);
 	while (gtk_events_pending())
                   gtk_main_iteration ();
        	camel_folder_free_uids (folder, uids);

Modified: trunk/src/rss.h
==============================================================================
--- trunk/src/rss.h	(original)
+++ trunk/src/rss.h	Tue May 13 18:52:35 2008
@@ -38,6 +38,7 @@
         guint 		type_id; 	//num type
 	gchar		*version;	//feed version
         gchar		*feedid;  	//md5 string id of feed
+	GtkWidget	*progress;
         /* Soup stuff */
         SoupMessage *message;
 } RDF;
@@ -146,6 +147,7 @@
 
 typedef struct ADD_FEED {
 	GtkWidget	*dialog;
+	GtkWidget	*progress;
         gchar           *feed_url;
 	gchar		*feed_name;
         gboolean        fetch_html;	//show webpage instead of summary



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