[evolution-rss] various cleanups
- From: Lucian Langa <lucilanga src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-rss] various cleanups
- Date: Tue, 27 Apr 2010 06:47:42 +0000 (UTC)
commit a598cf33e24e7ffea826b705dc5c74f9cf4e8c61
Author: Lucian Langa <lucilanga gnome org>
Date: Sun Apr 25 21:39:01 2010 +0300
various cleanups
TODO | 1 +
src/misc.c | 22 +++++++++++++++++++++-
src/misc.h | 1 +
src/parser.c | 30 ++++++++++++++++--------------
src/rss-config-factory.c | 12 ++++++++----
src/rss.c | 32 ++++++--------------------------
6 files changed, 53 insertions(+), 45 deletions(-)
---
diff --git a/TODO b/TODO
index a263459..12165cf 100644
--- a/TODO
+++ b/TODO
@@ -40,3 +40,4 @@
* split rss feed
* possibly completely disable messagefiltering at setup_feed
* after deletion properties list is not updated, or not in sync
+ * fix editing feeds
diff --git a/src/misc.c b/src/misc.c
index adb662b..6c97e03 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -78,6 +78,26 @@ free_hash(gpointer key, gpointer value, gpointer user_data)
// xmlFreeDoc(key);
}
+void
+print_cf(create_feed *CF)
+{
+ g_print("Sender: %s ", CF->sender);
+ g_print("Subject: %s \n", CF->subj);
+ g_print("Date: %s\n", CF->date);
+ g_print("Feedid: %s\n", CF->feedid);
+ g_print("==========================\n");
+ g_print("Name: %s ", CF->feed_fname);
+ g_print("URI: %s\n", CF->feed_uri);
+ g_print("Path: %s\n", CF->full_path);
+ g_print("Website: %s\n", CF->website);
+ g_print("==========================\n");
+ g_print("%s\n", CF->body);
+ g_print("==========================\n");
+ g_print("q: %s\n", CF->q);
+ g_print("encl: %s\n", CF->encl);
+ g_print("dcdate: %s\n", CF->dcdate);
+}
+
gboolean
check_key_match (gpointer key, gpointer value, gpointer user_data)
{
@@ -353,7 +373,7 @@ gen_md5(gchar *buffer)
g_checksum_get_digest (checksum, md5sum, &length);
g_checksum_free (checksum);
- for (i=0, f = res; i<16;i++) {
+ for (i=0, f = res; i<length;i++) {
unsigned int c = md5sum[i];
*f++ = tohex[c & 0xf];
}
diff --git a/src/misc.h b/src/misc.h
index 67ba195..4aa1b99 100644
--- a/src/misc.h
+++ b/src/misc.h
@@ -19,6 +19,7 @@
#ifndef MISC_H
#define MISC_H 1
+void print_cf(create_feed *CF);
gchar *gen_crc(const char *msg);
gchar *gen_md5(gchar *buffer);
gchar *strplchr(gchar *source);
diff --git a/src/parser.c b/src/parser.c
index b353e31..10f6543 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -1156,24 +1156,26 @@ update_channel(RDF *r)
while (gtk_events_pending())
gtk_main_iteration ();
- if (!feed_is_new(feed_name, CF->feed_uri)) {
- ftotal++;
- if (CF->encl) {
- process_enclosure(CF);
- } else if (g_list_length(CF->attachments)) {
- process_attachments(CF);
- } else {
+ ftotal++;
+ if (CF->encl) {
+ process_enclosure(CF);
+ } else if (g_list_length(CF->attachments)) {
+ process_attachments(CF);
+ } else {
+ if (!freeze) {
+ mail_folder = check_feed_folder(CF->full_path);
+ camel_folder_freeze(mail_folder);
+ freeze = TRUE;
+ }
create_mail(CF);
write_feed_status_line(
CF->feed_fname, CF->feed_uri);
free_cf(CF);
- }
- farticle++;
- d("put success()\n");
- update_status_icon(chn_name, subj);
- g_free(subj);
- } else
- free_cf(CF);
+ }
+ farticle++;
+ d("put success()\n");
+ update_status_icon(chn_name, subj);
+ g_free(subj);
}
if (freeze)
refresh_mail_folder(mail_folder);
diff --git a/src/rss-config-factory.c b/src/rss-config-factory.c
index 1934ce2..eb3d903 100644
--- a/src/rss-config-factory.c
+++ b/src/rss-config-factory.c
@@ -1188,7 +1188,7 @@ delete_feed_folder_alloc(gchar *old_name)
(gpointer *)f);
fclose(f);
g_hash_table_destroy(rf->reversed_feed_folders);
- rf->reversed_feed_folders =
+ rf->reversed_feed_folders =
g_hash_table_new_full(
g_str_hash,
g_str_equal,
@@ -1241,7 +1241,7 @@ feeds_dialog_disable(GtkDialog *d, gpointer data)
gchar *name;
gpointer key;
- selection =
+ selection =
gtk_tree_view_get_selection(
GTK_TREE_VIEW(rf->treeview));
if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
@@ -1588,6 +1588,7 @@ import_one_feed(gchar *url, gchar *title, gchar *prefix)
feed->feed_name,
_("Error adding feed."),
_("Feed already exists!"));
+ rf->import--;
}
setup_feed(feed);
while (gtk_events_pending ())
@@ -1745,6 +1746,7 @@ import_opml(gchar *file)
src = src->next;
src = src->children;
maintitle = (gchar *)layer_find(src, "title", NULL);
+ rf->import=2;
while (src) {
gchar *rssurl = NULL, *rsstitle = NULL;
if (rf->cancel) {
@@ -1824,11 +1826,11 @@ import_opml(gchar *file)
d("rssprefix:%s|rssurl:%s|rsstitle:%s|\n",
rssprefix,
rssurl, rsstitle);
+ rf->import++;
import_one_feed(
rssurl,
rsstitle,
rssprefix);
- rf->import++;
g_print("rf->import:%d\n", rf->import);
if (rssurl) xmlFree(rssurl);
if (rsstitle) xmlFree(rsstitle);
@@ -1861,6 +1863,7 @@ fail: g_free(rssprefix);
GTK_LABEL(import_label),
GTK_JUSTIFY_CENTER);
import_one_feed(url, (gchar *)name, NULL);
+ rf->import++;
if (name) xmlFree(name);
if (url) xmlFree(url);
@@ -1868,7 +1871,8 @@ fail: g_free(rssprefix);
}
while (gtk_events_pending ())
gtk_main_iteration ();
-out: //rf->import = 0;
+out: //prevent reseting queue before its time dues do async operations
+ rf->import -= 2;
if (maintitle) xmlFree(maintitle);
if (doc) xmlFree(doc);
// gtk_widget_destroy(import_dialog);
diff --git a/src/rss.c b/src/rss.c
index 0c6775f..1142d88 100644
--- a/src/rss.c
+++ b/src/rss.c
@@ -198,6 +198,7 @@ guint resize_pane_hsize = 0;
guint resize_pane_vsize = 0;
guint resize_browser_hsize = 0;
guint resize_browser_vsize = 0;
+guint progress = 0;
extern guint net_queue_run_count;
extern guint net_qid;
@@ -468,7 +469,6 @@ update_progress_bar(guint current)
gdouble fr;
gchar *what;
guint total;
- guint val;
g_return_if_fail(rf->progress_bar != NULL);
@@ -476,8 +476,7 @@ update_progress_bar(guint current)
(GObject *)rf->progress_bar,
"total"));
if (total) {
- val = total - current;
- fr = ((val*100)/total);
+ fr = ((progress*100)/total);
if (fr < 100)
gtk_progress_bar_set_fraction(
(GtkProgressBar *)rf->progress_bar, fr/100);
@@ -3513,11 +3512,14 @@ add:
if (rf->import) {
rf->import--;
+ g_print("IMPORT:%d, chn:%s\n", rf->import, chn_name);
+ progress++;
update_progress_bar(rf->import);
if (!rf->import) {
gtk_widget_destroy(rf->progress_dialog);
rf->progress_bar = NULL;
rf->progress_dialog = NULL;
+ progress = 0;
}
}
@@ -5816,7 +5818,7 @@ create_mail(create_feed *CF)
d("date:%s\n", CF->date);
//I'm too lazy to track this down
#if (DATASERVER_VERSION >= 2031001)
- camel_medium_set_header (new, "From", author);
+ camel_medium_set_header ((CamelMedium *)new, "From", author);
#else
camel_address_decode((CamelAddress *)addr, author);
camel_mime_message_set_from(new, addr);
@@ -6091,28 +6093,6 @@ file_to_message(const char *filename)
return msg;
}
-void print_cf(create_feed *CF);
-
-void
-print_cf(create_feed *CF)
-{
- g_print("Sender: %s ", CF->sender);
- g_print("Subject: %s \n", CF->subj);
- g_print("Date: %s\n", CF->date);
- g_print("Feedid: %s\n", CF->feedid);
- g_print("==========================\n");
- g_print("Name: %s ", CF->feed_fname);
- g_print("URI: %s\n", CF->feed_uri);
- g_print("Path: %s\n", CF->full_path);
- g_print("Website: %s\n", CF->website);
- g_print("==========================\n");
- g_print("%s\n", CF->body);
- g_print("==========================\n");
- g_print("q: %s\n", CF->q);
- g_print("encl: %s\n", CF->encl);
- g_print("dcdate: %s\n", CF->dcdate);
-}
-
void
free_cf(create_feed *CF)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]