Add a "services" directory.
authorMatthew Barnes <mbarnes@redhat.com>
Wed, 28 Sep 2011 21:01:18 +0000 (17:01 -0400)
committerMatthew Barnes <mbarnes@redhat.com>
Thu, 29 Sep 2011 15:33:16 +0000 (11:33 -0400)
Split the D-Bus service binaries out of their respective "libedata"
folders and give them their own folder under "services".  This just
consists of the main() function, any migration gunk, and the D-Bus
.service key file.

This provides a natural place to add a new D-Bus service for ESources,
coming soon to a repository near you!

Also, by popular demand, change the binary and source code prefix in
these folders from "e" to "evolution".  I guess so grepping a process
list for "evolution" reveals all.

19 files changed:
.gitignore
Makefile.am
addressbook/libedata-book/Makefile.am
addressbook/libedata-book/e-data-book-factory.c
calendar/libedata-cal/Makefile.am
calendar/libedata-cal/e-data-cal-factory.c
calendar/libedata-cal/org.gnome.evolution.dataserver.Calendar.service.in
configure.ac
docs/reference/camel/tmpl/camel-session.sgml
docs/reference/camel/tmpl/camel-store.sgml
services/Makefile.am [new file with mode: 0644]
services/evolution-addressbook-factory/Makefile.am [new file with mode: 0644]
services/evolution-addressbook-factory/evolution-addressbook-factory-migrate-basedir.c [moved from addressbook/libedata-book/e-data-book-migrate-basedir.c with 85% similarity]
services/evolution-addressbook-factory/evolution-addressbook-factory.c [new file with mode: 0644]
services/evolution-addressbook-factory/org.gnome.evolution.dataserver.AddressBook.service.in [moved from addressbook/libedata-book/org.gnome.evolution.dataserver.AddressBook.service.in with 52% similarity]
services/evolution-calendar-factory/Makefile.am [new file with mode: 0644]
services/evolution-calendar-factory/evolution-calendar-factory-migrate-basedir.c [moved from calendar/libedata-cal/e-data-cal-migrate-basedir.c with 82% similarity]
services/evolution-calendar-factory/evolution-calendar-factory.c [new file with mode: 0644]
services/evolution-calendar-factory/org.gnome.evolution.dataserver.Calendar.service.in [new file with mode: 0644]

index 074ecea..c12ef12 100644 (file)
 /po/boldquot.sed
 /po/en@boldquot.header
 /po/en@quot.header
-/po/evolution-data-server-3.2.pot
+/po/evolution-data-server-3.4.pot
 /po/insert-header.sin
 /po/quot.sed
 /po/remove-potcdate.sin
index b5dc433..cd5a844 100644 (file)
@@ -6,8 +6,8 @@ if ENABLE_CALENDAR
 CALENDAR_DIR = calendar
 endif
 
-SUBDIRS = libedataserver libebackend camel addressbook $(CALENDAR_DIR) libedataserverui tests docs art po
-DIST_SUBDIRS = libedataserver libebackend camel addressbook calendar libedataserverui tests docs art po vala
+SUBDIRS = libedataserver libebackend camel addressbook $(CALENDAR_DIR) libedataserverui services tests docs art po
+DIST_SUBDIRS = libedataserver libebackend camel addressbook calendar libedataserverui services tests docs art po vala
 
 if HAVE_INTROSPECTION
 if HAVE_VALA
index 50a689a..14883fa 100644 (file)
@@ -11,7 +11,7 @@ lib_LTLIBRARIES = libedata-book-1.2.la
 libedata_book_1_2_la_CPPFLAGS = \
        $(AM_CPPFLAGS) \
        -DG_LOG_DOMAIN=\"libedata-book\" \
-       -DLIBEXECDIR=\"$(libexecdir)\" \
+       -DBACKENDDIR=\"$(ebook_backenddir)\" \
        -I$(top_srcdir) \
        -I$(top_srcdir)/addressbook \
        -I$(top_srcdir)/addressbook/libegdbus \
@@ -22,6 +22,7 @@ libedata_book_1_2_la_CPPFLAGS = \
        $(EVOLUTION_ADDRESSBOOK_CFLAGS)
 
 libedata_book_1_2_la_SOURCES = \
+       $(ENUM_GENERATED) \
        e-book-backend-factory.c \
        e-book-backend-sexp.c \
        e-book-backend-summary.c \
@@ -30,14 +31,14 @@ libedata_book_1_2_la_SOURCES = \
        e-book-backend-sqlitedb.c \
        e-book-backend-sync.c \
        e-book-backend.c \
-       e-data-book-view.c \
        e-data-book.c \
-       ximian-vcard.h \
-       $(ENUM_GENERATED)
+       e-data-book-factory.c \
+       e-data-book-view.c \
+       ximian-vcard.h
 
 libedata_book_1_2_la_LIBADD = \
-       $(top_builddir)/addressbook/libegdbus/libegdbus-book.la \
        $(top_builddir)/addressbook/libebook/libebook-1.2.la \
+       $(top_builddir)/addressbook/libegdbus/libegdbus-book.la \
        $(top_builddir)/libedataserver/libedataserver-1.2.la \
        $(top_builddir)/libebackend/libebackend-1.2.la \
        $(DB_LIBS) \
@@ -74,55 +75,20 @@ e_book_backend_sqlitedb_test_LDADD = \
        libedata-book-1.2.la \
        $(libedata_book_1_2_la_LIBADD)
 
-factory_PROGRAMS = e-addressbook-factory
-
-e_addressbook_factory_CPPFLAGS = \
-       $(AM_CPPFLAGS) \
-       -DG_LOG_DOMAIN=\"libedata-book\" \
-       -DE_PRGNAME=\"e-addressbook-factory\" \
-       -DBACKENDDIR=\"$(ebook_backenddir)\" \
-       -I$(top_srcdir) \
-       -I$(top_srcdir)/addressbook \
-       -I$(top_srcdir)/addressbook/libegdbus \
-       -I$(top_builddir) \
-       -I$(top_builddir)/addressbook \
-       $(EVOLUTION_ADDRESSBOOK_CFLAGS) \
-       $(GOA_CFLAGS) \
-       $(FACTORY_GTK_CFLAGS)
-
-e_addressbook_factory_SOURCES = \
-       e-data-book-factory.c \
-       e-data-book-factory.h \
-       e-data-book-migrate-basedir.c
-
-e_addressbook_factory_LDADD = \
-       libedata-book-1.2.la \
-       $(top_builddir)/libedataserver/libedataserver-1.2.la \
-       $(top_builddir)/libebackend/libebackend-1.2.la \
-       $(EVOLUTION_ADDRESSBOOK_LIBS) \
-       $(GOA_LIBS) \
-       $(FACTORY_GTK_LIBS)
-
 %-$(API_VERSION).pc: %.pc
         cp $< $@
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libedata-book-$(API_VERSION).pc
 
