[evolution-rss/evolution-rss-0-2-0] adapt to GError camel modifications
- From: Lucian Langa <lucilanga src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-rss/evolution-rss-0-2-0] adapt to GError camel modifications
- Date: Tue, 5 Oct 2010 17:20:32 +0000 (UTC)
commit 2a378b2ba8b9a713064ee6e9fe6ee56063361857
Author: Lucian Langa <lucilanga gnome org>
Date: Tue Oct 5 20:20:14 2010 +0300
adapt to GError camel modifications
po/POTFILES.in | 2 +-
src/rss-config-factory.c | 51 ++++++++++++++++++++++++++-
src/rss-config-factory.h | 4 ++
src/rss-image.c | 32 +++++++++++++++--
src/rss.c | 85 ++++++++++++++++++++++++++++++++++++++++++++--
5 files changed, 164 insertions(+), 10 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 20a2983..ca4169e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -15,4 +15,4 @@ src/rss-html-rendering.ui
src/rss-image.c
src/rss-main.ui
src/parser.c
-#src/GNOME_Evolution_RSS.server.in.in
+
diff --git a/src/rss-config-factory.c b/src/rss-config-factory.c
index b0141e8..963b747 100644
--- a/src/rss-config-factory.c
+++ b/src/rss-config-factory.c
@@ -976,7 +976,11 @@ destroy_delete(GtkWidget *selector, gpointer user_data)
//this function resembles emfu_delete_rec in mail/em-folder-utils.c
//which is not exported ?
static void
+#if (EVOLUTION_VERSION < 23191)
rss_delete_rec (CamelStore *store, CamelFolderInfo *fi, CamelException *ex)
+#else
+rss_delete_rec (CamelStore *store, CamelFolderInfo *fi, GError **error)
+#endif
{
int i;
GPtrArray *uids;
@@ -986,7 +990,11 @@ rss_delete_rec (CamelStore *store, CamelFolderInfo *fi, CamelException *ex)
d("deleting folder '%s'\n", fi->full_name);
+#if (EVOLUTION_VERSION < 23191)
if (!(folder = camel_store_get_folder (store, fi->full_name, 0, ex)))
+#else
+ if (!(folder = camel_store_get_folder (store, fi->full_name, 0, error)))
+#endif
return;
uids = camel_folder_get_uids (folder);
@@ -1004,8 +1012,13 @@ rss_delete_rec (CamelStore *store, CamelFolderInfo *fi, CamelException *ex)
d("do camel_store_delete_folder()\n");
+#if (EVOLUTION_VERSION < 23191)
camel_store_delete_folder (store, fi->full_name, ex);
if (camel_exception_is_set (ex))
+#else
+ camel_store_delete_folder (store, fi->full_name, error);
+ if (error != NULL)
+#endif
return;
fi = fi->next;
@@ -1013,8 +1026,15 @@ rss_delete_rec (CamelStore *store, CamelFolderInfo *fi, CamelException *ex)
}
void
-rss_delete_folders (
- CamelStore *store, const char *full_name, CamelException *ex)
+#if (EVOLUTION_VERSION < 23191)
+rss_delete_folders (CamelStore *store,
+ const char *full_name,
+ CamelException *ex)
+#else
+rss_delete_folders (CamelStore *store,
+ const char *full_name,
+ GError **error)
+#endif
{
guint32 flags = CAMEL_STORE_FOLDER_INFO_RECURSIVE
| CAMEL_STORE_FOLDER_INFO_FAST
@@ -1025,12 +1045,21 @@ rss_delete_folders (
fi = camel_store_get_folder_info (
store,
full_name,
+#if (EVOLUTION_VERSION < 23191)
flags, ex);
if (!fi || camel_exception_is_set (ex))
+#else
+ flags, error);
+ if (!fi || error != NULL)
+#endif
return;
d("call rss_delete_rec()\n");
+#if (EVOLUTION_VERSION < 23191)
rss_delete_rec (store, fi, ex);
+#else
+ rss_delete_rec (store, fi, error);
+#endif
camel_store_free_folder_info (store, fi);
}
@@ -1407,7 +1436,11 @@ process_dialog_edit(add_feed *feed, gchar *url, gchar *feed_name)
gpointer key = lookup_key(feed_name);
gchar *prefix = NULL;
hrfeed *saved_feed;
+#if EVOLUTION_VERSION < 23191
CamelException ex;
+#else
+ GError *error = NULL;
+#endif
CamelStore *store = rss_component_peek_local_store();
GtkWidget *msg_feeds, *progress;
@@ -1516,9 +1549,15 @@ process_dialog_edit(add_feed *feed, gchar *url, gchar *feed_name)
gchar *b = g_build_path(
G_DIR_SEPARATOR_S,
dir, feed->feed_name, NULL);
+
+#if EVOLUTION_VERSION < 23191
camel_exception_init (&ex);
camel_store_rename_folder (store, a, b, &ex);
if (camel_exception_is_set (&ex)) {
+#else
+ camel_store_rename_folder (store, a, b, &error);
+ if (error != NULL) {
+#endif
#if EVOLUTION_VERSION < 22904
e_error_run(GTK_WINDOW(
rf->preferences),
@@ -1528,9 +1567,17 @@ process_dialog_edit(add_feed *feed, gchar *url, gchar *feed_name)
e_alert_run_dialog_for_args(
GTK_WINDOW(rf->preferences),
"mail:no-rename-folder",
+#if EVOLUTION_VERSION < 23191
a, b, ex.desc, NULL);
+#else
+ a, b, error->message, NULL);
+#endif
#endif
+#if EVOLUTION_VERSION < 23191
camel_exception_clear (&ex);
+#else
+ g_clear_error(&error);
+#endif
}
g_free(dir);
g_free(b);
diff --git a/src/rss-config-factory.h b/src/rss-config-factory.h
index 4e0189b..dbd44b6 100644
--- a/src/rss-config-factory.h
+++ b/src/rss-config-factory.h
@@ -33,7 +33,11 @@ void delete_feed_folder_alloc(gchar *old_name);
void rss_delete_folders (
CamelStore *store,
const char *full_name,
+#if EVOLUTION_VERSION < 23191
CamelException *ex);
+#else
+ GError **error);
+#endif
void remove_feed_hash(gpointer name);
void init_rss_prefs(void);
diff --git a/src/rss-image.c b/src/rss-image.c
index 530512d..e8df219 100644
--- a/src/rss-image.c
+++ b/src/rss-image.c
@@ -84,7 +84,11 @@ update_feed_image(RDF *r)
if (!g_file_test(feed_file, G_FILE_TEST_EXISTS)) {
if (image) { //we need to validate image here with load_pixbuf
CamelStream *feed_fs = camel_stream_fs_new_with_name(feed_file,
+#if EVOLUTION_VERSION < 23191
O_RDWR|O_CREAT, 0666);
+#else
+ O_RDWR|O_CREAT, 0666, NULL);
+#endif
dup_auth_data(r->uri, image);
fi->feed_fs = feed_fs;
fi->key = g_strdup(key);
@@ -317,9 +321,15 @@ finish_image (SoupSession *soup_sess, SoupMessage *msg, CamelStream *user_data)
if (msg->response_body->data) {
camel_stream_write(user_data,
msg->response_body->data,
+#if EVOLUTION_VERSION < 23191
msg->response_body->length);
-#endif
camel_stream_close(user_data);
+#else
+ msg->response_body->length,
+ NULL);
+ camel_stream_close(user_data, NULL);
+#endif
+#endif
#if (DATASERVER_VERSION >= 2031001)
g_object_unref(user_data);
#else
@@ -327,8 +337,13 @@ finish_image (SoupSession *soup_sess, SoupMessage *msg, CamelStream *user_data)
#endif
}
} else {
+#if EVOLUTION_VERSION < 23191
camel_stream_write(user_data, pixfilebuf, pixfilelen);
camel_stream_close(user_data);
+#else
+ camel_stream_write(user_data, pixfilebuf, pixfilelen, NULL);
+ camel_stream_close(user_data, NULL);
+#endif
#if (DATASERVER_VERSION >= 2031001)
g_object_unref(user_data);
#else
@@ -344,10 +359,16 @@ finish_create_icon (SoupMessage *msg, FEED_IMAGE *user_data)
finish_create_icon (SoupSession *soup_sess, SoupMessage *msg, FEED_IMAGE *user_data)
#endif
{
- d("finish_image(): status:%d, user_data:%s\n", msg->status_code, user_data->img_file);
+ d("finish_image(): status:%d, user_data:%s\n",
+ msg->status_code, user_data->img_file);
if (404 != msg->status_code) {
- CamelStream *feed_fs = camel_stream_fs_new_with_name(user_data->img_file,
- O_RDWR|O_CREAT, 0666);
+ CamelStream *feed_fs = camel_stream_fs_new_with_name(
+ user_data->img_file,
+#if EVOLUTION_VERSION < 23191
+ O_RDWR|O_CREAT, 0666);
+#else
+ O_RDWR|O_CREAT, 0666, NULL);
+#endif
finish_image(soup_sess, msg, feed_fs);
#if (EVOLUTION_VERSION >= 22703)
display_folder_icon(evolution_store, user_data->key);
@@ -474,6 +495,9 @@ decode_image_cache_filename(gchar *name)
gboolean image_is_valid(gchar *image);
gboolean
+file_is_image(gchar *image);
+
+gboolean
file_is_image(gchar *image)
{
gchar *mime_type, *contents;
diff --git a/src/rss.c b/src/rss.c
index 319106e..8e2259e 100644
--- a/src/rss.c
+++ b/src/rss.c
@@ -492,7 +492,11 @@ browser_stream_write(CamelStream *stream, gchar *base)
GString *str = g_string_new(NULL);
gchar *line;
CamelStream *in = camel_stream_buffer_new(stream, CAMEL_STREAM_BUFFER_READ);
+#if EVOLUTION_VERSION < 23191
while ((line = camel_stream_buffer_read_line((CamelStreamBuffer *)in))) {
+#else
+ while ((line = camel_stream_buffer_read_line((CamelStreamBuffer *)in, NULL))) {
+#endif
gchar *tmp = line;
g_string_append(str, line);
g_free(tmp);
@@ -1107,7 +1111,11 @@ rss_browser_update_content (
d("cache read\n");
fi->create = 0;
browser_stream_write(stream, po->website);
+#if EVOLUTION_VERSION < 23191
camel_stream_close(stream);
+#else
+ camel_stream_close(stream, NULL);
+#endif
#if (DATASERVER_VERSION >= 2031001)
g_object_unref(stream);
#else
@@ -1155,13 +1163,16 @@ webkit_set_preferences(void)
g_object_set (settings, "enable-page-cache", TRUE, NULL);
//g_object_set (settings, "auto-resize-window", TRUE, NULL);
g_object_set (settings, "enable-plugins",
- gconf_client_get_bool(rss_gconf, GCONF_KEY_EMBED_PLUGIN, NULL),
+ gconf_client_get_bool(rss_gconf,
+ GCONF_KEY_EMBED_PLUGIN, NULL),
NULL);
g_object_set (settings, "enable-java-applet",
- gconf_client_get_bool(rss_gconf, GCONF_KEY_HTML_JAVA, NULL),
+ gconf_client_get_bool(rss_gconf,
+ GCONF_KEY_HTML_JAVA, NULL),
NULL);
g_object_set (settings, "enable-scripts",
- gconf_client_get_bool(rss_gconf, GCONF_KEY_HTML_JS, NULL),
+ gconf_client_get_bool(rss_gconf,
+ GCONF_KEY_HTML_JS, NULL),
NULL);
#endif
webkit_web_view_set_full_content_zoom(
@@ -2295,7 +2306,12 @@ void org_gnome_cooly_format_rss(void *ep, EMFormatHookTarget *t) //camelmimepart
#endif
camel_data_wrapper_write_to_stream(
mcontent,
+#if EVOLUTION_VERSION < 23191
(CamelStream *)stream);
+#else
+ (CamelStream *)stream,
+ NULL);
+#endif
g_byte_array_append (buffer, (unsigned char *)"", 1);
//#ifdef EVOLUTION_2_12 //aparently this ("?" char parsing) is fixed in 2.12
// //then again this does not work in evo > 2.12 perhaps is gtkhtml related
@@ -2491,7 +2507,11 @@ render_body: if (category)
}
//this is required for proper charset rendering when html
+#if EVOLUTION_VERSION < 23191
camel_data_wrapper_construct_from_stream(dw, fstream);
+#else
+ camel_data_wrapper_construct_from_stream(dw, fstream, NULL);
+#endif
#if EVOLUTION_VERSION >= 23100
camel_medium_set_content((CamelMedium *)part, dw);
#else
@@ -3640,7 +3660,11 @@ finish_website (SoupSession *soup_sess, SoupMessage *msg, gpointer user_data)
g_free(tmsg);
if (ub->create) {
//stream remove
+#if EVOLUTION_VERSION < 23191
camel_stream_close(ub->stream);
+#else
+ camel_stream_close(ub->stream, NULL);
+#endif
#if (DATASERVER_VERSION >= 2031001)
g_object_unref(ub->stream);
#else
@@ -3649,8 +3673,13 @@ finish_website (SoupSession *soup_sess, SoupMessage *msg, gpointer user_data)
}
} else {
if (ub->create) {
+#if EVOLUTION_VERSION < 23191
camel_stream_write(ub->stream, response->str, strlen(response->str));
camel_stream_close(ub->stream);
+#else
+ camel_stream_write(ub->stream, response->str, strlen(response->str), NULL);
+ camel_stream_close(ub->stream, NULL);
+#endif
#if (DATASERVER_VERSION >= 2031001)
g_object_unref(ub->stream);
#else
@@ -4116,7 +4145,11 @@ check_feed_folder(gchar *folder_name)
void
rss_delete_feed(gchar *full_path, gboolean folder)
{
+#if EVOLUTION_VERSION < 23191
CamelException ex;
+#else
+ GError *error = NULL;
+#endif
gchar *tmp, *tkey, *url;
CamelStore *store;
gchar *name, *real_name, *buf, *feed_dir, *feed_name;
@@ -4129,24 +4162,42 @@ rss_delete_feed(gchar *full_path, gboolean folder)
real_name = g_hash_table_lookup(rf->feed_folders, name);
if (!real_name)
real_name = name;
+
+#if EVOLUTION_VERSION < 23191
camel_exception_init (&ex);
rss_delete_folders (store, full_path, &ex);
if (camel_exception_is_set (&ex)) {
+#else
+ rss_delete_folders (store, full_path, &error);
+ if (error != NULL) {
+#endif
#if EVOLUTION_VERSION < 22904
e_error_run(NULL,
"mail:no-delete-folder",
full_path,
+#if EVOLUTION_VERSION < 23191
ex.desc,
+#else
+ error->message,
+#endif
NULL);
#else
e_alert_run_dialog_for_args(
e_shell_get_active_window (NULL),
"mail:no-delete-folder",
full_path,
+#if EVOLUTION_VERSION < 23191
ex.desc,
+#else
+ error->message,
+#endif
NULL);
#endif
+#if EVOLUTION_VERSION < 23191
camel_exception_clear (&ex);
+#else
+ g_clear_error(&error);
+#endif
}
//also remove status file
tkey = g_hash_table_lookup(rf->hrname,
@@ -4576,7 +4627,9 @@ void org_gnome_cooly_rss_startup(void *ep, ESEventTargetUpgrade *t)
void
check_folders(void)
{
+#if EVOLUTION_VERSION < 23191
CamelException ex;
+#endif
CamelStore *store = rss_component_peek_local_store();
CamelFolder *mail_folder, *old_folder;
@@ -4587,11 +4640,19 @@ check_folders(void)
if (old_folder) {
camel_store_rename_folder(
store, OLD_FEEDS_FOLDER,
+#if EVOLUTION_VERSION < 23191
+ lookup_main_folder(), &ex);
+#else
lookup_main_folder(), NULL);
+#endif
} else if (mail_folder == NULL) {
camel_store_create_folder (
store, NULL,
+#if EVOLUTION_VERSION < 23191
lookup_main_folder(), &ex);
+#else
+ lookup_main_folder(), NULL);
+#endif
return;
}
#if (DATASERVER_VERSION >= 2031001)
@@ -5118,7 +5179,9 @@ create_mail(create_feed *CF)
CamelMimeMessage *new = camel_mime_message_new();
CamelInternetAddress *addr;
CamelMessageInfo *info;
+#if EVOLUTION_VERSION < 23191
CamelException *ex = NULL;
+#endif
struct tm tm;
time_t time, actual_time;
CamelDataWrapper *rtext;
@@ -5238,7 +5301,11 @@ create_mail(create_feed *CF)
stream = camel_stream_mem_new ();
// w/out an format argument this throws and seg fault
camel_stream_printf (stream, "%s", CF->body);
+#if EVOLUTION_VERSION < 23191
camel_data_wrapper_construct_from_stream (rtext, stream);
+#else
+ camel_data_wrapper_construct_from_stream (rtext, stream, NULL);
+#endif
#if (DATASERVER_VERSION >= 2031001)
g_object_unref (stream);
#else
@@ -5329,7 +5396,11 @@ create_mail(create_feed *CF)
camel_medium_set_content_object(CAMEL_MEDIUM(new), CAMEL_DATA_WRAPPER(rtext));
#endif
+#if EVOLUTION_VERSION < 23191
camel_folder_append_message(mail_folder, new, info, &appended_uid, ex);
+#else
+ camel_folder_append_message(mail_folder, new, info, &appended_uid, NULL);
+#endif
/* no point in filtering mails at import time as it just
* wastes time, user can setup his own afterwards
@@ -5390,12 +5461,20 @@ file_to_message(const char *filename)
file = (CamelStreamFs *)
camel_stream_fs_new_with_name(filename,
O_RDWR|O_CREAT,
+#if EVOLUTION_VERSION < 23191
0666);
+#else
+ 0666, NULL);
+#endif
if (!file)
return NULL;
+#if EVOLUTION_VERSION < 23191
camel_data_wrapper_construct_from_stream(content, (CamelStream *)file);
+#else
+ camel_data_wrapper_construct_from_stream(content, (CamelStream *)file, NULL);
+#endif
#if (DATASERVER_VERSION >= 2031001)
g_object_unref((CamelObject *)file);
#else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]