evolution r36113 - branches/mail-dbus-remoting/mail
- From: abharath svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution r36113 - branches/mail-dbus-remoting/mail
- Date: Wed, 27 Aug 2008 09:26:31 +0000 (UTC)
Author: abharath
Date: Wed Aug 27 09:26:31 2008
New Revision: 36113
URL: http://svn.gnome.org/viewvc/evolution?rev=36113&view=rev
Log:
Migrated all files to use remote APIs. Some fixes and a couple more
funcs added. Breaks the world :) Lets see what's up
Modified:
branches/mail-dbus-remoting/mail/camel-session-remote-impl.c
branches/mail-dbus-remoting/mail/camel-session-remote.c
branches/mail-dbus-remoting/mail/camel-session-remote.h
branches/mail-dbus-remoting/mail/em-folder-browser.c
branches/mail-dbus-remoting/mail/em-folder-tree.c
branches/mail-dbus-remoting/mail/em-folder-utils.c
branches/mail-dbus-remoting/mail/em-migrate.c
branches/mail-dbus-remoting/mail/em-popup.c
branches/mail-dbus-remoting/mail/mail-component.c
branches/mail-dbus-remoting/mail/mail-folder-cache.c
branches/mail-dbus-remoting/mail/mail-ops.c
branches/mail-dbus-remoting/mail/mail-send-recv.c
branches/mail-dbus-remoting/mail/mail-tools.c
branches/mail-dbus-remoting/mail/mail-vfolder.c
Modified: branches/mail-dbus-remoting/mail/camel-session-remote-impl.c
==============================================================================
--- branches/mail-dbus-remoting/mail/camel-session-remote-impl.c (original)
+++ branches/mail-dbus-remoting/mail/camel-session-remote-impl.c Wed Aug 27 09:26:31 2008
@@ -179,6 +179,39 @@
store_url = camel_service_get_url (service);
store_hash_key = e_dbus_get_store_hash (store_url);
+/* the insertion in the hash table needs to be handled */
+ g_hash_table_insert (store_hash, store_hash_key, service);
+
+ if (camel_exception_is_set(ex))
+ err = g_strdup (camel_exception_get_description (ex));
+ else
+ err = g_strdup ("");
+
+ camel_exception_free (ex);
+
+ dbus_message_append_args (return_val, DBUS_TYPE_STRING, &store_hash_key, DBUS_TYPE_STRING, &err, DBUS_TYPE_INVALID);
+ printf("%s: Success: %s:%s\n", method, store_hash_key, err);
+ g_free (err);
+ } else if (strcmp (method, "camel_session_get_service_connected") == 0) {
+ char *url_string, *err, *store_url;
+ char *store_hash_key;
+ CamelProviderType type;
+ CamelService *service;
+ gboolean ret;
+ CamelException *ex;
+
+ ex = camel_exception_new ();
+
+ ret = dbus_message_get_args(message, NULL,
+ DBUS_TYPE_STRING, &url_string,
+ DBUS_TYPE_INT32, &type,
+ DBUS_TYPE_INVALID);
+
+ service = camel_session_get_service_connected (session, url_string, type, ex);
+
+ store_url = camel_service_get_url (service);
+
+ store_hash_key = e_dbus_get_store_hash (store_url);
g_hash_table_insert (store_hash, store_hash_key, service);
Modified: branches/mail-dbus-remoting/mail/camel-session-remote.c
==============================================================================
--- branches/mail-dbus-remoting/mail/camel-session-remote.c (original)
+++ branches/mail-dbus-remoting/mail/camel-session-remote.c Wed Aug 27 09:26:31 2008
@@ -14,6 +14,15 @@
GHashTable *store_rhash = NULL;
#define d(x) x
+#define camel_session_remote_get_store(session, url_string, ex) \
+ ((CamelStore *) camel_session_remote_get_service_connected \
+ (session, url_string, CAMEL_PROVIDER_STORE, ex))
+#define camel_session_remote_get_transport(session, url_string, ex) \
+ ((CamelTransport *) camel_session_remote_get_service_connected \
+ (session, url_string, CAMEL_PROVIDER_TRANSPORT, ex))
+
+const char *session_str = "session";
+
/*
typedef enum {
CAMEL_PROVIDER_STORE,
@@ -179,6 +188,39 @@
return rstore;
}
+CamelObjectRemote *
+camel_session_remote_get_service_connected (CamelSessionRemote *session, const char *url_string,
+ CamelProviderType type, CamelException *ex)
+{
+ gboolean ret;
+ DBusError error;
+ char *service, *err;
+ CamelObjectRemote *rstore;
+
+ dbus_error_init (&error);
+ /* Invoke the appropriate dbind call to MailSessionRemoteImpl */
+ ret = dbind_context_method_call (evolution_dbus_peek_context(),
+ CAMEL_DBUS_NAME,
+ CAMEL_SESSION_OBJECT_PATH,
+ CAMEL_SESSION_INTERFACE,
+ "camel_session_get_service_connected",
+ &error,
+ "si=>ss", url_string, type, &service, &err);
+
+ if (!ret) {
+ g_warning ("Error: Camel session get service connected: %s\n", error.message);
+ return NULL;
+ }
+
+ rstore = g_new0 (CamelObjectRemote, 1);
+ rstore->object_id = service;
+ rstore->type = CAMEL_RO_STORE;
+ rstore->hooks = NULL;
+ d(printf("Camel session get service connected remotely\n"));
+ g_hash_table_insert (store_rhash, g_hash_table_lookup(store_hash, service), rstore);
+ return rstore;
+}
+
gboolean
camel_session_remote_alert_user (CamelSessionRemote *session,
CamelSessionAlertType type,
@@ -332,7 +374,7 @@
CAMEL_SESSION_INTERFACE,
"camel_session_set_check_junk",
&error,
- "ss", session->object_id, check_junk);
+ "si", session->object_id, check_junk);
if (!ret) {
g_warning ("Error: Camel session set check junk: %s\n", error.message);
@@ -385,7 +427,7 @@
CAMEL_SESSION_INTERFACE,
"camel_session_set_network_state",
&error,
- "ss", session->object_id, network_state);
+ "si", session_str, network_state);
if (!ret) {
g_warning ("Error: Camel session set network state: %s\n", error.message);
Modified: branches/mail-dbus-remoting/mail/camel-session-remote.h
==============================================================================
--- branches/mail-dbus-remoting/mail/camel-session-remote.h (original)
+++ branches/mail-dbus-remoting/mail/camel-session-remote.h Wed Aug 27 09:26:31 2008
@@ -13,6 +13,7 @@
char *object_id;
} CamelSessionRemote;
+
/*
#define camel_session_construct camel_session_remote_construct
#define camel_session_get_password camel_session_remote_get_password
@@ -49,6 +50,11 @@
CamelProviderType type,
CamelException *ex);
+CamelObjectRemote *camel_session_remote_get_service_connected (CamelSessionRemote *session,
+ const char *url_string,
+ CamelProviderType type,
+ CamelException *ex);
+
gboolean camel_session_remote_alert_user (CamelSessionRemote *session,
CamelSessionAlertType type,
const char *prompt,
@@ -74,4 +80,5 @@
void camel_session_remote_set_network_state (CamelSessionRemote *session,
gboolean network_state);
+
#endif
Modified: branches/mail-dbus-remoting/mail/em-folder-browser.c
==============================================================================
--- branches/mail-dbus-remoting/mail/em-folder-browser.c (original)
+++ branches/mail-dbus-remoting/mail/em-folder-browser.c Wed Aug 27 09:26:31 2008
@@ -1170,7 +1170,7 @@
/* Create a camel vee folder */
storeuri = g_strdup_printf("vfolder:%s/vfolder", mail_component_peek_base_directory (mail_component_peek ()));
- vfolder_store = camel_session_get_store (session, storeuri, NULL);
+ vfolder_store = camel_session_remote_get_store (session, storeuri, NULL);
efb->account_search_vf = (CamelVeeFolder *)camel_vee_folder_new (vfolder_store,_("Account Search"),CAMEL_STORE_VEE_FOLDER_AUTO);
/* Set the search expression */
@@ -1223,7 +1223,7 @@
if (!efb->all_account_search_vf) {
/* Create a camel vee folder */
storeuri = g_strdup_printf("vfolder:%s/vfolder", mail_component_peek_base_directory (mail_component_peek ()));
- vfolder_store = camel_session_get_store (session, storeuri, NULL);
+ vfolder_store = camel_session_remote_get_store (session, storeuri, NULL);
efb->all_account_search_vf = (CamelVeeFolder *)camel_vee_folder_new (vfolder_store,_("All Account Search"),CAMEL_STORE_VEE_FOLDER_AUTO);
/* Set sexp */
Modified: branches/mail-dbus-remoting/mail/em-folder-tree.c
==============================================================================
--- branches/mail-dbus-remoting/mail/em-folder-tree.c (original)
+++ branches/mail-dbus-remoting/mail/em-folder-tree.c Wed Aug 27 09:26:31 2008
@@ -631,7 +631,7 @@
CamelException ex;
camel_exception_init (&ex);
- store = (CamelObjectRemote *) camel_session_get_service (session, account->source->url, CAMEL_PROVIDER_STORE, &ex);
+ store = (CamelObjectRemote *) camel_session_remote_get_service (session, account->source->url, CAMEL_PROVIDER_STORE, &ex);
camel_exception_clear (&ex);
if (store == NULL)
@@ -1623,7 +1623,7 @@
CamelException ex = { 0 };
u->uri = g_strdup(list->data);
- u->store = (CamelObjectRemote *)camel_session_get_service (session, u->uri, CAMEL_PROVIDER_STORE, &ex);
+ u->store = (CamelObjectRemote *)camel_session_remote_get_service (session, u->uri, CAMEL_PROVIDER_STORE, &ex);
camel_exception_clear(&ex);
url = camel_url_new(u->uri, NULL);
Modified: branches/mail-dbus-remoting/mail/em-folder-utils.c
==============================================================================
--- branches/mail-dbus-remoting/mail/em-folder-utils.c (original)
+++ branches/mail-dbus-remoting/mail/em-folder-utils.c Wed Aug 27 09:26:31 2008
@@ -284,7 +284,7 @@
camel_exception_init (&ex);
- if (!(fromstore = camel_session_get_store (session, cfd->fi->uri, &ex))) {
+ if (!(fromstore = camel_session_remote_get_store (session, cfd->fi->uri, &ex))) {
e_error_run(NULL,
cfd->delete?"mail:no-move-folder-notexist":"mail:no-copy-folder-notexist", cfd->fi->full_name, uri, ex.desc, NULL);
goto fail;
@@ -297,7 +297,7 @@
goto fail;
}
- if (!(tostore = camel_session_get_store (session, uri, &ex))) {
+ if (!(tostore = camel_session_remote_get_store (session, uri, &ex))) {
e_error_run(NULL,
cfd->delete?"mail:no-move-folder-to-notexist":"mail:no-copy-folder-to-notexist", cfd->fi->full_name, uri, ex.desc, NULL);
goto fail;
@@ -697,7 +697,7 @@
g_print ("DEBUG: %s (%s)\n", path, uri);
camel_exception_init (&ex);
- if (!(store = (CamelObjectRemote *) camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, &ex))) {
+ if (!(store = (CamelObjectRemote *) camel_session_remote_get_service (session, uri, CAMEL_PROVIDER_STORE, &ex))) {
camel_exception_clear (&ex);
return;
}
Modified: branches/mail-dbus-remoting/mail/em-migrate.c
==============================================================================
--- branches/mail-dbus-remoting/mail/em-migrate.c (original)
+++ branches/mail-dbus-remoting/mail/em-migrate.c Wed Aug 27 09:26:31 2008
@@ -1188,7 +1188,7 @@
session = CAMEL_SESSION (camel_object_new (EM_MIGRATE_SESSION_TYPE));
- camel_session_construct (session, path);
+ camel_session_remote_construct (session, path);
return session;
}
@@ -1744,7 +1744,7 @@
} else {
guint32 flags = CAMEL_STORE_FOLDER_CREATE;
- if (!(local_store = camel_session_get_store ((CamelSession *) session, uri, ex))
+ if (!(local_store = camel_session_remote_get_store ((CamelSession *) session, uri, ex))
|| !(old_folder = camel_store_get_folder (local_store, name, 0, ex)))
goto fatal;
@@ -2592,7 +2592,7 @@
}
camel_exception_init (&lex);
- if (!(session->store = camel_session_get_store ((CamelSession *) session, path, &lex))) {
+ if (!(session->store = camel_session_remote_get_store ((CamelSession *) session, path, &lex))) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("Failed to create local mail storage `%s': %s"),
path, lex.desc);
@@ -2874,7 +2874,7 @@
camel_url_set_path(url, tmp);
g_free(tmp);
tmp = camel_url_to_string(url, 0);
- store = (CamelObjectRemote *)camel_session_get_service(session, tmp, CAMEL_PROVIDER_STORE, NULL);
+ store = (CamelObjectRemote *)camel_session_remote_get_service(session, tmp, CAMEL_PROVIDER_STORE, NULL);
g_free(tmp);
return store;
@@ -2896,7 +2896,7 @@
iter = e_list_get_iterator ((EList *) accounts);
len = e_list_length ((EList *) accounts);
- camel_session_set_online ((CamelSession *) session, FALSE);
+ camel_session_remote_set_online ((CamelSession *) session, FALSE);
em_migrate_setup_progress_dialog (_("The summary format of the Evolution mailbox "
"folders has been moved to sqlite since Evolution 2.24.\n\nPlease be "
"patient while Evolution migrates your folders..."));
@@ -2930,7 +2930,7 @@
camel_exception_init (&ex);
mail_component_load_store_by_uri (component, service->url, name);
- store = (CamelObjectRemote *) camel_session_get_service (session, service->url, CAMEL_PROVIDER_STORE, &ex);
+ store = (CamelObjectRemote *) camel_session_remote_get_service (session, service->url, CAMEL_PROVIDER_STORE, &ex);
info = camel_store_get_folder_info (store, NULL, CAMEL_STORE_FOLDER_INFO_RECURSIVE|CAMEL_STORE_FOLDER_INFO_FAST|CAMEL_STORE_FOLDER_INFO_SUBSCRIBED, &ex);
if (info) {
migrate_folders(store, info, account->name, &ex);
Modified: branches/mail-dbus-remoting/mail/em-popup.c
==============================================================================
--- branches/mail-dbus-remoting/mail/em-popup.c (original)
+++ branches/mail-dbus-remoting/mail/em-popup.c Wed Aug 27 09:26:31 2008
@@ -50,6 +50,8 @@
#include <camel/camel-vee-folder.h>
#include <camel/camel-vtrash-folder.h>
+#include "camel-store-remote.h"
+
#include <gconf/gconf.h>
#include <gconf/gconf-client.h>
Modified: branches/mail-dbus-remoting/mail/mail-component.c
==============================================================================
--- branches/mail-dbus-remoting/mail/mail-component.c (original)
+++ branches/mail-dbus-remoting/mail/mail-component.c Wed Aug 27 09:26:31 2008
@@ -817,7 +817,7 @@
folder = mc_default_folders[MAIL_COMPONENT_FOLDER_OUTBOX].folder;
if (folder != NULL
- && camel_session_is_online(session)
+ && camel_session_remote_is_online(session)
&& camel_object_get(folder, NULL, CAMEL_FOLDER_VISIBLE, &unsent, 0) == 0
&& unsent > 0
&& e_error_run(NULL, "mail:exit-unsaved", NULL) != GTK_RESPONSE_YES)
@@ -1125,7 +1125,7 @@
if (camel_application_is_exiting)
return FALSE;
- if (!mc->priv->mail_sync_in_progress && session && camel_session_is_online (session))
+ if (!mc->priv->mail_sync_in_progress && session && camel_session_remote_is_online (session))
mail_component_stores_foreach (mc, mc_sync_store, mc);
return !camel_application_is_exiting;
@@ -1153,7 +1153,7 @@
CORBA_Object_release(sd->listener, &ev);
CORBA_exception_free(&ev);
if (!sd->status)
- camel_session_set_online(session, sd->status);
+ camel_session_remote_set_online(session, sd->status);
g_free(sd);
}
}
@@ -1187,10 +1187,10 @@
status = OFFLINE;
/* Cancel all operations as they wont happen anyway cos Network is down*/
mail_cancel_all ();
- camel_session_set_network_state (session, FALSE);
+ camel_session_remote_set_network_state (session, FALSE);
break;
case GNOME_Evolution_USER_ONLINE:
- camel_session_set_network_state (session, TRUE);
+ camel_session_remote_set_network_state (session, TRUE);
status = ONLINE;
}
@@ -1206,7 +1206,7 @@
/* This will dis/enable further auto-mail-check action. */
/* FIXME: If send/receive active, wait for it to finish? */
if (status)
- camel_session_set_online(session, status);
+ camel_session_remote_set_online(session, status);
sd = g_malloc0(sizeof(*sd));
sd->status = status;
@@ -1225,7 +1225,7 @@
g_free(sd);
if (!status)
- camel_session_set_online(session, status);
+ camel_session_remote_set_online(session, status);
GNOME_Evolution_Listener_complete(listener, ev);
}
}
@@ -1407,7 +1407,7 @@
if (!(prov->flags & CAMEL_PROVIDER_IS_STORAGE))
return NULL;
- store = (CamelObjectRemote *) camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, &ex);
+ store = (CamelObjectRemote *) camel_session_remote_get_service (session, uri, CAMEL_PROVIDER_STORE, &ex);
if (store == NULL) {
/* EPFIXME: real error dialog */
g_warning ("couldn't get service %s: %s\n", uri,
@@ -1473,7 +1473,7 @@
if (!(prov->flags & CAMEL_PROVIDER_IS_STORAGE))
return;
- store = (CamelObjectRemote *) camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, NULL);
+ store = (CamelObjectRemote *) camel_session_remote_get_service (session, uri, CAMEL_PROVIDER_STORE, NULL);
if (store != NULL) {
mail_component_remove_store (component, store);
camel_object_unref (store);
Modified: branches/mail-dbus-remoting/mail/mail-folder-cache.c
==============================================================================
--- branches/mail-dbus-remoting/mail/mail-folder-cache.c (original)
+++ branches/mail-dbus-remoting/mail/mail-folder-cache.c Wed Aug 27 09:26:31 2008
@@ -960,7 +960,7 @@
/* We might get a race when setting up a store, such that it is still left in offline mode,
after we've gone online. This catches and fixes it up when the shell opens us */
if (CAMEL_IS_DISCO_STORE (store)) {
- if (camel_session_is_online (session)
+ if (camel_session_remote_is_online (session)
&& camel_disco_store_status (CAMEL_DISCO_STORE (store)) == CAMEL_DISCO_STORE_OFFLINE) {
/* Note: we use the 'id' here, even though its not the right id, its still ok */
ud->id = mail_store_set_offline (store, FALSE, store_online_cb, ud);
@@ -968,7 +968,7 @@
goto normal_setup;
}
} else if (CAMEL_IS_OFFLINE_STORE (store)) {
- if (camel_session_is_online (session) && CAMEL_OFFLINE_STORE (store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
+ if (camel_session_remote_is_online (session) && CAMEL_OFFLINE_STORE (store)->state == CAMEL_OFFLINE_STORE_NETWORK_UNAVAIL) {
/* Note: we use the 'id' here, even though its not the right id, its still ok */
ud->id = mail_store_set_offline (store, FALSE, store_online_cb, ud);
} else {
Modified: branches/mail-dbus-remoting/mail/mail-ops.c
==============================================================================
--- branches/mail-dbus-remoting/mail/mail-ops.c (original)
+++ branches/mail-dbus-remoting/mail/mail-ops.c Wed Aug 27 09:26:31 2008
@@ -513,7 +513,7 @@
}
if (camel_address_length(recipients) > 0) {
- xport = camel_session_get_transport (session, transport_url ? transport_url : destination, ex);
+ xport = camel_session_remote_get_transport (session, transport_url ? transport_url : destination, ex);
if (camel_exception_is_set(ex))
goto exit;
@@ -1344,7 +1344,7 @@
{
/*camel_session_get_store connects us, which we don't want to do on startup. */
- m->store = (CamelObjectRemote *) camel_session_get_service (session, m->uri,
+ m->store = (CamelObjectRemote *) camel_session_remote_get_service (session, m->uri,
CAMEL_PROVIDER_STORE,
&m->base.ex);
}
@@ -2502,7 +2502,7 @@
{
CamelService *service;
- service = camel_session_get_service(session, m->url, m->type, &m->base.ex);
+ service = camel_session_remote_get_service(session, m->url, m->type, &m->base.ex);
if (!service) {
camel_operation_unregister(m->base.cancel);
return;
Modified: branches/mail-dbus-remoting/mail/mail-send-recv.c
==============================================================================
--- branches/mail-dbus-remoting/mail/mail-send-recv.c (original)
+++ branches/mail-dbus-remoting/mail/mail-send-recv.c Wed Aug 27 09:26:31 2008
@@ -908,7 +908,7 @@
return send_recv_dialog;
}
- if (!camel_session_is_online (session))
+ if (!camel_session_remote_is_online (session))
return send_recv_dialog;
account = mail_config_get_default_account ();
@@ -966,7 +966,7 @@
{
struct _auto_data *info = data;
- if (camel_session_is_online(session)) {
+ if (camel_session_remote_is_online(session)) {
const char *uri = e_account_get_string(info->account, E_ACCOUNT_SOURCE_URL);
int keep = e_account_get_bool(info->account, E_ACCOUNT_SOURCE_KEEP_ON_SERVER);
Modified: branches/mail-dbus-remoting/mail/mail-tools.c
==============================================================================
--- branches/mail-dbus-remoting/mail/mail-tools.c (original)
+++ branches/mail-dbus-remoting/mail/mail-tools.c Wed Aug 27 09:26:31 2008
@@ -67,7 +67,7 @@
CamelObjectRemote *store;
CamelFolder *folder;
- store = camel_session_get_store (session, url, ex);
+ store = camel_session_remote_get_store (session, url, ex);
if (!store)
return NULL;
@@ -84,9 +84,9 @@
CamelFolder *trash;
if (connect)
- store = camel_session_get_store (session, url, ex);
+ store = camel_session_remote_get_store (session, url, ex);
else
- store = (CamelObjectRemote *) camel_session_get_service (session, url, CAMEL_PROVIDER_STORE, ex);
+ store = (CamelObjectRemote *) camel_session_remote_get_service (session, url, CAMEL_PROVIDER_STORE, ex);
if (!store)
return NULL;
@@ -307,7 +307,7 @@
return NULL;
}
- store = (CamelObjectRemote *)camel_session_get_service(session, uri+offset, CAMEL_PROVIDER_STORE, ex);
+ store = (CamelObjectRemote *)camel_session_remote_get_service(session, uri+offset, CAMEL_PROVIDER_STORE, ex);
if (store) {
const char *name;
Modified: branches/mail-dbus-remoting/mail/mail-vfolder.c
==============================================================================
--- branches/mail-dbus-remoting/mail/mail-vfolder.c (original)
+++ branches/mail-dbus-remoting/mail/mail-vfolder.c Wed Aug 27 09:26:31 2008
@@ -931,7 +931,7 @@
/* first, create the vfolder store, and set it up */
storeuri = g_strdup_printf("vfolder:%s/vfolder", mail_component_peek_base_directory (mail_component_peek ()));
- vfolder_store = camel_session_get_store(session, storeuri, NULL);
+ vfolder_store = camel_session_remote_get_store(session, storeuri, NULL);
if (vfolder_store == NULL) {
g_warning("Cannot open vfolder store - no vfolders available");
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]