[evolution-data-server/email-factory-3-4: 8/22] Have a running daemon now.
- From: Srinivasa Ragavan <sragavan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server/email-factory-3-4: 8/22] Have a running daemon now.
- Date: Tue, 17 Jan 2012 13:51:00 +0000 (UTC)
commit d4e6f1a209cb6dd3a6542f1b3544f3a46e0a7e33
Author: Srinivasa Ragavan <sragavan gnome org>
Date: Tue Oct 11 10:52:44 2011 +0530
Have a running daemon now.
mail/daemon/Makefile.am | 11 +++--
mail/daemon/main.c | 94 +++++++++++++---------------------------------
2 files changed, 33 insertions(+), 72 deletions(-)
---
diff --git a/mail/daemon/Makefile.am b/mail/daemon/Makefile.am
index 6bd0708..94dac48 100644
--- a/mail/daemon/Makefile.am
+++ b/mail/daemon/Makefile.am
@@ -2,7 +2,8 @@ factorydir = $(libexecdir)
factory_PROGRAMS = evolution-mail-factory
evolution_mail_factory_SOURCES = \
- main.c
+ main.c \
+ utils.c
noinst_PROGRAMS = test-email-client
@@ -18,8 +19,8 @@ test_email_client_CPPFLAGS = \
-I$(top_builddir)
test_email_client_LDADD = \
- $(top_builddir)/mail/libemailengine/libemail-engine.la \
- $(top_builddir)/mail/libemailutils/libemail-utils.la \
+ $(top_builddir)/mail/libemail-engine/libemail-engine.la \
+ $(top_builddir)/mail/libemail-utils/libemail-utils.la \
$(top_builddir)/mail/libegdbus/libegdbus-mail.la \
$(top_builddir)/camel/libcamel-1.2.la \
$(top_builddir)/camel/libcamel-provider-1.2.la \
@@ -46,8 +47,8 @@ evolution_mail_factory_LDADD = \
$(top_builddir)/camel/libcamel-provider-1.2.la \
$(top_builddir)/libedataserver/libedataserver-1.2.la \
$(top_builddir)/libedataserverui/libedataserverui-3.0.la \
- $(top_builddir)/mail/libemailutils/libemail-utils.la \
- $(top_builddir)/mail/libemailengine/libemail-engine.la \
+ $(top_builddir)/mail/libemail-utils/libemail-utils.la \
+ $(top_builddir)/mail/libemail-engine/libemail-engine.la \
$(top_builddir)/mail/libegdbus/libegdbus-mail.la
service_in_files = org.gnome.evolution.dataserver.Mail.service.in
diff --git a/mail/daemon/main.c b/mail/daemon/main.c
index 2df6eb5..d939f3f 100644
--- a/mail/daemon/main.c
+++ b/mail/daemon/main.c
@@ -25,96 +25,56 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
-#if 0
#include <libedataserver/e-data-server-util.h>
#include <libedataserverui/e-passwords.h>
-#include "mail-session.h"
-#include "e-mail-store.h"
-#include "mail-folder-cache.h"
-#include "mail-mt.h"
-#include "mail-config.h"
-#include "mail-ops.h"
+#include "libemail-engine/e-mail-session.h"
+#include "libemail-engine/mail-folder-cache.h"
+#include "libemail-utils/mail-mt.h"
+#include "libemail-engine/mail-config.h"
+#include "libemail-engine/mail-ops.h"
+#include "libemail-engine/e-mail-store.h"
#include "e-dbus-manager.h"
-#include "mail-send-recv.h"
-#include "e-mail-connection-connman.h"
#include "utils.h"
-/* Yeah, the daemon shouldn't be a gtk+ app. But this code shuffling ends this up as a Gtk daemon. But once we solve password and alert issues, this should be a simple mainloop */
-
-extern CamelSession *session;
-static gint mail_sync_in_progress = 0;
-
-static void
-mail_sync_store_done_cb (CamelStore *store,
- gpointer user_data,
- GError *error)
-{
- mail_sync_in_progress--;
-}
-
-static void
-mail_sync_store_cb (CamelStore *store,
- const gchar *display_name,
- gpointer not_used)
-{
- CamelService *service = (CamelService *)store;
-
- /* Don't have to sync the local store. Only remote needs to be synced. */
- if (strcmp(service->url->protocol, "mbox") == 0)
- return;
-
- mail_sync_in_progress++;
-
- mail_sync_store (
- store, FALSE,
- mail_sync_store_done_cb,
- NULL);
-}
-
-static gboolean
-mail_auto_sync ()
-{
- /* If a sync is still in progress, skip this round. */
- if (mail_sync_in_progress)
- goto exit;
-
- e_mail_store_foreach (
- (GHFunc) mail_sync_store_cb,
- NULL);
-
-exit:
- return TRUE;
-}
+EMailSession *session = NULL;
+MailFolderCache *folder_cache = NULL;
static gboolean
start_mail_engine ()
{
char *data_dir;
- mail_debug_int ();
- mail_session_start ();
- mail_folder_cache_get_default ();
- mail_config_init ();
- mail_msg_init ();
+ mail_debug_init ();
+
+ if (camel_init (e_get_user_data_dir (), TRUE) != 0)
+ exit (0);
+ camel_provider_init ();
data_dir = g_build_filename (e_get_user_data_dir(), "mail", NULL);
if (!g_file_test (data_dir, G_FILE_TEST_EXISTS|G_FILE_TEST_IS_DIR)) {
g_mkdir_with_parents (data_dir, 0700);
}
+
+ session = e_mail_session_new ();
+ folder_cache = e_mail_session_get_folder_cache (session);
+
+ mail_config_init (session);
+ mail_msg_init ();
+
- e_mail_store_init (data_dir);
+ e_mail_store_init (session, data_dir);
g_free(data_dir);
- e_mail_connection_connman_new();
- mail_autoreceive_init (session);
+ //e_mail_connection_connman_new();
+ //mail_autoreceive_init (session);
- e_dbus_manager_new ();
+ //e_dbus_manager_new ();
return FALSE;
}
-#endif
+
int
main(int argc, char* argv[])
{
@@ -127,9 +87,9 @@ main(int argc, char* argv[])
g_set_prgname ("evolution-mail-factory");
if (!g_thread_supported ()) g_thread_init (NULL);
-// e_passwords_init ();
+ e_passwords_init ();
-// g_idle_add ((GSourceFunc) start_mail_engine, NULL);
+ g_idle_add ((GSourceFunc) start_mail_engine, NULL);
gtk_main ();
return 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]