[evolution-rss] adapt to latest camel changes
- From: Lucian Langa <lucilanga src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-rss] adapt to latest camel changes
- Date: Tue, 10 May 2011 13:39:22 +0000 (UTC)
commit fc21117847e6da44497ebf66b0251348862445bf
Author: Lucian Langa <lucilanga gnome org>
Date: Tue May 10 16:38:34 2011 +0300
adapt to latest camel changes
src/rss-config-factory.c | 25 +++++++++++++++++++++++++
src/rss-evo-common.c | 45 +++++++++++++++++++++++++++++++++++++++++++--
src/rss-evo-common.h | 5 +++++
src/rss.c | 11 +++++++++++
4 files changed, 84 insertions(+), 2 deletions(-)
---
diff --git a/src/rss-config-factory.c b/src/rss-config-factory.c
index f05bdd4..05d196c 100644
--- a/src/rss-config-factory.c
+++ b/src/rss-config-factory.c
@@ -47,6 +47,9 @@
#include <misc/e-preferences-window.h>
#include <mail/e-mail-local.h>
#include <mail/em-folder-selector.h>
+#if EVOLUTION_VERSION >= 30101
+#include <mail/e-mail-folder-utils.h>
+#endif
#include <mail/em-utils.h>
#include <shell/e-shell.h>
@@ -446,12 +449,17 @@ folder_cb (GtkWidget *widget, gpointer data)
{
EMailBackend *backend;
EMailSession *session;
+#if EVOLUTION_VERSION >= 30101
+ const gchar *folderinfo;
+#else
CamelFolderInfo *folderinfo;
+#endif
GtkWidget *folder_tree;
GtkWidget *dialog;
GtkWindow *window;
const gchar *uri;
struct _copy_folder_data *cfd;
+ GError *error = NULL;
EMailReader *reader;
EShellContent *shell_content;
@@ -484,12 +492,29 @@ folder_cb (GtkWidget *widget, gpointer data)
EM_FOLDER_SELECTOR (dialog),
uri);
+#if EVOLUTION_VERSION >= 30101
+ folderinfo = em_folder_tree_get_selected_uri ((EMFolderTree *)folder_tree);
+#else
folderinfo = em_folder_tree_get_selected_folder_info ((EMFolderTree *)folder_tree);
+#endif
cfd = g_malloc (sizeof (*cfd));
+#if EVOLUTION_VERSION < 30101
cfd->fi = folderinfo;
+#endif
cfd->delete = 1;
+ e_mail_folder_uri_parse (
+ CAMEL_SESSION (session), folderinfo,
+ &cfd->source_store, &cfd->source_folder_name, &error);
+
+ if (error != NULL) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ g_free (cfd);
+ return;
+ }
+
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) {
gchar *tmp;
gchar *name = g_path_get_basename(text);
diff --git a/src/rss-evo-common.c b/src/rss-evo-common.c
index e43999c..24d6639 100644
--- a/src/rss-evo-common.c
+++ b/src/rss-evo-common.c
@@ -23,10 +23,14 @@
#include <stdio.h>
#include <string.h>
#include <mail/e-mail-local.h>
+#if EVOLUTION_VERSION >= 30101
+#include <mail/e-mail-folder-utils.h>
+#endif
#include <mail/e-mail-reader.h>
#include <mail/em-folder-utils.h>
#include <libedataserver/e-proxy.h>
+
#ifdef HAVE_LIBSOUP_GNOME
#include <libsoup/soup-gnome.h>
#include <libsoup/soup-gnome-features.h>
@@ -64,6 +68,7 @@ struct _EProxyPrivate {
enum ProxyType type;
};
+
gboolean
rss_emfu_is_special_local_folder (const gchar *name)
{
@@ -77,7 +82,10 @@ rss_emfu_copy_folder_selected (EMailBackend *backend,
{
EMailSession *session;
struct _copy_folder_data *cfd = data;
- CamelStore *fromstore = NULL, *tostore = NULL;
+#if EVOLUTION_VERSION < 30101
+ CamelStore *fromstore = NULL;
+#endif
+ CamelStore *tostore = NULL;
CamelStore *local_store;
CamelService *service = NULL;
CamelProvider *provider;
@@ -85,14 +93,23 @@ rss_emfu_copy_folder_selected (EMailBackend *backend,
CamelURL *url;
GError *local_error = NULL;
+#if EVOLUTION_VERSION >= 30101
+ if (uri == NULL)
+ goto fail;
+#else
if (uri == NULL) {
g_free (cfd);
return;
}
+#endif
local_store = e_mail_local_get_store ();
session = e_mail_backend_get_session (backend);
+#if EVOLUTION_VERSION >= 30101
+ service = CAMEL_SERVICE (cfd->source_store);
+ camel_service_connect_sync (service, &local_error);
+#else
url = camel_url_new (cfd->fi->uri, &local_error);
if (url != NULL) {
service = camel_session_get_service_by_url (
@@ -102,25 +119,40 @@ rss_emfu_copy_folder_selected (EMailBackend *backend,
if (service != NULL)
camel_service_connect_sync (service, &local_error);
+#endif
+
if (local_error != NULL) {
e_mail_backend_submit_alert (
backend, cfd->delete ?
"mail:no-move-folder-notexist" :
"mail:no-copy-folder-notexist",
+#if EVOLUTION_VERSION >= 30101
+ cfd->source_folder_name, uri,
+#else
cfd->fi->full_name, uri,
+#endif
local_error->message, NULL);
goto fail;
}
g_return_if_fail (CAMEL_IS_STORE (service));
+#if EVOLUTION_VERSION >= 30101
+ if (cfd->delete && cfd->source_store == local_store &&
+ rss_emfu_is_special_local_folder (cfd->source_folder_name)) {
+#else
fromstore = CAMEL_STORE (service);
if (cfd->delete && fromstore == local_store && rss_emfu_is_special_local_folder (cfd->fi->full_name)) {
+#endif
e_mail_backend_submit_alert (
backend, "mail:no-rename-special-folder",
+#if EVOLUTION_VERSION >= 30101
+ cfd->source_folder_name, NULL);
+#else
cfd->fi->full_name, NULL);
+#endif
goto fail;
}
@@ -139,7 +171,11 @@ rss_emfu_copy_folder_selected (EMailBackend *backend,
backend, cfd->delete ?
"mail:no-move-folder-to-notexist" :
"mail:no-copy-folder-to-notexist",
+#if EVOLUTION_VERSION >= 30101
+ cfd->source_folder_name, uri,
+#else
cfd->fi->full_name, uri,
+#endif
local_error->message, NULL);
goto fail;
}
@@ -158,7 +194,12 @@ rss_emfu_copy_folder_selected (EMailBackend *backend,
tobase = "";
em_folder_utils_copy_folders (
- fromstore, cfd->fi->full_name, tostore, tobase, cfd->delete);
+#if EVOLUTION_VERSION >= 30101
+ cfd->source_store, cfd->source_folder_name,
+#else
+ fromstore, cfd->fi->full_name,
+#endif
+ tostore, tobase, cfd->delete);
camel_url_free (url);
fail:
diff --git a/src/rss-evo-common.h b/src/rss-evo-common.h
index 3fbd5e1..c219a27 100644
--- a/src/rss-evo-common.h
+++ b/src/rss-evo-common.h
@@ -24,7 +24,12 @@
#include <libedataserver/e-proxy.h>
struct _copy_folder_data {
+#if EVOLUTION_VERSION >= 30101
+ CamelStore *source_store;
+ gchar *source_folder_name;
+#else
CamelFolderInfo *fi;
+#endif
gboolean delete;
};
diff --git a/src/rss.c b/src/rss.c
index 5535c9c..59e1d41 100644
--- a/src/rss.c
+++ b/src/rss.c
@@ -50,6 +50,9 @@ int rss_verbose_debug = 0;
#include <mail/em-event.h>
#include <mail/em-utils.h>
#include <mail/em-folder-tree.h>
+#if EVOLUTION_VERSION >= 30101
+#include <mail/e-mail-folder-utils.h>
+#endif
#if EVOLUTION_VERSION < 22900 //kb//
#include <e-util/e-error.h>
@@ -3964,11 +3967,15 @@ lookup_uri_by_folder_name(gchar *name)
folder = camel_store_get_folder (store, name, 0, NULL);
#endif
if (!folder) return NULL;
+#if EVOLUTION_VERSION >= 30101
+ uri = e_mail_folder_uri_from_folder (folder);
+#else
#if EVOLUTION_VERSION >= 29101
uri = (gchar *)camel_folder_get_uri (folder);
#else
uri = mail_tools_folder_to_url (folder);
#endif
+#endif
return uri;
}
@@ -4268,7 +4275,11 @@ static void
store_folder_deleted(CamelObject *o, void *event_data, void *data)
{
CamelFolderInfo *info = event_data;
+#if (DATASERVER_VERSION >= 3001001)
+ d("Folder deleted '%s' full '%s'\n", info->display_name, info->full_name);
+#else
d("Folder deleted '%s' full '%s'\n", info->name, info->full_name);
+#endif
rss_delete_feed(info->full_name, 1);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]