#include <config.h>
#include <glib/gi18n-lib.h>
-#include <libedataserver/e-uid.h>
-#include <libedataserver/e-source-address-book.h>
-#include <libedataserver/e-source-authentication.h>
-#include <libedataserver/e-source-calendar.h>
-#include <libedataserver/e-source-camel.h>
-#include <libedataserver/e-source-collection.h>
-#include <libedataserver/e-source-mail-account.h>
-#include <libedataserver/e-source-mail-identity.h>
-#include <libedataserver/e-source-mail-transport.h>
-#include <libedataserver/e-source-security.h>
-#include <libedataserver/e-source-webdav.h>
-
-#include <libebackend/e-collection-backend.h>
-#include <libebackend/e-collection-backend-factory.h>
-#include <libebackend/e-server-side-source.h>
-#include <libebackend/e-source-registry-server.h>
+#include <libebackend/libebackend.h>
/* Standard GObject macros */
#define E_TYPE_YAHOO_BACKEND \
#define YAHOO_CALENDAR_BACKEND_NAME "caldav"
#define YAHOO_CALENDAR_HOST "caldav.calendar.yahoo.com"
#define YAHOO_CALENDAR_CALDAV_PATH "/dav/%s/Calendar/%s"
+#define YAHOO_CALENDAR_RESOURCE_ID "Calendar"
+
+/* Tasks Configuration Details
+ * (mostly the same as calendar) */
+#define YAHOO_TASKS_RESOURCE_ID "Tasks"
typedef struct _EYahooBackend EYahooBackend;
typedef struct _EYahooBackendClass EYahooBackendClass;
ESourceRegistryServer *server;
const gchar *backend_name;
const gchar *extension_name;
+ const gchar *resource_id;
/* XXX We could just stick a [Calendar] and [Task List] extension
* into the same ESource since all other settings are exactly
/* Add Yahoo! Calendar */
- source = e_collection_backend_new_child (backend, "Calendar");
+ resource_id = YAHOO_CALENDAR_RESOURCE_ID;
+ source = e_collection_backend_new_child (backend, resource_id);
e_source_set_display_name (source, _("Calendar"));
extension_name = E_SOURCE_EXTENSION_CALENDAR;
extension = e_source_get_extension (source, extension_name);
e_source_backend_set_backend_name (extension, backend_name);
+ extension_name = E_SOURCE_EXTENSION_ALARMS;
+ extension = e_source_get_extension (source, extension_name);
+ if (!e_source_alarms_get_last_notified (E_SOURCE_ALARMS (extension))) {
+ GTimeVal today_tv;
+ gchar *today;
+
+ g_get_current_time (&today_tv);
+ today = g_time_val_to_iso8601 (&today_tv);
+ e_source_alarms_set_last_notified (E_SOURCE_ALARMS (extension), today);
+ g_free (today);
+ }
+
yahoo_backend_config_calendar_child (backend, source);
e_source_registry_server_add_source (server, source);
/* Add Yahoo! Tasks */
- source = e_collection_backend_new_child (backend, "Tasks");
+ resource_id = YAHOO_TASKS_RESOURCE_ID;
+ source = e_collection_backend_new_child (backend, resource_id);
e_source_set_display_name (source, _("Tasks"));
extension_name = E_SOURCE_EXTENSION_TASK_LIST;
g_list_free_full (list, (GDestroyNotify) g_object_unref);
}
+static gchar *
+yahoo_backend_dup_resource_id (ECollectionBackend *backend,
+ ESource *child_source)
+{
+ const gchar *extension_name;
+
+ /* XXX This is trival for now since we only
+ * add one calendar and one task list. */
+
+ extension_name = E_SOURCE_EXTENSION_CALENDAR;
+ if (e_source_has_extension (child_source, extension_name))
+ return g_strdup (YAHOO_CALENDAR_RESOURCE_ID);
+
+ extension_name = E_SOURCE_EXTENSION_TASK_LIST;
+ if (e_source_has_extension (child_source, extension_name))
+ return g_strdup (YAHOO_TASKS_RESOURCE_ID);
+
+ return NULL;
+}
+
static void
yahoo_backend_child_added (ECollectionBackend *backend,
ESource *child_source)
extension_name = E_SOURCE_EXTENSION_MAIL_TRANSPORT;
is_mail |= e_source_has_extension (child_source, extension_name);
- /* Synchronize mail-related display names with the collection. */
- if (is_mail)
- g_object_bind_property (
- collection_source, "display-name",
- child_source, "display-name",
- G_BINDING_SYNC_CREATE);
-
/* Synchronize mail-related user with the collection identity. */
extension_name = E_SOURCE_EXTENSION_AUTHENTICATION;
if (is_mail && e_source_has_extension (child_source, extension_name)) {
backend_class = E_COLLECTION_BACKEND_CLASS (class);
backend_class->populate = yahoo_backend_populate;
+ backend_class->dup_resource_id = yahoo_backend_dup_resource_id;
backend_class->child_added = yahoo_backend_child_added;
}