-service_in_files = org.gnome.evolution.dataserver.AddressBook.service.in
-servicedir = $(datadir)/dbus-1/services
-service_DATA = $(service_in_files:.service.in=.service)
-@EVO_SUBST_SERVICE_RULE@
-
 BUILT_SOURCES = $(ENUM_GENERATED)
-CLEANFILES = $(BUILT_SOURCES) $(service_DATA)
+CLEANFILES = $(BUILT_SOURCES)
 DISTCLEANFILES = $(pkgconfig_DATA)
 
 EXTRA_DIST = \
        e-data-book-factory.xml \
        e-data-book-view.xml \
        e-data-book.xml \
-       $(pkgconfig_DATA:-$(API_VERSION).pc=.pc.in) \
-       $(service_in_files)
+       $(pkgconfig_DATA:-$(API_VERSION).pc=.pc.in)
 
 -include $(top_srcdir)/git.mk
index d85d2db..a61b0bb 100644 (file)
 #include <unistd.h>
 #include <glib/gi18n.h>
 
-#ifdef ENABLE_MAINTAINER_MODE
-#include <gtk/gtk.h>
-#endif
-
-#ifdef G_OS_UNIX
-#if GLIB_CHECK_VERSION(2,29,5)
-#include <glib-unix.h>
-#endif
-#endif
-
 #ifdef HAVE_GOA
 #define GOA_API_IS_SUBJECT_TO_CHANGE
 #include <goa/goa.h>
 #define GOA_KEY "goa-account-id"
 #endif
 
+#include "e-book-backend.h"
 #include "e-book-backend-factory.h"
-#include "e-data-book-factory.h"
 #include "e-data-book.h"
-#include "e-book-backend.h"
+#include "e-data-book-factory.h"
 
 #include "e-gdbus-book-factory.h"
 
-#ifdef G_OS_WIN32
-#include <windows.h>
-#include <conio.h>
-#ifndef PROCESS_DEP_ENABLE
-#define PROCESS_DEP_ENABLE 0x00000001
-#endif
-#ifndef PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION
-#define PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION 0x00000002
-#endif
-#endif
-
 #define d(x)
 
 #define E_DATA_BOOK_FACTORY_GET_PRIVATE(obj) \
        (G_TYPE_INSTANCE_GET_PRIVATE \
        ((obj), E_TYPE_DATA_BOOK_FACTORY, EDataBookFactoryPrivate))
 
-/* Keep running after the last client is closed. */
-static gboolean opt_keep_running = FALSE;
-
-/* Convenience macro to test and set a GError/return on failure */
-#define g_set_error_val_if_fail(test, returnval, error, domain, code) \
-       G_STMT_START {                                                  \
-       if G_LIKELY (test) {                                            \
-       } else {                                                        \
-               g_set_error_literal (error, domain, code, #test);       \
-               g_warning (#test " failed");                            \
-               return (returnval);                                     \
-       }                                                               \
-       } G_STMT_END
-
 G_DEFINE_TYPE (EDataBookFactory, e_data_book_factory, E_TYPE_DATA_FACTORY);
 
 struct _EDataBookFactoryPrivate {
@@ -490,23 +455,23 @@ e_data_book_factory_update_goa_accounts (EDataBookFactory *factory)
 
                /* Takes ownership of the GoaObject. */
                g_hash_table_insert (
-                                    factory->priv->goa_accounts,
-                                    g_strdup (goa_account_id), goa_object);
+                       factory->priv->goa_accounts,
+                       g_strdup (goa_account_id), goa_object);
        }
 
        g_list_free (list);
 }
 
 static void
-e_data_book_factory_accounts_changed_cb (GoaClient *client, GDBusObject *object, EDataBookFactory *factory)
+e_data_book_factory_accounts_changed_cb (GoaClient *client,
+                                         GDBusObject *object,
+                                         EDataBookFactory *factory)
 {
        e_data_book_factory_update_goa_accounts (factory);
 }
 
 #endif
 
