Add the webcal source group.
2003-10-31 Hans Petter Jansson <hpj@ximian.com> * gui/calendar-component.c (calendar_component_init): Add the webcal source group. * gui/dialogs/new-calendar.c (print_uri_noproto): Implement. (group_is_remote): Implement. (create_new_source_with_group): Implement webcal case. (new_calendar_dialog): Get optional location from dialog. * gui/dialogs/new-calendar.glade: Add location entry. * pcs/Makefile.am: Build http backend. * pcs/cal-backend-http.[ch]: Add skeleton based on cal-backend-file. svn path=/trunk/; revision=23153
This commit is contained in:
committed by
Hans Petter
parent
a7ac69cdc6
commit
dd09d63087
@ -1,3 +1,19 @@
|
|||||||
|
2003-10-31 Hans Petter Jansson <hpj@ximian.com>
|
||||||
|
|
||||||
|
* gui/calendar-component.c (calendar_component_init): Add the webcal
|
||||||
|
source group.
|
||||||
|
|
||||||
|
* gui/dialogs/new-calendar.c (print_uri_noproto): Implement.
|
||||||
|
(group_is_remote): Implement.
|
||||||
|
(create_new_source_with_group): Implement webcal case.
|
||||||
|
(new_calendar_dialog): Get optional location from dialog.
|
||||||
|
|
||||||
|
* gui/dialogs/new-calendar.glade: Add location entry.
|
||||||
|
|
||||||
|
* pcs/Makefile.am: Build http backend.
|
||||||
|
|
||||||
|
* pcs/cal-backend-http.[ch]: Add skeleton based on cal-backend-file.
|
||||||
|
|
||||||
2003-10-31 Dan Winship <danw@ximian.com>
|
2003-10-31 Dan Winship <danw@ximian.com>
|
||||||
|
|
||||||
* cal-util/cal-util.h: Add CAL_STATIC_CAPABILITY_NO_THISANDFUTURE
|
* cal-util/cal-util.h: Add CAL_STATIC_CAPABILITY_NO_THISANDFUTURE
|
||||||
|
|||||||
@ -355,7 +355,7 @@ calendar_component_init (CalendarComponent *component)
|
|||||||
ESource *source;
|
ESource *source;
|
||||||
char *base_uri, *new_dir;
|
char *base_uri, *new_dir;
|
||||||
|
|
||||||
/* create the source group */
|
/* create the local source group */
|
||||||
base_uri = g_build_filename (g_get_home_dir (),
|
base_uri = g_build_filename (g_get_home_dir (),
|
||||||
"/.evolution/calendar/local/OnThisComputer/",
|
"/.evolution/calendar/local/OnThisComputer/",
|
||||||
NULL);
|
NULL);
|
||||||
@ -381,6 +381,10 @@ calendar_component_init (CalendarComponent *component)
|
|||||||
}
|
}
|
||||||
|
|
||||||
g_free (base_uri);
|
g_free (base_uri);
|
||||||
|
|
||||||
|
/* create the remote source group */
|
||||||
|
group = e_source_group_new (_("On The Web"), "webcal://");
|
||||||
|
e_source_list_add_group (priv->source_list, group, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
component->priv = priv;
|
component->priv = priv;
|
||||||
|
|||||||
@ -22,6 +22,7 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
#include <bonobo/bonobo-i18n.h>
|
#include <bonobo/bonobo-i18n.h>
|
||||||
#include <gtk/gtkdialog.h>
|
#include <gtk/gtkdialog.h>
|
||||||
#include <gtk/gtkentry.h>
|
#include <gtk/gtkentry.h>
|
||||||
@ -32,15 +33,69 @@
|
|||||||
#include <glade/glade.h>
|
#include <glade/glade.h>
|
||||||
#include <e-util/e-dialog-utils.h>
|
#include <e-util/e-dialog-utils.h>
|
||||||
#include <e-util/e-source-list.h>
|
#include <e-util/e-source-list.h>
|
||||||
|
#include <e-util/e-url.h>
|
||||||
#include "new-calendar.h"
|
#include "new-calendar.h"
|
||||||
|
|
||||||
|
static gchar *
|
||||||
|
print_uri_noproto (EUri *uri)
|
||||||
|
{
|
||||||
|
gchar *uri_noproto;
|
||||||
|
|
||||||
|
if (uri->port != 0)
|
||||||
|
uri_noproto = g_strdup_printf (
|
||||||
|
"%s%s%s%s%s%s%s:%d%s%s%s",
|
||||||
|
uri->user ? uri->user : "",
|
||||||
|
uri->authmech ? ";auth=" : "",
|
||||||
|
uri->authmech ? uri->authmech : "",
|
||||||
|
uri->passwd ? ":" : "",
|
||||||
|
uri->passwd ? uri->passwd : "",
|
||||||
|
uri->user ? "@" : "",
|
||||||
|
uri->host ? uri->host : "",
|
||||||
|
uri->port,
|
||||||
|
uri->path ? uri->path : "",
|
||||||
|
uri->query ? "?" : "",
|
||||||
|
uri->query ? uri->query : "");
|
||||||
|
else
|
||||||
|
uri_noproto = g_strdup_printf (
|
||||||
|
"%s%s%s%s%s%s%s%s%s%s",
|
||||||
|
uri->user ? uri->user : "",
|
||||||
|
uri->authmech ? ";auth=" : "",
|
||||||
|
uri->authmech ? uri->authmech : "",
|
||||||
|
uri->passwd ? ":" : "",
|
||||||
|
uri->passwd ? uri->passwd : "",
|
||||||
|
uri->user ? "@" : "",
|
||||||
|
uri->host ? uri->host : "",
|
||||||
|
uri->path ? uri->path : "",
|
||||||
|
uri->query ? "?" : "",
|
||||||
|
uri->query ? uri->query : "");
|
||||||
|
|
||||||
|
return uri_noproto;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
group_is_remote (ESourceGroup *group)
|
||||||
|
{
|
||||||
|
EUri *uri;
|
||||||
|
gboolean is_remote = FALSE;
|
||||||
|
|
||||||
|
uri = e_uri_new (e_source_group_peek_base_uri (group));
|
||||||
|
if (!uri)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (uri->protocol && strcmp (uri->protocol, "file"))
|
||||||
|
is_remote = TRUE;
|
||||||
|
|
||||||
|
e_uri_free (uri);
|
||||||
|
return is_remote;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
create_new_source_with_group (GtkWindow *parent,
|
create_new_source_with_group (GtkWindow *parent,
|
||||||
ESourceGroup *group,
|
ESourceGroup *group,
|
||||||
const char *source_name)
|
const char *source_name,
|
||||||
|
const char *source_location)
|
||||||
{
|
{
|
||||||
ESource *source;
|
ESource *source;
|
||||||
char *new_dir;
|
|
||||||
|
|
||||||
if (e_source_group_peek_source_by_name (group, source_name)) {
|
if (e_source_group_peek_source_by_name (group, source_name)) {
|
||||||
e_notice (parent, GTK_MESSAGE_ERROR,
|
e_notice (parent, GTK_MESSAGE_ERROR,
|
||||||
@ -49,21 +104,82 @@ create_new_source_with_group (GtkWindow *parent,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create the new source */
|
if (group_is_remote (group)) {
|
||||||
new_dir = g_build_filename (e_source_group_peek_base_uri (group),
|
EUri *uri;
|
||||||
source_name, NULL);
|
gchar *relative_uri;
|
||||||
if (e_mkdir_hier (new_dir, 0700)) {
|
char *cache_dir;
|
||||||
|
|
||||||
|
/* Remote source */
|
||||||
|
|
||||||
|
if (!source_location || !strlen (source_location)) {
|
||||||
|
e_notice (parent, GTK_MESSAGE_ERROR,
|
||||||
|
_("The group '%s' is remote. You must specify a location "
|
||||||
|
"to get the calendar from"),
|
||||||
|
e_source_group_peek_name (group));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
uri = e_uri_new (source_location);
|
||||||
|
if (!uri) {
|
||||||
|
e_notice (parent, GTK_MESSAGE_ERROR,
|
||||||
|
_("The source location '%s' is not well-formed."),
|
||||||
|
source_location);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Make sure we're in agreement with the protocol. Note that EUri sets it
|
||||||
|
* to 'file' if none was specified in the input URI. We don't want to
|
||||||
|
* silently translate an explicit file:// into http:// though. */
|
||||||
|
if (uri->protocol &&
|
||||||
|
strcmp (uri->protocol, "http") &&
|
||||||
|
strcmp (uri->protocol, "webcal")) {
|
||||||
|
e_uri_free (uri);
|
||||||
|
e_notice (parent, GTK_MESSAGE_ERROR,
|
||||||
|
_("The source location '%s' is not a webcal source."),
|
||||||
|
source_location);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Our relative_uri is everything but protocol, which is supplied by parent group */
|
||||||
|
relative_uri = print_uri_noproto (uri);
|
||||||
|
e_uri_free (uri);
|
||||||
|
|
||||||
|
/* Set up cache dir */
|
||||||
|
cache_dir = g_build_filename (g_get_home_dir (),
|
||||||
|
"/.evolution/calendar/webcal/",
|
||||||
|
source_name, NULL);
|
||||||
|
if (e_mkdir_hier (cache_dir, 0700)) {
|
||||||
|
g_free (relative_uri);
|
||||||
|
g_free (cache_dir);
|
||||||
|
e_notice (parent, GTK_MESSAGE_ERROR,
|
||||||
|
_("Could not create cache for new calendar"));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Create source */
|
||||||
|
source = e_source_new (source_name, relative_uri);
|
||||||
|
|
||||||
|
g_free (relative_uri);
|
||||||
|
g_free (cache_dir);
|
||||||
|
} else {
|
||||||
|
char *new_dir;
|
||||||
|
|
||||||
|
/* Local source */
|
||||||
|
|
||||||
|
new_dir = g_build_filename (e_source_group_peek_base_uri (group),
|
||||||
|
source_name, NULL);
|
||||||
|
if (e_mkdir_hier (new_dir, 0700)) {
|
||||||
|
g_free (new_dir);
|
||||||
|
e_notice (parent, GTK_MESSAGE_ERROR,
|
||||||
|
_("Could not create directory for new calendar"));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
source = e_source_new (source_name, source_name);
|
||||||
g_free (new_dir);
|
g_free (new_dir);
|
||||||
e_notice (parent, GTK_MESSAGE_ERROR,
|
|
||||||
_("Could not create directory for new calendar"));
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
source = e_source_new (source_name, source_name);
|
|
||||||
e_source_group_add_source (group, source, -1);
|
e_source_group_add_source (group, source, -1);
|
||||||
|
|
||||||
g_free (new_dir);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,7 +191,7 @@ create_new_source_with_group (GtkWindow *parent,
|
|||||||
gboolean
|
gboolean
|
||||||
new_calendar_dialog (GtkWindow *parent)
|
new_calendar_dialog (GtkWindow *parent)
|
||||||
{
|
{
|
||||||
GtkWidget *dialog, *cal_group, *cal_name;
|
GtkWidget *dialog, *cal_group, *cal_name, *cal_location;
|
||||||
GladeXML *xml;
|
GladeXML *xml;
|
||||||
ESourceList *source_list;
|
ESourceList *source_list;
|
||||||
GConfClient *gconf_client;
|
GConfClient *gconf_client;
|
||||||
@ -92,6 +208,7 @@ new_calendar_dialog (GtkWindow *parent)
|
|||||||
dialog = glade_xml_get_widget (xml, "new-calendar-dialog");
|
dialog = glade_xml_get_widget (xml, "new-calendar-dialog");
|
||||||
cal_group = glade_xml_get_widget (xml, "calendar-group");
|
cal_group = glade_xml_get_widget (xml, "calendar-group");
|
||||||
cal_name = glade_xml_get_widget (xml, "calendar-name");
|
cal_name = glade_xml_get_widget (xml, "calendar-name");
|
||||||
|
cal_location = glade_xml_get_widget (xml, "calendar-location");
|
||||||
|
|
||||||
/* set up widgets */
|
/* set up widgets */
|
||||||
gconf_client = gconf_client_get_default ();
|
gconf_client = gconf_client_get_default ();
|
||||||
@ -120,14 +237,17 @@ new_calendar_dialog (GtkWindow *parent)
|
|||||||
/* run the dialog */
|
/* run the dialog */
|
||||||
do {
|
do {
|
||||||
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) {
|
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) {
|
||||||
char *name;
|
const char *name;
|
||||||
|
const char *location;
|
||||||
|
|
||||||
name = gtk_entry_get_text (GTK_ENTRY (cal_name));
|
name = gtk_entry_get_text (GTK_ENTRY (cal_name));
|
||||||
|
location = gtk_entry_get_text (GTK_ENTRY (cal_location));
|
||||||
sl = g_slist_nth (groups, gtk_option_menu_get_history (GTK_OPTION_MENU (cal_group)));
|
sl = g_slist_nth (groups, gtk_option_menu_get_history (GTK_OPTION_MENU (cal_group)));
|
||||||
if (sl) {
|
if (sl) {
|
||||||
if (create_new_source_with_group (GTK_WINDOW (dialog),
|
if (create_new_source_with_group (GTK_WINDOW (dialog),
|
||||||
sl->data,
|
sl->data,
|
||||||
name))
|
name,
|
||||||
|
location))
|
||||||
retry = FALSE;
|
retry = FALSE;
|
||||||
} else {
|
} else {
|
||||||
e_notice (dialog, GTK_MESSAGE_ERROR,
|
e_notice (dialog, GTK_MESSAGE_ERROR,
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
|
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
|
||||||
|
|
||||||
<glade-interface>
|
<glade-interface>
|
||||||
<requires lib="gnome"/>
|
|
||||||
|
|
||||||
<widget class="GtkDialog" id="new-calendar-dialog">
|
<widget class="GtkDialog" id="new-calendar-dialog">
|
||||||
<property name="border_width">12</property>
|
<property name="border_width">12</property>
|
||||||
@ -61,7 +60,7 @@
|
|||||||
<child>
|
<child>
|
||||||
<widget class="GtkTable" id="table1">
|
<widget class="GtkTable" id="table1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="n_rows">3</property>
|
<property name="n_rows">4</property>
|
||||||
<property name="n_columns">3</property>
|
<property name="n_columns">3</property>
|
||||||
<property name="homogeneous">False</property>
|
<property name="homogeneous">False</property>
|
||||||
<property name="row_spacing">6</property>
|
<property name="row_spacing">6</property>
|
||||||
@ -92,31 +91,6 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
|
||||||
<widget class="GtkLabel" id="label3">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="label" translatable="yes">Calendar Name</property>
|
|
||||||
<property name="use_underline">False</property>
|
|
||||||
<property name="use_markup">False</property>
|
|
||||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
|
||||||
<property name="wrap">False</property>
|
|
||||||
<property name="selectable">False</property>
|
|
||||||
<property name="xalign">0</property>
|
|
||||||
<property name="yalign">0.5</property>
|
|
||||||
<property name="xpad">0</property>
|
|
||||||
<property name="ypad">0</property>
|
|
||||||
</widget>
|
|
||||||
<packing>
|
|
||||||
<property name="left_attach">1</property>
|
|
||||||
<property name="right_attach">2</property>
|
|
||||||
<property name="top_attach">2</property>
|
|
||||||
<property name="bottom_attach">3</property>
|
|
||||||
<property name="x_padding">6</property>
|
|
||||||
<property name="x_options">fill</property>
|
|
||||||
<property name="y_options"></property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkOptionMenu" id="calendar-group">
|
<widget class="GtkOptionMenu" id="calendar-group">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
@ -179,9 +153,81 @@
|
|||||||
<property name="y_options"></property>
|
<property name="y_options"></property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="label3">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes">Calendar Name</property>
|
||||||
|
<property name="use_underline">False</property>
|
||||||
|
<property name="use_markup">False</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||||
|
<property name="wrap">False</property>
|
||||||
|
<property name="selectable">False</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="right_attach">2</property>
|
||||||
|
<property name="top_attach">2</property>
|
||||||
|
<property name="bottom_attach">3</property>
|
||||||
|
<property name="x_padding">6</property>
|
||||||
|
<property name="x_options">fill</property>
|
||||||
|
<property name="y_options"></property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkLabel" id="calendar-source-label">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="label" translatable="yes">Calendar Location</property>
|
||||||
|
<property name="use_underline">False</property>
|
||||||
|
<property name="use_markup">False</property>
|
||||||
|
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||||
|
<property name="wrap">False</property>
|
||||||
|
<property name="selectable">False</property>
|
||||||
|
<property name="xalign">0</property>
|
||||||
|
<property name="yalign">0.5</property>
|
||||||
|
<property name="xpad">0</property>
|
||||||
|
<property name="ypad">0</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">1</property>
|
||||||
|
<property name="right_attach">2</property>
|
||||||
|
<property name="top_attach">3</property>
|
||||||
|
<property name="bottom_attach">4</property>
|
||||||
|
<property name="x_padding">6</property>
|
||||||
|
<property name="x_options">fill</property>
|
||||||
|
<property name="y_options"></property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkEntry" id="calendar-location">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="editable">True</property>
|
||||||
|
<property name="visibility">True</property>
|
||||||
|
<property name="max_length">0</property>
|
||||||
|
<property name="text" translatable="yes"></property>
|
||||||
|
<property name="has_frame">True</property>
|
||||||
|
<property name="invisible_char" translatable="yes">*</property>
|
||||||
|
<property name="activates_default">False</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="left_attach">2</property>
|
||||||
|
<property name="right_attach">3</property>
|
||||||
|
<property name="top_attach">3</property>
|
||||||
|
<property name="bottom_attach">4</property>
|
||||||
|
<property name="x_padding">6</property>
|
||||||
|
<property name="y_options"></property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="padding">0</property>
|
<property name="padding">4</property>
|
||||||
<property name="expand">True</property>
|
<property name="expand">True</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
</packing>
|
</packing>
|
||||||
|
|||||||
@ -38,7 +38,7 @@ $(CORBA_GENERATED_C): $(CORBA_GENERATED_H)
|
|||||||
pcsincludedir = $(privincludedir)/pcs
|
pcsincludedir = $(privincludedir)/pcs
|
||||||
|
|
||||||
privlib_LTLIBRARIES = libpcs.la
|
privlib_LTLIBRARIES = libpcs.la
|
||||||
noinst_LTLIBRARIES = libpcsfile.la
|
noinst_LTLIBRARIES = libpcsfile.la libpcshttp.la
|
||||||
|
|
||||||
pcsinclude_HEADERS = \
|
pcsinclude_HEADERS = \
|
||||||
$(CORBA_GENERATED_H) \
|
$(CORBA_GENERATED_H) \
|
||||||
@ -77,6 +77,13 @@ libpcsfile_la_SOURCES = \
|
|||||||
libpcsfile_la_LIBADD = \
|
libpcsfile_la_LIBADD = \
|
||||||
libpcs.la
|
libpcs.la
|
||||||
|
|
||||||
|
libpcshttp_la_SOURCES = \
|
||||||
|
cal-backend-http.c \
|
||||||
|
cal-backend-http.h
|
||||||
|
|
||||||
|
libpcshttp_la_LIBADD = \
|
||||||
|
libpcs.la
|
||||||
|
|
||||||
BUILT_SOURCES = $(CORBA_GENERATED)
|
BUILT_SOURCES = $(CORBA_GENERATED)
|
||||||
CLEANFILES = $(BUILT_SOURCES)
|
CLEANFILES = $(BUILT_SOURCES)
|
||||||
|
|
||||||
|
|||||||
621
calendar/pcs/cal-backend-http.c
Normal file
621
calendar/pcs/cal-backend-http.c
Normal file
@ -0,0 +1,621 @@
|
|||||||
|
/* Evolution calendar - iCalendar http backend
|
||||||
|
*
|
||||||
|
* Copyright (C) 2003 Novell, Inc.
|
||||||
|
*
|
||||||
|
* Authors: Hans Petter Jansson <hpj@ximian.com>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of version 2 of the GNU General Public
|
||||||
|
* License as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* Based in part on the file backend.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <bonobo/bonobo-exception.h>
|
||||||
|
#include <bonobo/bonobo-moniker-util.h>
|
||||||
|
#include <libgnome/gnome-i18n.h>
|
||||||
|
#include <libgnomevfs/gnome-vfs.h>
|
||||||
|
#include "e-util/e-xml-hash-utils.h"
|
||||||
|
#include "cal-util/cal-recur.h"
|
||||||
|
#include "cal-util/cal-util.h"
|
||||||
|
#include "cal-backend-http.h"
|
||||||
|
#include "cal-backend-file.h"
|
||||||
|
#include "cal-backend-util.h"
|
||||||
|
#include "cal-backend-object-sexp.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Private part of the CalBackendHttp structure */
|
||||||
|
struct _CalBackendHttpPrivate {
|
||||||
|
/* URI to get remote calendar data from */
|
||||||
|
char *uri;
|
||||||
|
|
||||||
|
/* Local/remote mode */
|
||||||
|
CalMode mode;
|
||||||
|
|
||||||
|
/* Cached-file backend */
|
||||||
|
CalBackendFile file_backend;
|
||||||
|
|
||||||
|
/* The calendar's default timezone, used for resolving DATE and
|
||||||
|
floating DATE-TIME values. */
|
||||||
|
icaltimezone *default_zone;
|
||||||
|
|
||||||
|
/* The list of live queries */
|
||||||
|
GList *queries;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void cal_backend_http_dispose (GObject *object);
|
||||||
|
static void cal_backend_http_finalize (GObject *object);
|
||||||
|
|
||||||
|
static CalBackendSyncClass *parent_class;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Dispose handler for the file backend */
|
||||||
|
static void
|
||||||
|
cal_backend_http_dispose (GObject *object)
|
||||||
|
{
|
||||||
|
CalBackendHttp *cbfile;
|
||||||
|
CalBackendHttpPrivate *priv;
|
||||||
|
|
||||||
|
cbfile = CAL_BACKEND_HTTP (object);
|
||||||
|
priv = cbfile->priv;
|
||||||
|
|
||||||
|
if (G_OBJECT_CLASS (parent_class)->dispose)
|
||||||
|
(* G_OBJECT_CLASS (parent_class)->dispose) (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Finalize handler for the file backend */
|
||||||
|
static void
|
||||||
|
cal_backend_http_finalize (GObject *object)
|
||||||
|
{
|
||||||
|
CalBackendHttp *cbfile;
|
||||||
|
CalBackendHttpPrivate *priv;
|
||||||
|
|
||||||
|
g_return_if_fail (object != NULL);
|
||||||
|
g_return_if_fail (IS_CAL_BACKEND_HTTP (object));
|
||||||
|
|
||||||
|
cbfile = CAL_BACKEND_HTTP (object);
|
||||||
|
priv = cbfile->priv;
|
||||||
|
|
||||||
|
/* Clean up */
|
||||||
|
|
||||||
|
if (priv->uri) {
|
||||||
|
g_free (priv->uri);
|
||||||
|
priv->uri = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_free (priv);
|
||||||
|
cbfile->priv = NULL;
|
||||||
|
|
||||||
|
if (G_OBJECT_CLASS (parent_class)->finalize)
|
||||||
|
(* G_OBJECT_CLASS (parent_class)->finalize) (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Calendar backend methods */
|
||||||
|
|
||||||
|
/* Is_read_only handler for the file backend */
|
||||||
|
static CalBackendSyncStatus
|
||||||
|
cal_backend_http_is_read_only (CalBackendSync *backend, Cal *cal, gboolean *read_only)
|
||||||
|
{
|
||||||
|
CalBackendHttp *cbfile = backend;
|
||||||
|
|
||||||
|
*read_only = TRUE;
|
||||||
|
|
||||||
|
return GNOME_Evolution_Calendar_Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get_email_address handler for the file backend */
|
||||||
|
static CalBackendSyncStatus
|
||||||
|
cal_backend_http_get_cal_address (CalBackendSync *backend, Cal *cal, char **address)
|
||||||
|
{
|
||||||
|
/* A file backend has no particular email address associated
|
||||||
|
* with it (although that would be a useful feature some day).
|
||||||
|
*/
|
||||||
|
*address = NULL;
|
||||||
|
|
||||||
|
return GNOME_Evolution_Calendar_Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
static CalBackendSyncStatus
|
||||||
|
cal_backend_http_get_ldap_attribute (CalBackendSync *backend, Cal *cal, char **attribute)
|
||||||
|
{
|
||||||
|
*attribute = NULL;
|
||||||
|
|
||||||
|
return GNOME_Evolution_Calendar_Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
static CalBackendSyncStatus
|
||||||
|
cal_backend_http_get_alarm_email_address (CalBackendSync *backend, Cal *cal, char **address)
|
||||||
|
{
|
||||||
|
/* A file backend has no particular email address associated
|
||||||
|
* with it (although that would be a useful feature some day).
|
||||||
|
*/
|
||||||
|
*address = NULL;
|
||||||
|
|
||||||
|
return GNOME_Evolution_Calendar_Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
static CalBackendSyncStatus
|
||||||
|
cal_backend_http_get_static_capabilities (CalBackendSync *backend, Cal *cal, char **capabilities)
|
||||||
|
{
|
||||||
|
*capabilities = CAL_STATIC_CAPABILITY_NO_EMAIL_ALARMS;
|
||||||
|
|
||||||
|
return GNOME_Evolution_Calendar_Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Open handler for the file backend */
|
||||||
|
static CalBackendSyncStatus
|
||||||
|
cal_backend_http_open (CalBackendSync *backend, Cal *cal, gboolean only_if_exists)
|
||||||
|
{
|
||||||
|
CalBackendHttp *cbfile;
|
||||||
|
CalBackendHttpPrivate *priv;
|
||||||
|
char *str_uri;
|
||||||
|
CalBackendSyncStatus status = GNOME_Evolution_Calendar_NoSuchCal;
|
||||||
|
|
||||||
|
cbfile = CAL_BACKEND_HTTP (backend);
|
||||||
|
priv = cbfile->priv;
|
||||||
|
|
||||||
|
g_message ("Open URI '%s'.", cal_backend_get_uri (CAL_BACKEND (cbfile)));
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
static CalBackendSyncStatus
|
||||||
|
cal_backend_http_remove (CalBackendSync *backend, Cal *cal)
|
||||||
|
{
|
||||||
|
CalBackendHttp *cbfile;
|
||||||
|
CalBackendHttpPrivate *priv;
|
||||||
|
char *str_uri;
|
||||||
|
|
||||||
|
cbfile = CAL_BACKEND_HTTP (backend);
|
||||||
|
priv = cbfile->priv;
|
||||||
|
|
||||||
|
return GNOME_Evolution_Calendar_OtherError;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* is_loaded handler for the file backend */
|
||||||
|
static gboolean
|
||||||
|
cal_backend_http_is_loaded (CalBackend *backend)
|
||||||
|
{
|
||||||
|
CalBackendHttp *cbfile;
|
||||||
|
CalBackendHttpPrivate *priv;
|
||||||
|
|
||||||
|
cbfile = CAL_BACKEND_HTTP (backend);
|
||||||
|
priv = cbfile->priv;
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* is_remote handler for the file backend */
|
||||||
|
static CalMode
|
||||||
|
cal_backend_http_get_mode (CalBackend *backend)
|
||||||
|
{
|
||||||
|
CalBackendHttp *cbfile;
|
||||||
|
CalBackendHttpPrivate *priv;
|
||||||
|
|
||||||
|
cbfile = CAL_BACKEND_HTTP (backend);
|
||||||
|
priv = cbfile->priv;
|
||||||
|
|
||||||
|
return priv->mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define cal_mode_to_corba(mode) \
|
||||||
|
(mode == CAL_MODE_LOCAL ? GNOME_Evolution_Calendar_MODE_LOCAL : \
|
||||||
|
mode == CAL_MODE_REMOTE ? GNOME_Evolution_Calendar_MODE_REMOTE : \
|
||||||
|
GNOME_Evolution_Calendar_MODE_ANY)
|
||||||
|
|
||||||
|
/* Set_mode handler for the file backend */
|
||||||
|
static void
|
||||||
|
cal_backend_http_set_mode (CalBackend *backend, CalMode mode)
|
||||||
|
{
|
||||||
|
CalBackendHttp *cbfile;
|
||||||
|
CalBackendHttpPrivate *priv;
|
||||||
|
GNOME_Evolution_Calendar_CalMode set_mode;
|
||||||
|
|
||||||
|
cbfile = CAL_BACKEND_HTTP (backend);
|
||||||
|
priv = cbfile->priv;
|
||||||
|
|
||||||
|
switch (mode) {
|
||||||
|
case CAL_MODE_LOCAL:
|
||||||
|
case CAL_MODE_REMOTE:
|
||||||
|
priv->mode = mode;
|
||||||
|
set_mode = cal_mode_to_corba (mode);
|
||||||
|
break;
|
||||||
|
case CAL_MODE_ANY:
|
||||||
|
priv->mode = CAL_MODE_REMOTE;
|
||||||
|
set_mode = GNOME_Evolution_Calendar_MODE_REMOTE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
set_mode = GNOME_Evolution_Calendar_MODE_ANY;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (set_mode == GNOME_Evolution_Calendar_MODE_ANY)
|
||||||
|
cal_backend_notify_mode (backend,
|
||||||
|
GNOME_Evolution_Calendar_Listener_MODE_NOT_SUPPORTED,
|
||||||
|
cal_mode_to_corba (priv->mode));
|
||||||
|
else
|
||||||
|
cal_backend_notify_mode (backend,
|
||||||
|
GNOME_Evolution_Calendar_Listener_MODE_SET,
|
||||||
|
set_mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
static CalBackendSyncStatus
|
||||||
|
cal_backend_http_get_default_object (CalBackendSync *backend, Cal *cal, char **object)
|
||||||
|
{
|
||||||
|
CalComponent *comp;
|
||||||
|
|
||||||
|
return GNOME_Evolution_Calendar_Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get_object_component handler for the file backend */
|
||||||
|
static CalBackendSyncStatus
|
||||||
|
cal_backend_http_get_object (CalBackendSync *backend, Cal *cal, const char *uid, const char *rid, char **object)
|
||||||
|
{
|
||||||
|
CalBackendHttp *cbfile;
|
||||||
|
CalBackendHttpPrivate *priv;
|
||||||
|
CalComponent *comp = NULL;
|
||||||
|
gboolean free_comp = FALSE;
|
||||||
|
|
||||||
|
cbfile = CAL_BACKEND_HTTP (backend);
|
||||||
|
priv = cbfile->priv;
|
||||||
|
|
||||||
|
g_return_val_if_fail (uid != NULL, GNOME_Evolution_Calendar_ObjectNotFound);
|
||||||
|
|
||||||
|
return GNOME_Evolution_Calendar_Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get_timezone_object handler for the file backend */
|
||||||
|
static CalBackendSyncStatus
|
||||||
|
cal_backend_http_get_timezone (CalBackendSync *backend, Cal *cal, const char *tzid, char **object)
|
||||||
|
{
|
||||||
|
CalBackendHttp *cbfile;
|
||||||
|
CalBackendHttpPrivate *priv;
|
||||||
|
icaltimezone *zone;
|
||||||
|
icalcomponent *icalcomp;
|
||||||
|
|
||||||
|
cbfile = CAL_BACKEND_HTTP (backend);
|
||||||
|
priv = cbfile->priv;
|
||||||
|
|
||||||
|
g_return_val_if_fail (tzid != NULL, GNOME_Evolution_Calendar_ObjectNotFound);
|
||||||
|
|
||||||
|
return GNOME_Evolution_Calendar_Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Add_timezone handler for the file backend */
|
||||||
|
static CalBackendSyncStatus
|
||||||
|
cal_backend_http_add_timezone (CalBackendSync *backend, Cal *cal, const char *tzobj)
|
||||||
|
{
|
||||||
|
icalcomponent *tz_comp;
|
||||||
|
CalBackendHttp *cbfile;
|
||||||
|
CalBackendHttpPrivate *priv;
|
||||||
|
|
||||||
|
cbfile = (CalBackendHttp *) backend;
|
||||||
|
|
||||||
|
g_return_val_if_fail (IS_CAL_BACKEND_HTTP (cbfile), GNOME_Evolution_Calendar_OtherError);
|
||||||
|
g_return_val_if_fail (tzobj != NULL, GNOME_Evolution_Calendar_OtherError);
|
||||||
|
|
||||||
|
priv = cbfile->priv;
|
||||||
|
|
||||||
|
return GNOME_Evolution_Calendar_Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
static CalBackendSyncStatus
|
||||||
|
cal_backend_http_set_default_timezone (CalBackendSync *backend, Cal *cal, const char *tzid)
|
||||||
|
{
|
||||||
|
CalBackendHttp *cbfile;
|
||||||
|
CalBackendHttpPrivate *priv;
|
||||||
|
icaltimezone *zone;
|
||||||
|
|
||||||
|
cbfile = CAL_BACKEND_HTTP (backend);
|
||||||
|
priv = cbfile->priv;
|
||||||
|
|
||||||
|
return GNOME_Evolution_Calendar_Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get_objects_in_range handler for the file backend */
|
||||||
|
static CalBackendSyncStatus
|
||||||
|
cal_backend_http_get_object_list (CalBackendSync *backend, Cal *cal, const char *sexp, GList **objects)
|
||||||
|
{
|
||||||
|
CalBackendHttp *cbfile;
|
||||||
|
CalBackendHttpPrivate *priv;
|
||||||
|
|
||||||
|
cbfile = CAL_BACKEND_HTTP (backend);
|
||||||
|
priv = cbfile->priv;
|
||||||
|
|
||||||
|
return GNOME_Evolution_Calendar_Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get_query handler for the file backend */
|
||||||
|
static void
|
||||||
|
cal_backend_http_start_query (CalBackend *backend, Query *query)
|
||||||
|
{
|
||||||
|
CalBackendHttp *cbfile;
|
||||||
|
CalBackendHttpPrivate *priv;
|
||||||
|
|
||||||
|
cbfile = CAL_BACKEND_HTTP (backend);
|
||||||
|
priv = cbfile->priv;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get_free_busy handler for the file backend */
|
||||||
|
static CalBackendSyncStatus
|
||||||
|
cal_backend_http_get_free_busy (CalBackendSync *backend, Cal *cal, GList *users,
|
||||||
|
time_t start, time_t end, GList **freebusy)
|
||||||
|
{
|
||||||
|
CalBackendHttp *cbfile;
|
||||||
|
CalBackendHttpPrivate *priv;
|
||||||
|
gchar *address, *name;
|
||||||
|
icalcomponent *vfb;
|
||||||
|
char *calobj;
|
||||||
|
GList *l;
|
||||||
|
|
||||||
|
cbfile = CAL_BACKEND_HTTP (backend);
|
||||||
|
priv = cbfile->priv;
|
||||||
|
|
||||||
|
g_return_val_if_fail (start != -1 && end != -1, GNOME_Evolution_Calendar_InvalidRange);
|
||||||
|
g_return_val_if_fail (start <= end, GNOME_Evolution_Calendar_InvalidRange);
|
||||||
|
|
||||||
|
return GNOME_Evolution_Calendar_Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Get_changes handler for the file backend */
|
||||||
|
static CalBackendSyncStatus
|
||||||
|
cal_backend_http_get_changes (CalBackendSync *backend, Cal *cal, const char *change_id,
|
||||||
|
GList **adds, GList **modifies, GList **deletes)
|
||||||
|
{
|
||||||
|
CalBackendHttp *cbfile;
|
||||||
|
CalBackendHttpPrivate *priv;
|
||||||
|
|
||||||
|
cbfile = CAL_BACKEND_HTTP (backend);
|
||||||
|
priv = cbfile->priv;
|
||||||
|
|
||||||
|
g_return_val_if_fail (change_id != NULL, GNOME_Evolution_Calendar_ObjectNotFound);
|
||||||
|
|
||||||
|
return GNOME_Evolution_Calendar_Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Discard_alarm handler for the file backend */
|
||||||
|
static CalBackendSyncStatus
|
||||||
|
cal_backend_http_discard_alarm (CalBackendSync *backend, Cal *cal, const char *uid, const char *auid)
|
||||||
|
{
|
||||||
|
/* we just do nothing with the alarm */
|
||||||
|
return GNOME_Evolution_Calendar_Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
static CalBackendSyncStatus
|
||||||
|
cal_backend_http_create_object (CalBackendSync *backend, Cal *cal, const char *calobj, char **uid)
|
||||||
|
{
|
||||||
|
CalBackendHttp *cbfile;
|
||||||
|
CalBackendHttpPrivate *priv;
|
||||||
|
icalcomponent *icalcomp;
|
||||||
|
icalcomponent_kind kind;
|
||||||
|
CalComponent *comp;
|
||||||
|
const char *comp_uid;
|
||||||
|
struct icaltimetype current;
|
||||||
|
|
||||||
|
cbfile = CAL_BACKEND_HTTP (backend);
|
||||||
|
priv = cbfile->priv;
|
||||||
|
|
||||||
|
g_return_val_if_fail (calobj != NULL, GNOME_Evolution_Calendar_ObjectNotFound);
|
||||||
|
|
||||||
|
return GNOME_Evolution_Calendar_Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
static CalBackendSyncStatus
|
||||||
|
cal_backend_http_modify_object (CalBackendSync *backend, Cal *cal, const char *calobj,
|
||||||
|
CalObjModType mod, char **old_object)
|
||||||
|
{
|
||||||
|
CalBackendHttp *cbfile;
|
||||||
|
CalBackendHttpPrivate *priv;
|
||||||
|
icalcomponent *icalcomp;
|
||||||
|
icalcomponent_kind kind;
|
||||||
|
const char *comp_uid;
|
||||||
|
CalComponent *comp;
|
||||||
|
struct icaltimetype current;
|
||||||
|
|
||||||
|
cbfile = CAL_BACKEND_HTTP (backend);
|
||||||
|
priv = cbfile->priv;
|
||||||
|
|
||||||
|
g_return_val_if_fail (calobj != NULL, GNOME_Evolution_Calendar_ObjectNotFound);
|
||||||
|
|
||||||
|
return GNOME_Evolution_Calendar_Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Remove_object handler for the file backend */
|
||||||
|
static CalBackendSyncStatus
|
||||||
|
cal_backend_http_remove_object (CalBackendSync *backend, Cal *cal,
|
||||||
|
const char *uid, const char *rid,
|
||||||
|
CalObjModType mod, char **object)
|
||||||
|
{
|
||||||
|
CalBackendHttp *cbfile;
|
||||||
|
CalBackendHttpPrivate *priv;
|
||||||
|
CalComponent *comp;
|
||||||
|
char *hash_rid;
|
||||||
|
GSList *categories;
|
||||||
|
|
||||||
|
cbfile = CAL_BACKEND_HTTP (backend);
|
||||||
|
priv = cbfile->priv;
|
||||||
|
|
||||||
|
g_return_val_if_fail (uid != NULL, GNOME_Evolution_Calendar_ObjectNotFound);
|
||||||
|
|
||||||
|
return GNOME_Evolution_Calendar_Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Update_objects handler for the file backend. */
|
||||||
|
static CalBackendSyncStatus
|
||||||
|
cal_backend_http_receive_objects (CalBackendSync *backend, Cal *cal, const char *calobj)
|
||||||
|
{
|
||||||
|
CalBackendHttp *cbfile;
|
||||||
|
CalBackendHttpPrivate *priv;
|
||||||
|
icalcomponent *toplevel_comp, *icalcomp = NULL;
|
||||||
|
icalcomponent_kind kind;
|
||||||
|
icalproperty_method method;
|
||||||
|
icalcomponent *subcomp;
|
||||||
|
GList *comps, *l;
|
||||||
|
CalBackendSyncStatus status = GNOME_Evolution_Calendar_Success;
|
||||||
|
|
||||||
|
cbfile = CAL_BACKEND_HTTP (backend);
|
||||||
|
priv = cbfile->priv;
|
||||||
|
|
||||||
|
g_return_val_if_fail (calobj != NULL, GNOME_Evolution_Calendar_InvalidObject);
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
static CalBackendSyncStatus
|
||||||
|
cal_backend_http_send_objects (CalBackendSync *backend, Cal *cal, const char *calobj)
|
||||||
|
{
|
||||||
|
/* FIXME Put in a util routine to send stuff via email */
|
||||||
|
|
||||||
|
return GNOME_Evolution_Calendar_Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
static icaltimezone *
|
||||||
|
cal_backend_http_internal_get_default_timezone (CalBackend *backend)
|
||||||
|
{
|
||||||
|
CalBackendHttp *cbfile;
|
||||||
|
CalBackendHttpPrivate *priv;
|
||||||
|
|
||||||
|
cbfile = CAL_BACKEND_HTTP (backend);
|
||||||
|
priv = cbfile->priv;
|
||||||
|
|
||||||
|
|
||||||
|
return priv->default_zone;
|
||||||
|
}
|
||||||
|
|
||||||
|
static icaltimezone *
|
||||||
|
cal_backend_http_internal_get_timezone (CalBackend *backend, const char *tzid)
|
||||||
|
{
|
||||||
|
CalBackendHttp *cbfile;
|
||||||
|
CalBackendHttpPrivate *priv;
|
||||||
|
icaltimezone *zone;
|
||||||
|
|
||||||
|
cbfile = CAL_BACKEND_HTTP (backend);
|
||||||
|
priv = cbfile->priv;
|
||||||
|
|
||||||
|
if (!strcmp (tzid, "UTC"))
|
||||||
|
zone = icaltimezone_get_utc_timezone ();
|
||||||
|
else {
|
||||||
|
zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
|
||||||
|
}
|
||||||
|
|
||||||
|
return zone;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Object initialization function for the file backend */
|
||||||
|
static void
|
||||||
|
cal_backend_http_init (CalBackendHttp *cbfile, CalBackendHttpClass *class)
|
||||||
|
{
|
||||||
|
CalBackendHttpPrivate *priv;
|
||||||
|
|
||||||
|
g_message ("Webcal backend init.");
|
||||||
|
|
||||||
|
priv = g_new0 (CalBackendHttpPrivate, 1);
|
||||||
|
cbfile->priv = priv;
|
||||||
|
|
||||||
|
priv->uri = NULL;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
priv->config_listener = e_config_listener_new ();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Class initialization function for the file backend */
|
||||||
|
static void
|
||||||
|
cal_backend_http_class_init (CalBackendHttpClass *class)
|
||||||
|
{
|
||||||
|
GObjectClass *object_class;
|
||||||
|
CalBackendClass *backend_class;
|
||||||
|
CalBackendSyncClass *sync_class;
|
||||||
|
|
||||||
|
object_class = (GObjectClass *) class;
|
||||||
|
backend_class = (CalBackendClass *) class;
|
||||||
|
sync_class = (CalBackendSyncClass *) class;
|
||||||
|
|
||||||
|
parent_class = (CalBackendSyncClass *) g_type_class_peek_parent (class);
|
||||||
|
|
||||||
|
object_class->dispose = cal_backend_http_dispose;
|
||||||
|
object_class->finalize = cal_backend_http_finalize;
|
||||||
|
|
||||||
|
sync_class->is_read_only_sync = cal_backend_http_is_read_only;
|
||||||
|
sync_class->get_cal_address_sync = cal_backend_http_get_cal_address;
|
||||||
|
sync_class->get_alarm_email_address_sync = cal_backend_http_get_alarm_email_address;
|
||||||
|
sync_class->get_ldap_attribute_sync = cal_backend_http_get_ldap_attribute;
|
||||||
|
sync_class->get_static_capabilities_sync = cal_backend_http_get_static_capabilities;
|
||||||
|
sync_class->open_sync = cal_backend_http_open;
|
||||||
|
sync_class->remove_sync = cal_backend_http_remove;
|
||||||
|
sync_class->create_object_sync = cal_backend_http_create_object;
|
||||||
|
sync_class->modify_object_sync = cal_backend_http_modify_object;
|
||||||
|
sync_class->remove_object_sync = cal_backend_http_remove_object;
|
||||||
|
sync_class->discard_alarm_sync = cal_backend_http_discard_alarm;
|
||||||
|
sync_class->receive_objects_sync = cal_backend_http_receive_objects;
|
||||||
|
sync_class->send_objects_sync = cal_backend_http_send_objects;
|
||||||
|
sync_class->get_default_object_sync = cal_backend_http_get_default_object;
|
||||||
|
sync_class->get_object_sync = cal_backend_http_get_object;
|
||||||
|
sync_class->get_object_list_sync = cal_backend_http_get_object_list;
|
||||||
|
sync_class->get_timezone_sync = cal_backend_http_get_timezone;
|
||||||
|
sync_class->add_timezone_sync = cal_backend_http_add_timezone;
|
||||||
|
sync_class->set_default_timezone_sync = cal_backend_http_set_default_timezone;
|
||||||
|
sync_class->get_freebusy_sync = cal_backend_http_get_free_busy;
|
||||||
|
sync_class->get_changes_sync = cal_backend_http_get_changes;
|
||||||
|
|
||||||
|
backend_class->is_loaded = cal_backend_http_is_loaded;
|
||||||
|
backend_class->start_query = cal_backend_http_start_query;
|
||||||
|
backend_class->get_mode = cal_backend_http_get_mode;
|
||||||
|
backend_class->set_mode = cal_backend_http_set_mode;
|
||||||
|
|
||||||
|
backend_class->internal_get_default_timezone = cal_backend_http_internal_get_default_timezone;
|
||||||
|
backend_class->internal_get_timezone = cal_backend_http_internal_get_timezone;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cal_backend_http_get_type:
|
||||||
|
* @void:
|
||||||
|
*
|
||||||
|
* Registers the #CalBackendHttp class if necessary, and returns the type ID
|
||||||
|
* associated to it.
|
||||||
|
*
|
||||||
|
* Return value: The type ID of the #CalBackendHttp class.
|
||||||
|
**/
|
||||||
|
GType
|
||||||
|
cal_backend_http_get_type (void)
|
||||||
|
{
|
||||||
|
static GType cal_backend_http_type = 0;
|
||||||
|
|
||||||
|
g_message (G_STRLOC);
|
||||||
|
|
||||||
|
if (!cal_backend_http_type) {
|
||||||
|
static GTypeInfo info = {
|
||||||
|
sizeof (CalBackendHttpClass),
|
||||||
|
(GBaseInitFunc) NULL,
|
||||||
|
(GBaseFinalizeFunc) NULL,
|
||||||
|
(GClassInitFunc) cal_backend_http_class_init,
|
||||||
|
NULL, NULL,
|
||||||
|
sizeof (CalBackendHttp),
|
||||||
|
0,
|
||||||
|
(GInstanceInitFunc) cal_backend_http_init
|
||||||
|
};
|
||||||
|
cal_backend_http_type = g_type_register_static (CAL_TYPE_BACKEND_SYNC,
|
||||||
|
"CalBackendHttp", &info, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return cal_backend_http_type;
|
||||||
|
}
|
||||||
61
calendar/pcs/cal-backend-http.h
Normal file
61
calendar/pcs/cal-backend-http.h
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
/* Evolution calendar - iCalendar file backend
|
||||||
|
*
|
||||||
|
* Copyright (C) 2000 Ximian, Inc.
|
||||||
|
* Copyright (C) 2000 Ximian, Inc.
|
||||||
|
*
|
||||||
|
* Author: Federico Mena-Quintero <federico@ximian.com>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of version 2 of the GNU General Public
|
||||||
|
* License as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* 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 General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CAL_BACKEND_HTTP_H
|
||||||
|
#define CAL_BACKEND_HTTP_H
|
||||||
|
|
||||||
|
#include "pcs/cal-backend-sync.h"
|
||||||
|
|
||||||
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define CAL_BACKEND_HTTP_TYPE (cal_backend_http_get_type ())
|
||||||
|
#define CAL_BACKEND_HTTP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAL_BACKEND_HTTP_TYPE, \
|
||||||
|
CalBackendHttp))
|
||||||
|
#define CAL_BACKEND_HTTP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CAL_BACKEND_HTTP_TYPE, \
|
||||||
|
CalBackendHttpClass))
|
||||||
|
#define IS_CAL_BACKEND_HTTP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAL_BACKEND_HTTP_TYPE))
|
||||||
|
#define IS_CAL_BACKEND_HTTP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CAL_BACKEND_HTTP_TYPE))
|
||||||
|
|
||||||
|
typedef struct _CalBackendHttp CalBackendHttp;
|
||||||
|
typedef struct _CalBackendHttpClass CalBackendHttpClass;
|
||||||
|
|
||||||
|
typedef struct _CalBackendHttpPrivate CalBackendHttpPrivate;
|
||||||
|
|
||||||
|
struct _CalBackendHttp {
|
||||||
|
CalBackendSync backend;
|
||||||
|
|
||||||
|
/* Private data */
|
||||||
|
CalBackendHttpPrivate *priv;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _CalBackendHttpClass {
|
||||||
|
CalBackendSyncClass parent_class;
|
||||||
|
};
|
||||||
|
|
||||||
|
GType cal_backend_http_get_type (void);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
G_END_DECLS
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user