-
-
 static void
 e_data_book_factory_init (EDataBookFactory *factory)
 {
@@ -546,12 +511,15 @@ e_data_book_factory_init (EDataBookFactory *factory)
        if (factory->priv->goa_client != NULL) {
                e_data_book_factory_update_goa_accounts (factory);
 
-               g_signal_connect (factory->priv->goa_client,
-                                 "account_added", e_data_book_factory_accounts_changed_cb, factory);
-               g_signal_connect (factory->priv->goa_client,
-                                 "account_removed", e_data_book_factory_accounts_changed_cb, factory);
-               g_signal_connect (factory->priv->goa_client,
-                                 "account_changed", e_data_book_factory_accounts_changed_cb, factory);
+               g_signal_connect (
+                       factory->priv->goa_client, "account_added",
+                       e_data_book_factory_accounts_changed_cb, factory);
+               g_signal_connect (
+                       factory->priv->goa_client, "account_removed",
+                       e_data_book_factory_accounts_changed_cb, factory);
+               g_signal_connect (
+                       factory->priv->goa_client, "account_changed",
+                       e_data_book_factory_accounts_changed_cb, factory);
        } else if (error != NULL) {
                g_warning ("%s", error->message);
                g_error_free (error);
@@ -559,88 +527,3 @@ e_data_book_factory_init (EDataBookFactory *factory)
 #endif
 }
 
-static GOptionEntry entries[] = {
-
-       /* FIXME Have the description translated for 3.2, but this
-        *       option is to aid in testing and development so it
-        *       doesn't really matter. */
-       { "keep-running", 'r', 0, G_OPTION_ARG_NONE, &opt_keep_running,
-         "Keep running after the last client is closed", NULL },
-       { NULL }
-};
-
-gint
-main (gint argc,
-      gchar **argv)
-{
-       GOptionContext *context;
-       EDBusServer *server;
-       GError *error = NULL;
-
-#ifdef G_OS_WIN32
-       /* Reduce risks */
-       {
-               typedef BOOL (WINAPI *t_SetDllDirectoryA) (LPCSTR lpPathName);
-               t_SetDllDirectoryA p_SetDllDirectoryA;
-
-               p_SetDllDirectoryA = GetProcAddress (GetModuleHandle ("kernel32.dll"), "SetDllDirectoryA");
-               if (p_SetDllDirectoryA)
-                       (*p_SetDllDirectoryA) ("");
-       }
-#ifndef _WIN64
-       {
-               typedef BOOL (WINAPI *t_SetProcessDEPPolicy) (DWORD dwFlags);
-               t_SetProcessDEPPolicy p_SetProcessDEPPolicy;
-
-               p_SetProcessDEPPolicy = GetProcAddress (GetModuleHandle ("kernel32.dll"), "SetProcessDEPPolicy");
-               if (p_SetProcessDEPPolicy)
-                       (*p_SetProcessDEPPolicy) (PROCESS_DEP_ENABLE | PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION);
-       }
-#endif
-#endif
-
-       g_type_init ();
-       g_set_prgname (E_PRGNAME);
-       if (!g_thread_supported ()) g_thread_init (NULL);
-
-       #ifdef ENABLE_MAINTAINER_MODE
-       /* only to load gtk-modules, like bug-buddy's gnomesegvhandler, if possible */
-       gtk_init_check (&argc, &argv);
-       #endif
-
-       context = g_option_context_new (NULL);
-       g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
-       g_option_context_parse (context, &argc, &argv, &error);
-       g_option_context_free (context);
-
-       if (error != NULL) {
-               g_printerr ("%s\n", error->message);
-               exit (EXIT_FAILURE);
-       }
-
-       /* Migrate user data from ~/.evolution to XDG base directories. */
-       e_data_book_migrate_basedir ();
-
-       server = g_initable_new (
-               E_TYPE_DATA_BOOK_FACTORY, NULL, &error, NULL);
-
-       if (error != NULL) {
-               g_printerr ("%s\n", error->message);
-               exit (EXIT_FAILURE);
-       }
-
-       g_print ("Server is up and running...\n");
-
-       /* This SHOULD keep the server's use
-        * count from ever reaching zero. */
-       if (opt_keep_running)
-               e_dbus_server_hold (server);
-
-       e_dbus_server_run (server);
-
-       g_object_unref (server);
-
-       g_print ("Bye.\n");
-
-       return 0;
-}
index 8ca641d..bc56024 100644 (file)
@@ -11,7 +11,7 @@ lib_LTLIBRARIES = libedata-cal-1.2.la
 libedata_cal_1_2_la_CPPFLAGS =                         \
        $(AM_CPPFLAGS)                          \
        -DG_LOG_DOMAIN=\"libedata-cal\"         \
-       -DBASE_VERSION=\""$(BASE_VERSION)"\"    \
+       -DBACKENDDIR=\"$(ecal_backenddir)\"     \
        -I$(top_srcdir)                         \
        -I$(top_srcdir)/calendar                \
        -I$(top_srcdir)/calendar/libegdbus      \
@@ -32,6 +32,7 @@ libedata_cal_1_2_la_SOURCES =         \
        e-cal-backend-store.c           \
        e-cal-backend-file-store.c      \
        e-data-cal.c                    \
+       e-data-cal-factory.c            \
        e-data-cal-view.c
 
 libedata_cal_1_2_la_LIBADD =                                   \
@@ -69,52 +70,14 @@ libedata_calinclude_HEADERS =               \
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libedata-cal-$(API_VERSION).pc
 
-service_in_files = org.gnome.evolution.dataserver.Calendar.service.in
-servicedir = $(datadir)/dbus-1/services
-service_DATA = $(service_in_files:.service.in=.service)
-@EVO_SUBST_SERVICE_RULE@
-
 BUILT_SOURCES = $(ENUM_GENERATED)
-CLEANFILES = $(BUILT_SOURCES) $(service_DATA)
-DISTCLEANFILES = $(pkgconfig_DATA) $(service_DATA)
+CLEANFILES = $(BUILT_SOURCES)
+DISTCLEANFILES = $(pkgconfig_DATA)
 
 EXTRA_DIST =                                           \
        e-data-cal-factory.xml                          \
        e-data-cal-view.xml                             \
        e-data-cal.xml                                  \
-       $(service_in_files)                             \
        $(pkgconfig_DATA:-$(API_VERSION).pc=.pc.in)
 
-
-factorydir = $(libexecdir)
-factory_PROGRAMS = e-calendar-factory
-
-e_calendar_factory_SOURCES =           \
-       e-data-cal-factory.c            \
-       e-data-cal-factory.h            \
-       e-data-cal-migrate-basedir.c
-
-e_calendar_factory_CPPFLAGS = \
-       $(AM_CPPFLAGS)                                  \
-       -DG_LOG_DOMAIN=\"libedata-cal\"                 \
-       -DE_PRGNAME=\"e-calendar-factory\"              \
-       -DBACKENDDIR=\"$(ecal_backenddir)\"             \
-       -DLOCALEDIR=\"$(localedir)\"                    \
-       -I$(top_srcdir)                                 \
-       -I$(top_srcdir)/calendar                        \
-       -I$(top_srcdir)/calendar/libegdbus              \
-       -I$(top_builddir)                               \
-       -I$(top_builddir)/calendar                      \
-       $(LIBICAL_CFLAGS)                               \
-       $(EVOLUTION_CALENDAR_CFLAGS)                    \
-       $(FACTORY_GTK_CFLAGS)
-
-e_calendar_factory_LDADD =                                             \
-       $(top_builddir)/calendar/libecal/libecal-1.2.la                 \
-       $(top_builddir)/calendar/libegdbus/libegdbus-cal.la             \
-       libedata-cal-1.2.la                                             \
-       $(top_builddir)/libedataserver/libedataserver-1.2.la            \
-       $(top_builddir)/libebackend/libebackend-1.2.la                  \
-       $(FACTORY_GTK_LIBS)
-
 -include $(top_srcdir)/git.mk
index 31aef28..3557ef4 100644 (file)
 #include <unistd.h>
 #include <glib/gi18n.h>
 
-#ifdef ENABLE_MAINTAINER_MODE
-#include <gtk/gtk.h>
-#endif
-
-#include <libedataserver/e-url.h>
-#include <libedataserver/e-source-list.h>
-#include <libecal/e-cal-client.h>
 #include "e-cal-backend.h"
 #include "e-cal-backend-factory.h"
 #include "e-data-cal.h"
 #include <libical/ical.h>
 #endif
 
-#ifdef G_OS_WIN32
-#include <windows.h>
-#include <conio.h>
-#ifndef PROCESS_DEP_ENABLE
-#define PROCESS_DEP_ENABLE 0x00000001
-#endif
-#ifndef PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION
-#define PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION 0x00000002
-#endif
-#endif
-
 #define d(x)
 
 #define E_DATA_CAL_FACTORY_GET_PRIVATE(obj) \
        (G_TYPE_INSTANCE_GET_PRIVATE \
        ((obj), E_TYPE_DATA_CAL_FACTORY, EDataCalFactoryPrivate))
 
-/* Keeps running after the last client is closed. */
-static gboolean opt_keep_running = FALSE;
-
-/* Convenience macro to test and set a GError/return on failure */
-#define g_set_error_val_if_fail(test, returnval, error, domain, code) \
-       G_STMT_START {                                                  \
-       if G_LIKELY (test) {} else {                                    \
-               g_set_error_literal (error, domain, code, #test);       \
-               g_warning(#test " failed");                             \
-               return (returnval);                                     \
-       }                                                               \
-       } G_STMT_END
-
 G_DEFINE_TYPE (EDataCalFactory, e_data_cal_factory, E_TYPE_DATA_FACTORY);
 
 struct _EDataCalFactoryPrivate {
@@ -469,97 +438,3 @@ e_data_cal_factory_init (EDataCalFactory *factory)
                (GDestroyNotify) g_free,
                (GDestroyNotify) NULL);
 }
-
-static GOptionEntry entries[] = {
-
-       /* FIXME Have the description translated for 3.2, but this
-        *       option is to aid in testing and development so it
-        *       doesn't really matter. */
-       { "keep-running", 'r', 0, G_OPTION_ARG_NONE, &opt_keep_running,
-         "Keep running after the last client is closed", NULL },
-       { NULL }
-};
-
-gint
-main (gint argc,
-      gchar **argv)
-{
-       GOptionContext *context;
-       EDBusServer *server;
-       GError *error = NULL;
-
-#ifdef G_OS_WIN32
-       /* Reduce risks */
-       {
-               typedef BOOL (WINAPI *t_SetDllDirectoryA) (LPCSTR lpPathName);
-               t_SetDllDirectoryA p_SetDllDirectoryA;
-
-               p_SetDllDirectoryA = GetProcAddress (GetModuleHandle ("kernel32.dll"), "SetDllDirectoryA");
-               if (p_SetDllDirectoryA)
-                       (*p_SetDllDirectoryA) ("");
-       }
-#ifndef _WIN64
-       {
-               typedef BOOL (WINAPI *t_SetProcessDEPPolicy) (DWORD dwFlags);
-               t_SetProcessDEPPolicy p_SetProcessDEPPolicy;
-
-               p_SetProcessDEPPolicy = GetProcAddress (GetModuleHandle ("kernel32.dll"), "SetProcessDEPPolicy");
-               if (p_SetProcessDEPPolicy)
-                       (*p_SetProcessDEPPolicy) (PROCESS_DEP_ENABLE | PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION);
-       }
-#endif
-#endif
-
-       setlocale (LC_ALL, "");
-       bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
-       bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-
-       g_type_init ();
-       g_set_prgname (E_PRGNAME);
-       if (!g_thread_supported ()) g_thread_init (NULL);
-
-       #ifdef ENABLE_MAINTAINER_MODE
-       /* only to load gtk-modules, like bug-buddy's gnomesegvhandler, if possible */
-       gtk_init_check (&argc, &argv);
-       #endif
-
-       context = g_option_context_new (NULL);
-       g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
-       g_option_context_parse (context, &argc, &argv, &error);
-       g_option_context_free (context);
-
-       if (error != NULL) {
-               g_printerr ("%s\n", error->message);
-               exit (EXIT_FAILURE);
-       }
-
-#ifdef HAVE_ICAL_UNKNOWN_TOKEN_HANDLING
-       ical_set_unknown_token_handling_setting (ICAL_DISCARD_TOKEN);
-#endif
-
-       /* Migrate user data from ~/.evolution to XDG base directories. */
-       e_data_cal_migrate_basedir ();
-
-       server = g_initable_new (
-               E_TYPE_DATA_CAL_FACTORY, NULL, &error, NULL);
-
-       if (error != NULL) {
-               g_printerr ("%s\n", error->message);
-               exit (EXIT_FAILURE);
-       }
-
-       g_print ("Server is up and running...\n");
-
-       /* This SHOULD keep the server's use
-        * count from ever reaching zero. */
-       if (opt_keep_running)
-               e_dbus_server_hold (server);
-
-       e_dbus_server_run (server);
-
-       g_object_unref (server);
-
-       g_print ("Bye.\n");
-
-       return 0;
-}
index bd10885..299f32c 100644 (file)
@@ -1488,7 +1488,8 @@ AC_SUBST(camel_providerdir)
 dnl *******************
 dnl D-BUS service stuff
 dnl *******************
-EVO_SUBST_SERVICE_RULE='%.service: %.service.in Makefile ; sed -e "s|\@libexecdir\@|$(libexecdir)|" -e s"|\@ADDRESS_BOOK_DBUS_SERVICE_NAME\@|$(ADDRESS_BOOK_DBUS_SERVICE_NAME)|" -e "s|\@CALENDAR_DBUS_SERVICE_NAME\@|$(CALENDAR_DBUS_SERVICE_NAME)|" $< > $@'
+m4_pattern_allow([AM_V_GEN])
+EVO_SUBST_SERVICE_RULE='%.service: %.service.in Makefile ; $(AM_V_GEN) sed -e "s|\@libexecdir\@|$(libexecdir)|" -e s"|\@ADDRESS_BOOK_DBUS_SERVICE_NAME\@|$(ADDRESS_BOOK_DBUS_SERVICE_NAME)|" -e "s|\@CALENDAR_DBUS_SERVICE_NAME\@|$(CALENDAR_DBUS_SERVICE_NAME)|" $< > $@'
 AC_SUBST(EVO_SUBST_SERVICE_RULE)
 
 dnl ******************************
@@ -1600,6 +1601,9 @@ libedataserver/eds-version.h
 libedataserver/libedataserver.pc
 libedataserverui/Makefile
 libedataserverui/libedataserverui.pc
+services/Makefile
+services/evolution-addressbook-factory/Makefile
+services/evolution-calendar-factory/Makefile
 tests/Makefile
 tests/libebook/Makefile
 tests/libebook/client/Makefile
index c5a13a6..3589b46 100644 (file)
@@ -63,6 +63,11 @@ CamelSession
 
 </para>
 
+<!-- ##### ARG CamelSession:user-cache-dir ##### -->
+<para>
+
+</para>
+
 <!-- ##### ARG CamelSession:user-data-dir ##### -->
 <para>
 
index 1bc9ee6..aa4363e 100644 (file)
@@ -109,6 +109,10 @@ CamelStore
 @CAMEL_FOLDER_TYPE_TRASH: 
 @CAMEL_FOLDER_TYPE_JUNK: 
 @CAMEL_FOLDER_TYPE_SENT: 
+@CAMEL_FOLDER_TYPE_CONTACTS: 
+@CAMEL_FOLDER_TYPE_EVENTS: 
+@CAMEL_FOLDER_TYPE_MEMOS: 
+@CAMEL_FOLDER_TYPE_TASKS: 
 @CAMEL_FOLDER_READONLY: 
 @CAMEL_FOLDER_CHECK_FOR_NEW: 
 @CAMEL_FOLDER_FLAGGED: 
@@ -139,6 +143,7 @@ CamelStore
 @CAMEL_STORE_IS_MIGRATING: 
 @CAMEL_STORE_REAL_JUNK_FOLDER: 
 @CAMEL_STORE_CAN_EDIT_FOLDERS: 
+@CAMEL_STORE_USE_CACHE_DIR: 
 
 <!-- ##### ENUM CamelStorePermissionFlags ##### -->
 <para>
diff --git a/services/Makefile.am b/services/Makefile.am
new file mode 100644 (file)
index 0000000..1750bfa
--- /dev/null
@@ -0,0 +1,8 @@
+NULL =
+
+SUBDIRS = \
+       evolution-addressbook-factory \
+       evolution-calendar-factory \
+       $(NULL)
+
+-include $(top_srcdir)/git.mk
diff --git a/services/evolution-addressbook-factory/Makefile.am b/services/evolution-addressbook-factory/Makefile.am
new file mode 100644 (file)
index 0000000..ff2416f
--- /dev/null
@@ -0,0 +1,40 @@
+NULL =
+
+service_in_files = org.gnome.evolution.dataserver.AddressBook.service.in
+servicedir = $(datadir)/dbus-1/services
+service_DATA = $(service_in_files:.service.in=.service)
+@EVO_SUBST_SERVICE_RULE@
+
+CLEANFILES = $(service_DATA)
+EXTRA_DIST = $(service_in_files)
+
+libexec_PROGRAMS = evolution-addressbook-factory
+
+evolution_addressbook_factory_CPPFLAGS = \
+       $(AM_CPPFLAGS) \
+       -DG_LOG_DOMAIN=\"evolution-addressbook-factory\" \
+       -DLOCALEDIR=\"$(localedir)\" \
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/addressbook \
+       -I$(top_builddir) \
+       -I$(top_builddir)/addressbook \
+       $(EVOLUTION_ADDRESSBOOK_CFLAGS) \
+       $(FACTORY_GTK_CFLAGS) \
+       $(GOA_CFLAGS) \
+       $(NULL)
+
+evolution_addressbook_factory_SOURCES = \
+       evolution-addressbook-factory.c \
+       evolution-addressbook-factory-migrate-basedir.c \
+       $(NULL)
+
+evolution_addressbook_factory_LDADD = \
+       $(top_builddir)/addressbook/libedata-book/libedata-book-1.2.la \
+       $(top_builddir)/libebackend/libebackend-1.2.la \
+       $(top_builddir)/libedataserver/libedataserver-1.2.la \
+       $(EVOLUTION_ADDRESSBOOK_LIBS) \
+       $(FACTORY_GTK_LIBS) \
+       $(GOA_LIBS) \
+       $(NULL)
+
+-include $(top_srcdir)/git.mk
@@ -1,5 +1,5 @@
 /*
- * e-data-book-migrate-basedir.c
+ * evolution-addressbook-factory-migrate-basedir.c
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
 #include <glib/gstdio.h>
 #include <libedataserver/e-data-server-util.h>
 
-void e_data_book_migrate_basedir (void);
+/* Forward Declarations */
+void evolution_addressbook_factory_migrate_basedir (void);
 
 static gboolean
-data_book_migrate_rename (const gchar *old_filename,
-                          const gchar *new_filename)
+migrate_rename (const gchar *old_filename,
+                const gchar *new_filename)
 {
        gboolean old_filename_is_dir;
        gboolean old_filename_exists;
@@ -58,7 +59,7 @@ data_book_migrate_rename (const gchar *old_filename,
 }
 
 static gboolean
-data_book_migrate_rmdir (const gchar *dirname)
+migrate_rmdir (const gchar *dirname)
 {
        GDir *dir = NULL;
        gboolean success = TRUE;
@@ -91,7 +92,7 @@ data_book_migrate_rmdir (const gchar *dirname)
 }
 
 static void
-data_book_migrate_process_corrections (GHashTable *corrections)
+migrate_process_corrections (GHashTable *corrections)
 {
        GHashTableIter iter;
        gpointer old_filename;
@@ -100,14 +101,14 @@ data_book_migrate_process_corrections (GHashTable *corrections)
        g_hash_table_iter_init (&iter, corrections);
 
        while (g_hash_table_iter_next (&iter, &old_filename, &new_filename)) {
-               data_book_migrate_rename (old_filename, new_filename);
+               migrate_rename (old_filename, new_filename);
                g_hash_table_iter_remove (&iter);
        }
 }
 
 static gboolean
-data_book_migrate_move_contents (const gchar *src_directory,
-                                 const gchar *dst_directory)
+migrate_move_contents (const gchar *src_directory,
+                       const gchar *dst_directory)
 {
        GDir *dir;
        GHashTable *corrections;
@@ -138,7 +139,7 @@ data_book_migrate_move_contents (const gchar *src_directory,
 
        g_dir_close (dir);
 
-       data_book_migrate_process_corrections (corrections);
+       migrate_process_corrections (corrections);
        g_hash_table_destroy (corrections);
 
        /* It's tempting to want to remove the source directory here.
@@ -150,7 +151,7 @@ data_book_migrate_move_contents (const gchar *src_directory,
 }
 
 static void
-data_book_migrate_fix_groupwise_bug (const gchar *old_base_dir)
+migrate_fix_groupwise_bug (const gchar *old_base_dir)
 {
        GDir *dir;
        GHashTable *corrections;
@@ -192,7 +193,7 @@ data_book_migrate_fix_groupwise_bug (const gchar *old_base_dir)
 
        g_dir_close (dir);
 
-       data_book_migrate_process_corrections (corrections);
+       migrate_process_corrections (corrections);
        g_hash_table_destroy (corrections);
 
 exit:
@@ -201,7 +202,7 @@ exit:
 }
 
 static void
-data_book_migrate_to_user_cache_dir (const gchar *old_base_dir)
+migrate_to_user_cache_dir (const gchar *old_base_dir)
 {
        const gchar *new_cache_dir;
        gchar *old_cache_dir;
@@ -235,21 +236,21 @@ data_book_migrate_to_user_cache_dir (const gchar *old_base_dir)
        src_directory = g_build_filename (old_cache_dir, "addressbook", NULL);
        dst_directory = g_build_filename (new_cache_dir, "addressbook", NULL);
 
-       data_book_migrate_move_contents (src_directory, dst_directory);
-       data_book_migrate_rmdir (src_directory);
+       migrate_move_contents (src_directory, dst_directory);
+       migrate_rmdir (src_directory);
 
        g_free (src_directory);
        g_free (dst_directory);
 
        /* Try to remove the old cache directory.  Good chance this will
         * fail on the first try, since Evolution puts stuff here too. */
-       data_book_migrate_rmdir (old_cache_dir);
+       migrate_rmdir (old_cache_dir);
 
        g_free (old_cache_dir);
 }
 
 static void
-data_book_migrate_to_user_data_dir (const gchar *old_base_dir)
+migrate_to_user_data_dir (const gchar *old_base_dir)
 {
        const gchar *new_data_dir;
        gchar *src_directory;
@@ -281,15 +282,15 @@ data_book_migrate_to_user_data_dir (const gchar *old_base_dir)
        src_directory = g_build_filename (old_base_dir, "addressbook", "local", NULL);
        dst_directory = g_build_filename (new_data_dir, "addressbook", NULL);
 
-       data_book_migrate_move_contents (src_directory, dst_directory);
-       data_book_migrate_rmdir (src_directory);
+       migrate_move_contents (src_directory, dst_directory);
+       migrate_rmdir (src_directory);
 
        g_free (src_directory);
        g_free (dst_directory);
 }
 
 void
-e_data_book_migrate_basedir (void)
+evolution_addressbook_factory_migrate_basedir (void)
 {
        const gchar *home_dir;
        gchar *old_base_dir;
@@ -304,14 +305,14 @@ e_data_book_migrate_basedir (void)
        if (!g_file_test (old_base_dir, G_FILE_TEST_IS_DIR))
                goto exit;
 
-       data_book_migrate_fix_groupwise_bug (old_base_dir);
+       migrate_fix_groupwise_bug (old_base_dir);
 
-       data_book_migrate_to_user_cache_dir (old_base_dir);
-       data_book_migrate_to_user_data_dir (old_base_dir);
+       migrate_to_user_cache_dir (old_base_dir);
+       migrate_to_user_data_dir (old_base_dir);
 
        /* Try to remove the old base directory.  Good chance this will
         * fail on the first try, since Evolution puts stuff here too. */
-       data_book_migrate_rmdir (old_base_dir);
+       migrate_rmdir (old_base_dir);
 
 exit:
        g_free (old_base_dir);
diff --git a/services/evolution-addressbook-factory/evolution-addressbook-factory.c b/services/evolution-addressbook-factory/evolution-addressbook-factory.c
new file mode 100644 (file)
index 0000000..d4d3350
--- /dev/null
@@ -0,0 +1,144 @@
+/*
+ * evolution-addressbook-factory.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#include <config.h>
+#include <locale.h>
+#include <glib/gi18n.h>
+
+#ifdef ENABLE_MAINTAINER_MODE
+#include <gtk/gtk.h>
+#endif
+
+#ifdef G_OS_UNIX
+#if GLIB_CHECK_VERSION(2,29,5)
+#include <glib-unix.h>
+#endif
+#endif
+
+#ifdef G_OS_WIN32
+#include <windows.h>
+#include <conio.h>
+#ifndef PROCESS_DEP_ENABLE
+#define PROCESS_DEP_ENABLE 0x00000001
+#endif
+#ifndef PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION
+#define PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION 0x00000002
+#endif
+#endif
+
+#include <libedata-book/e-data-book-factory.h>
+
+/* Keep running after the last client is closed. */
+static gboolean opt_keep_running = FALSE;
+
+static GOptionEntry entries[] = {
+
+       { "keep-running", 'r', 0, G_OPTION_ARG_NONE, &opt_keep_running,
+         N_("Keep running after the last client is closed"), NULL },
+       { NULL }
+};
+
+/* Forward Declarations */
+void evolution_addressbook_factory_migrate_basedir (void);
+
+gint
+main (gint argc,
+      gchar **argv)
+{
+       GOptionContext *context;
+       EDBusServer *server;
+       GError *error = NULL;
+
+#ifdef G_OS_WIN32
+       /* Reduce risks */
+       {
+               typedef BOOL (WINAPI *t_SetDllDirectoryA) (LPCSTR lpPathName);
+               t_SetDllDirectoryA p_SetDllDirectoryA;
+
+               p_SetDllDirectoryA = GetProcAddress (
+                       GetModuleHandle ("kernel32.dll"),
+                       "SetDllDirectoryA");
+
+               if (p_SetDllDirectoryA != NULL)
+                       p_SetDllDirectoryA ("");
+       }
+#ifndef _WIN64
+       {
+               typedef BOOL (WINAPI *t_SetProcessDEPPolicy) (DWORD dwFlags);
+               t_SetProcessDEPPolicy p_SetProcessDEPPolicy;
+
+               p_SetProcessDEPPolicy = GetProcAddress (
+                       GetModuleHandle ("kernel32.dll"),
+                       "SetProcessDEPPolicy");
+
+               if (p_SetProcessDEPPolicy != NULL)
+                       p_SetProcessDEPPolicy (
+                               PROCESS_DEP_ENABLE |
+                               PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION);
+       }
+#endif
+#endif
+
+       setlocale (LC_ALL, "");
+       bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+       bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+#ifdef ENABLE_MAINTAINER_MODE
+       /* This is only to load gtk-modules, like
+        * bug-buddy's gnomesegvhandler, if possible */
+       gtk_init_check (&argc, &argv);
+#else
+       g_type_init ();
+#endif
+
+       context = g_option_context_new (NULL);
+       g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
+       g_option_context_parse (context, &argc, &argv, &error);
+       g_option_context_free (context);
+
+       if (error != NULL) {
+               g_printerr ("%s\n", error->message);
+               exit (EXIT_FAILURE);
+       }
+
+       /* Migrate user data from ~/.evolution to XDG base directories. */
+       evolution_addressbook_factory_migrate_basedir ();
+
+       server = g_initable_new (
+               E_TYPE_DATA_BOOK_FACTORY, NULL, &error, NULL);
+
+       if (error != NULL) {
+               g_printerr ("%s\n", error->message);
+               exit (EXIT_FAILURE);
+       }
+
+       g_print ("Server is up and running...\n");
+
+       /* This SHOULD keep the server's use
+        * count from ever reaching zero. */
+       if (opt_keep_running)
+               e_dbus_server_hold (server);
+
+       e_dbus_server_run (server);
+
+       g_object_unref (server);
+
+       g_print ("Bye.\n");
+
+       return 0;
+}
diff --git a/services/evolution-calendar-factory/Makefile.am b/services/evolution-calendar-factory/Makefile.am
new file mode 100644 (file)
index 0000000..39bd5e4
--- /dev/null
@@ -0,0 +1,38 @@
+NULL =
+
+service_in_files = org.gnome.evolution.dataserver.Calendar.service.in
+servicedir = $(datadir)/dbus-1/services
+service_DATA = $(service_in_files:.service.in=.service)
+@EVO_SUBST_SERVICE_RULE@
+
+CLEANFILES = $(service_DATA)
+EXTRA_DIST = $(service_in_files)
+
+libexec_PROGRAMS = evolution-calendar-factory
+
+evolution_calendar_factory_CPPFLAGS = \
+       $(AM_CPPFLAGS) \
+       -DG_LOG_DOMAIN=\"evolution-calendar-factory\" \
+       -DLOCALEDIR=\"$(localedir)\" \
+       -I$(top_srcdir) \
+       -I$(top_srcdir)/calendar \
+       -I$(top_builddir) \
+       -I$(top_builddir)/calendar \
+       $(EVOLUTION_CALENDAR_CFLAGS) \
+       $(FACTORY_GTK_CFLAGS) \
+       $(NULL)
+
+evolution_calendar_factory_SOURCES = \
+       evolution-calendar-factory.c \
+       evolution-calendar-factory-migrate-basedir.c \
+       $(NULL)
+
+evolution_calendar_factory_LDADD = \
+       $(top_builddir)/calendar/libedata-cal/libedata-cal-1.2.la \
+       $(top_builddir)/libebackend/libebackend-1.2.la \
+       $(top_builddir)/libedataserver/libedataserver-1.2.la \
+       $(EVOLUTION_CALENDAR_LIBS) \
+       $(FACTORY_GTK_LIBS) \
+       $(NULL)
+
+-include $(top_srcdir)/git.mk
@@ -1,5 +1,5 @@
 /*
- * e-data-cal-migrate-basedir.c
+ * evolution-calendar-factory-migrate-basedir.c
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
 #include <glib/gstdio.h>
 #include <libedataserver/e-data-server-util.h>
 
-void e_data_cal_migrate_basedir (void);
+/* Forward Declarations */
+void evolution_calendar_factory_migrate_basedir (void);
 
 static gboolean
-data_cal_migrate_rename (const gchar *old_filename,
-                         const gchar *new_filename)
+migrate_rename (const gchar *old_filename,
+                const gchar *new_filename)
 {
        gboolean old_filename_is_dir;
        gboolean old_filename_exists;
@@ -58,7 +59,7 @@ data_cal_migrate_rename (const gchar *old_filename,
 }
 
 static gboolean
-data_cal_migrate_rmdir (const gchar *dirname)
+migrate_rmdir (const gchar *dirname)
 {
        GDir *dir = NULL;
        gboolean success = TRUE;
@@ -91,7 +92,7 @@ data_cal_migrate_rmdir (const gchar *dirname)
 }
 
 static void
-data_cal_migrate_process_corrections (GHashTable *corrections)
+migrate_process_corrections (GHashTable *corrections)
 {
        GHashTableIter iter;
        gpointer old_filename;
@@ -100,14 +101,14 @@ data_cal_migrate_process_corrections (GHashTable *corrections)
        g_hash_table_iter_init (&iter, corrections);
 
        while (g_hash_table_iter_next (&iter, &old_filename, &new_filename)) {
-               data_cal_migrate_rename (old_filename, new_filename);
+               migrate_rename (old_filename, new_filename);
                g_hash_table_iter_remove (&iter);
        }
 }
 
 static gboolean
-data_cal_migrate_move_contents (const gchar *src_directory,
-                                const gchar *dst_directory)
+migrate_move_contents (const gchar *src_directory,
+                       const gchar *dst_directory)
 {
        GDir *dir;
        GHashTable *corrections;
@@ -138,7 +139,7 @@ data_cal_migrate_move_contents (const gchar *src_directory,
 
        g_dir_close (dir);
 
-       data_cal_migrate_process_corrections (corrections);
+       migrate_process_corrections (corrections);
        g_hash_table_destroy (corrections);
 
        /* It's tempting to want to remove the source directory here.
@@ -150,7 +151,7 @@ data_cal_migrate_move_contents (const gchar *src_directory,
 }
 
 static void
-data_cal_migrate_fix_exchange_bug (const gchar *old_base_dir)
+migrate_fix_exchange_bug (const gchar *old_base_dir)
 {
        GDir *dir;
        GHashTable *corrections;
@@ -191,7 +192,7 @@ data_cal_migrate_fix_exchange_bug (const gchar *old_base_dir)
 
        g_dir_close (dir);
 
-       data_cal_migrate_process_corrections (corrections);
+       migrate_process_corrections (corrections);
        g_hash_table_destroy (corrections);
 
 exit:
@@ -200,7 +201,7 @@ exit:
 }
 
 static void
-data_cal_migrate_fix_memos_cache_bug (const gchar *old_base_dir)
+migrate_fix_memos_cache_bug (const gchar *old_base_dir)
 {
        gchar *src_directory;
        gchar *dst_directory;
@@ -212,15 +213,15 @@ data_cal_migrate_fix_memos_cache_bug (const gchar *old_base_dir)
        src_directory = g_build_filename (old_base_dir, "cache", "journal", NULL);
        dst_directory = g_build_filename (old_base_dir, "cache", "memos", NULL);
 
-       data_cal_migrate_move_contents (src_directory, dst_directory);
-       data_cal_migrate_rmdir (src_directory);
+       migrate_move_contents (src_directory, dst_directory);
+       migrate_rmdir (src_directory);
 
        g_free (src_directory);
        g_free (dst_directory);
 }
 
 static void
-data_cal_migrate_to_user_cache_dir (const gchar *old_base_dir)
+migrate_to_user_cache_dir (const gchar *old_base_dir)
 {
        const gchar *new_cache_dir;
        gchar *old_cache_dir;
@@ -254,8 +255,8 @@ data_cal_migrate_to_user_cache_dir (const gchar *old_base_dir)
        src_directory = g_build_filename (old_cache_dir, "calendar", NULL);
        dst_directory = g_build_filename (new_cache_dir, "calendar", NULL);
 
-       data_cal_migrate_move_contents (src_directory, dst_directory);
-       data_cal_migrate_rmdir (src_directory);
+       migrate_move_contents (src_directory, dst_directory);
+       migrate_rmdir (src_directory);
 
        g_free (src_directory);
        g_free (dst_directory);
@@ -263,8 +264,8 @@ data_cal_migrate_to_user_cache_dir (const gchar *old_base_dir)
        src_directory = g_build_filename (old_cache_dir, "memos", NULL);
        dst_directory = g_build_filename (new_cache_dir, "memos", NULL);
 
-       data_cal_migrate_move_contents (src_directory, dst_directory);
-       data_cal_migrate_rmdir (src_directory);
+       migrate_move_contents (src_directory, dst_directory);
+       migrate_rmdir (src_directory);
 
        g_free (src_directory);
        g_free (dst_directory);
@@ -272,21 +273,21 @@ data_cal_migrate_to_user_cache_dir (const gchar *old_base_dir)
        src_directory = g_build_filename (old_cache_dir, "tasks", NULL);
        dst_directory = g_build_filename (new_cache_dir, "tasks", NULL);
 
-       data_cal_migrate_move_contents (src_directory, dst_directory);
-       data_cal_migrate_rmdir (src_directory);
+       migrate_move_contents (src_directory, dst_directory);
+       migrate_rmdir (src_directory);
 
        g_free (src_directory);
        g_free (dst_directory);
 
        /* Try to remove the old cache directory.  Good chance this will
         * fail on the first try, since Evolution puts stuff here too. */
-       data_cal_migrate_rmdir (old_cache_dir);
+       migrate_rmdir (old_cache_dir);
 
        g_free (old_cache_dir);
 }
 
 static void
-data_cal_migrate_to_user_data_dir (const gchar *old_base_dir)
+migrate_to_user_data_dir (const gchar *old_base_dir)
 {
        const gchar *new_data_dir;
        gchar *src_directory;
@@ -318,8 +319,8 @@ data_cal_migrate_to_user_data_dir (const gchar *old_base_dir)
        src_directory = g_build_filename (old_base_dir, "calendar", "local", NULL);
        dst_directory = g_build_filename (new_data_dir, "calendar", NULL);
 
-       data_cal_migrate_move_contents (src_directory, dst_directory);
-       data_cal_migrate_rmdir (src_directory);
+       migrate_move_contents (src_directory, dst_directory);
+       migrate_rmdir (src_directory);
 
        g_free (src_directory);
        g_free (dst_directory);
@@ -327,8 +328,8 @@ data_cal_migrate_to_user_data_dir (const gchar *old_base_dir)
        src_directory = g_build_filename (old_base_dir, "memos", "local", NULL);
        dst_directory = g_build_filename (new_data_dir, "memos", NULL);
 
-       data_cal_migrate_move_contents (src_directory, dst_directory);
-       data_cal_migrate_rmdir (src_directory);
+       migrate_move_contents (src_directory, dst_directory);
+       migrate_rmdir (src_directory);
 
        g_free (src_directory);
        g_free (dst_directory);
@@ -336,8 +337,8 @@ data_cal_migrate_to_user_data_dir (const gchar *old_base_dir)
        src_directory = g_build_filename (old_base_dir, "tasks", "local", NULL);
        dst_directory = g_build_filename (new_data_dir, "tasks", NULL);
 
-       data_cal_migrate_move_contents (src_directory, dst_directory);
-       data_cal_migrate_rmdir (src_directory);
+       migrate_move_contents (src_directory, dst_directory);
+       migrate_rmdir (src_directory);
 
        g_free (src_directory);
        g_free (dst_directory);
@@ -350,15 +351,15 @@ data_cal_migrate_to_user_data_dir (const gchar *old_base_dir)
        src_directory = g_build_filename (old_base_dir, "exchange", NULL);
        dst_directory = g_build_filename (new_data_dir, "exchange", NULL);
 
-       data_cal_migrate_move_contents (src_directory, dst_directory);
-       data_cal_migrate_rmdir (src_directory);
+       migrate_move_contents (src_directory, dst_directory);
+       migrate_rmdir (src_directory);
 
        g_free (src_directory);
        g_free (dst_directory);
 }
 
 void
-e_data_cal_migrate_basedir (void)
+evolution_calendar_factory_migrate_basedir (void)
 {
        const gchar *home_dir;
        gchar *old_base_dir;
@@ -373,15 +374,15 @@ e_data_cal_migrate_basedir (void)
        if (!g_file_test (old_base_dir, G_FILE_TEST_IS_DIR))
                goto exit;
 
-       data_cal_migrate_fix_exchange_bug (old_base_dir);
-       data_cal_migrate_fix_memos_cache_bug (old_base_dir);
+       migrate_fix_exchange_bug (old_base_dir);
+       migrate_fix_memos_cache_bug (old_base_dir);
 
-       data_cal_migrate_to_user_cache_dir (old_base_dir);
-       data_cal_migrate_to_user_data_dir (old_base_dir);
+       migrate_to_user_cache_dir (old_base_dir);
+       migrate_to_user_data_dir (old_base_dir);
 
        /* Try to remove the old base directory.  Good chance this will
         * fail on the first try, since Evolution puts stuff here too. */
-       data_cal_migrate_rmdir (old_base_dir);
+       migrate_rmdir (old_base_dir);
 
 exit:
        g_free (old_base_dir);
diff --git a/services/evolution-calendar-factory/evolution-calendar-factory.c b/services/evolution-calendar-factory/evolution-calendar-factory.c
new file mode 100644 (file)
index 0000000..9936728
--- /dev/null
@@ -0,0 +1,146 @@
+/*
+ * evolution-calendar-factory.c
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>
+ *
+ */
+
+#include <config.h>
+#include <locale.h>
+#include <glib/gi18n.h>
+
+#ifdef ENABLE_MAINTAINER_MODE
+#include <gtk/gtk.h>
+#endif
+
+#ifdef HAVE_ICAL_UNKNOWN_TOKEN_HANDLING
+#include <libical/ical.h>
+#endif
+
+#ifdef G_OS_WIN32
+#include <windows.h>
+#include <conio.h>
+#ifndef PROCESS_DEP_ENABLE
+#define PROCESS_DEP_ENABLE 0x00000001
+#endif
+#ifndef PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION
+#define PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION 0x00000002
+#endif
+#endif
+
+#include <libedata-cal/e-data-cal-factory.h>
+
+/* Keeps running after the last client is closed. */
+static gboolean opt_keep_running = FALSE;
+
+static GOptionEntry entries[] = {
+
+       { "keep-running", 'r', 0, G_OPTION_ARG_NONE, &opt_keep_running,
+         N_("Keep running after the last client is closed"), NULL },
+       { NULL }
+};
+
+/* Forward Declarations */
+void evolution_calendar_factory_migrate_basedir (void);
+
+gint
+main (gint argc,
+      gchar **argv)
+{
+       GOptionContext *context;
+       EDBusServer *server;
+       GError *error = NULL;
+
+#ifdef G_OS_WIN32
+       /* Reduce risks */
+       {
+               typedef BOOL (WINAPI *t_SetDllDirectoryA) (LPCSTR lpPathName);
+               t_SetDllDirectoryA p_SetDllDirectoryA;
+
+               p_SetDllDirectoryA = GetProcAddress (
+                       GetModuleHandle ("kernel32.dll"),
+                       "SetDllDirectoryA");
+
+               if (p_SetDllDirectoryA != NULL)
+                       p_SetDllDirectoryA ("");
+       }
+#ifndef _WIN64
+       {
+               typedef BOOL (WINAPI *t_SetProcessDEPPolicy) (DWORD dwFlags);
+               t_SetProcessDEPPolicy p_SetProcessDEPPolicy;
+
+               p_SetProcessDEPPolicy = GetProcAddress (
+                       GetModuleHandle ("kernel32.dll"),
+                       "SetProcessDEPPolicy");
+
+               if (p_SetProcessDEPPolicy != NULL)
+                       p_SetProcessDEPPolicy (
+                               PROCESS_DEP_ENABLE |
+                               PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION);
+       }
+#endif
+#endif
+
+       setlocale (LC_ALL, "");
+       bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+       bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+
+#ifdef ENABLE_MAINTAINER_MODE
+       /* This is only to load gtk-modules, like
+        * bug-buddy's gnomesegvhandler, if possible. */
+       gtk_init_check (&argc, &argv);
+#else
+       g_type_init ();
+#endif
+
+       context = g_option_context_new (NULL);
+       g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
+       g_option_context_parse (context, &argc, &argv, &error);
+       g_option_context_free (context);
+
+       if (error != NULL) {
+               g_printerr ("%s\n", error->message);
+               exit (EXIT_FAILURE);
+       }
+
+#ifdef HAVE_ICAL_UNKNOWN_TOKEN_HANDLING
+       ical_set_unknown_token_handling_setting (ICAL_DISCARD_TOKEN);
+#endif
+
+       /* Migrate user data from ~/.evolution to XDG base directories. */
+       evolution_calendar_factory_migrate_basedir ();
+
+       server = g_initable_new (
+               E_TYPE_DATA_CAL_FACTORY, NULL, &error, NULL);
+
+       if (error != NULL) {
+               g_printerr ("%s\n", error->message);
+               exit (EXIT_FAILURE);
+       }
+
+       g_print ("Server is up and running...\n");
+
+       /* This SHOULD keep the server's use
+        * count from ever reaching zero. */
+       if (opt_keep_running)
+               e_dbus_server_hold (server);
+
+       e_dbus_server_run (server);
+
+       g_object_unref (server);
+
+       g_print ("Bye.\n");
+
+       return 0;
+}
diff --git a/services/evolution-calendar-factory/org.gnome.evolution.dataserver.Calendar.service.in b/services/evolution-calendar-factory/org.gnome.evolution.dataserver.Calendar.service.in
new file mode 100644 (file)
index 0000000..c985b31
--- /dev/null
@@ -0,0 +1,3 @@
+[D-BUS Service]
+Name=@CALENDAR_DBUS_SERVICE_NAME@
+Exec=@libexecdir@/evolution-calendar-factory