aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@ximian.com>2001-10-04 02:03:14 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2001-10-04 02:03:14 +0800
commit967083749da817df0ea296343528361c3564a798 (patch)
tree669a3acc0d27852b72a3a5de34446e8ad8d6806b
parent6726c35ab5c59ac587a3347117b86e91e8655337 (diff)
downloadgsoc2013-evolution-967083749da817df0ea296343528361c3564a798.tar.gz
gsoc2013-evolution-967083749da817df0ea296343528361c3564a798.tar.zst
gsoc2013-evolution-967083749da817df0ea296343528361c3564a798.zip
replace use of gnome_vfs_uri with e_uri
2001-10-03 Rodrigo Moya <rodrigo@ximian.com> * gui/component-factory.c: * gui/calendar-offline-handler.c: * gui/comp-editor-factory.c: replace use of gnome_vfs_uri with e_uri * gui/e-meeting-model.c (start_addressbook_server): make it return void, since the return value does not mind * pcs/cal.c: * pcs/cal-factory.c: * pcs/cal-backend.[ch]: don't use GnomeVFS for URI management * pcs/cal-backend-file.c: ditto, only use GnomeVFS for internal operations * cal-client/cal-client.c (cal_client_open_calendar): don't CORBA_exception_free before checking for exceptions svn path=/trunk/; revision=13380
-rw-r--r--calendar/ChangeLog19
-rw-r--r--calendar/cal-client/cal-client.c2
-rw-r--r--calendar/gui/calendar-offline-handler.c15
-rw-r--r--calendar/gui/comp-editor-factory.c39
-rw-r--r--calendar/gui/e-meeting-model.c2
-rw-r--r--calendar/gui/gnome-cal.c11
-rw-r--r--calendar/pcs/cal-backend-file.c65
-rw-r--r--calendar/pcs/cal-backend.c10
-rw-r--r--calendar/pcs/cal-backend.h9
-rw-r--r--calendar/pcs/cal-factory.c90
-rw-r--r--calendar/pcs/cal.c7
11 files changed, 144 insertions, 125 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 429afe6895..1fd576ddb3 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,22 @@
+2001-10-03 Rodrigo Moya <rodrigo@ximian.com>
+
+ * gui/component-factory.c:
+ * gui/calendar-offline-handler.c:
+ * gui/comp-editor-factory.c: replace use of gnome_vfs_uri with e_uri
+
+ * gui/e-meeting-model.c (start_addressbook_server): make it return void,
+ since the return value does not mind
+
+ * pcs/cal.c:
+ * pcs/cal-factory.c:
+ * pcs/cal-backend.[ch]: don't use GnomeVFS for URI management
+
+ * pcs/cal-backend-file.c: ditto, only use GnomeVFS for internal
+ operations
+
+ * cal-client/cal-client.c (cal_client_open_calendar): don't CORBA_exception_free
+ before checking for exceptions
+
2001-10-03 Christopher James Lahey <clahey@ximian.com>
* gui/e-calendar-table.etspec: Added priorities to a bunch of
diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c
index bea4ed6eea..e64c7dc688 100644
--- a/calendar/cal-client/cal-client.c
+++ b/calendar/cal-client/cal-client.c
@@ -759,8 +759,6 @@ cal_client_open_calendar (CalClient *client, const char *str_uri, gboolean only_
corba_listener, &ev);
if (!BONOBO_EX (&ev))
break;
-
- CORBA_exception_free (&ev);
}
if (BONOBO_EX (&ev)) {
diff --git a/calendar/gui/calendar-offline-handler.c b/calendar/gui/calendar-offline-handler.c
index e804bc8040..53db8f46e5 100644
--- a/calendar/gui/calendar-offline-handler.c
+++ b/calendar/gui/calendar-offline-handler.c
@@ -30,9 +30,8 @@
#include <gtk/gtkmain.h>
#include <gtk/gtksignal.h>
#include <bonobo/bonobo-exception.h>
-#include <libgnomevfs/gnome-vfs-types.h>
-#include <libgnomevfs/gnome-vfs-uri.h>
#include <gal/util/e-util.h>
+#include "e-util/e-url.h"
#include <cal-client/cal-client.h>
#include "calendar-offline-handler.h"
@@ -50,18 +49,16 @@ struct _CalendarOfflineHandlerPrivate {
static void
add_connection (gpointer data, gpointer user_data)
{
- GnomeVFSURI *uri = gnome_vfs_uri_new (data);
+ EUri *uri = e_uri_new (data);
GNOME_Evolution_ConnectionList *list = user_data;
g_return_if_fail (uri != NULL);
- list->_buffer[list->_length].hostName
- = CORBA_string_dup (gnome_vfs_uri_get_host_name (uri));
- list->_buffer[list->_length].type
- = CORBA_string_dup (gnome_vfs_uri_get_scheme (uri));
+ list->_buffer[list->_length].hostName = CORBA_string_dup (uri->host);
+ list->_buffer[list->_length].type = CORBA_string_dup (uri->protocol);
list->_length++;
- gnome_vfs_uri_unref (uri);
+ e_uri_free (uri);
}
static GNOME_Evolution_ConnectionList *
@@ -72,7 +69,7 @@ create_connection_list (CalendarOfflineHandler *offline_handler)
GList *uris;
priv = offline_handler->priv;
-
+
uris = cal_client_uri_list (priv->client, CAL_MODE_REMOTE);
list = GNOME_Evolution_ConnectionList__alloc ();
diff --git a/calendar/gui/comp-editor-factory.c b/calendar/gui/comp-editor-factory.c
index 7d1bfaff2d..2c74649647 100644
--- a/calendar/gui/comp-editor-factory.c
+++ b/calendar/gui/comp-editor-factory.c
@@ -23,7 +23,7 @@
#include <config.h>
#endif
-#include <libgnomevfs/gnome-vfs.h>
+#include <e-util/e-url.h>
#include <cal-client/cal-client.h>
#include "calendar-config.h"
#include "comp-editor-factory.h"
@@ -59,7 +59,7 @@ typedef struct {
CompEditorFactory *factory;
/* Uri of the calendar, used as key in the clients hash table */
- GnomeVFSURI *uri;
+ char *uri;
/* Client of the calendar */
CalClient *client;
@@ -106,7 +106,7 @@ static void impl_editExisting (PortableServer_Servant servant,
const GNOME_Evolution_Calendar_CalObjUID uid,
CORBA_Environment *ev);
static void impl_editNew (PortableServer_Servant servant,
- const CORBA_char *uri,
+ const CORBA_char *str_uri,
const GNOME_Evolution_Calendar_CalObjType type,
CORBA_Environment *ev);
@@ -144,7 +144,7 @@ comp_editor_factory_init (CompEditorFactory *factory)
priv = g_new (CompEditorFactoryPrivate, 1);
factory->priv = priv;
- priv->uri_client_hash = g_hash_table_new (gnome_vfs_uri_hash, gnome_vfs_uri_hequal);
+ priv->uri_client_hash = g_hash_table_new (g_str_hash, g_str_equal);
}
/* Used from g_hash_table_foreach(); frees a component structure */
@@ -182,7 +182,7 @@ free_client (OpenClient *oc)
{
GSList *l;
- gnome_vfs_uri_unref (oc->uri);
+ g_free (oc->uri);
oc->uri = NULL;
gtk_object_unref (GTK_OBJECT (oc->client));
@@ -494,12 +494,11 @@ cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer data)
* open request.
*/
static OpenClient *
-open_client (CompEditorFactory *factory, GnomeVFSURI *uri)
+open_client (CompEditorFactory *factory, const char *uristr)
{
CompEditorFactoryPrivate *priv;
CalClient *client;
OpenClient *oc;
- char *str_uri;
priv = factory->priv;
@@ -510,8 +509,7 @@ open_client (CompEditorFactory *factory, GnomeVFSURI *uri)
oc = g_new (OpenClient, 1);
oc->factory = factory;
- gnome_vfs_uri_ref (uri);
- oc->uri = uri;
+ oc->uri = g_strdup (uristr);
oc->client = client;
oc->uid_comp_hash = g_hash_table_new (g_str_hash, g_str_equal);
@@ -521,18 +519,14 @@ open_client (CompEditorFactory *factory, GnomeVFSURI *uri)
gtk_signal_connect (GTK_OBJECT (oc->client), "cal_opened",
GTK_SIGNAL_FUNC (cal_opened_cb), oc);
- str_uri = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
-
- if (!cal_client_open_calendar (oc->client, str_uri, FALSE)) {
- g_free (str_uri);
- gnome_vfs_uri_unref (oc->uri);
+ if (!cal_client_open_calendar (oc->client, uristr, FALSE)) {
+ g_free (oc->uri);
gtk_object_unref (GTK_OBJECT (oc->client));
g_hash_table_destroy (oc->uid_comp_hash);
g_free (oc);
return NULL;
}
- g_free (str_uri);
g_hash_table_insert (priv->uri_client_hash, oc->uri, oc);
@@ -546,27 +540,26 @@ static OpenClient *
lookup_open_client (CompEditorFactory *factory, const char *str_uri, CORBA_Environment *ev)
{
CompEditorFactoryPrivate *priv;
- GnomeVFSURI *uri;
OpenClient *oc;
+ EUri *uri;
priv = factory->priv;
/* Look up the client */
- uri = gnome_vfs_uri_new (str_uri);
+ uri = e_uri_new (str_uri);
if (!uri) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_GNOME_Evolution_Calendar_CompEditorFactory_InvalidURI,
NULL);
return NULL;
}
+ e_uri_free (uri);
- oc = g_hash_table_lookup (priv->uri_client_hash, uri);
+ oc = g_hash_table_lookup (priv->uri_client_hash, str_uri);
if (!oc) {
- oc = open_client (factory, uri);
+ oc = open_client (factory, str_uri);
if (!oc) {
- gnome_vfs_uri_unref (uri);
-
CORBA_exception_set (
ev, CORBA_USER_EXCEPTION,
ex_GNOME_Evolution_Calendar_CompEditorFactory_BackendContactError,
@@ -575,8 +568,6 @@ lookup_open_client (CompEditorFactory *factory, const char *str_uri, CORBA_Envir
}
}
- gnome_vfs_uri_unref (uri);
-
return oc;
}
@@ -700,3 +691,5 @@ comp_editor_factory_new (void)
{
return gtk_type_new (TYPE_COMP_EDITOR_FACTORY);
}
+
+
diff --git a/calendar/gui/e-meeting-model.c b/calendar/gui/e-meeting-model.c
index a545c0bbf9..712406d9e1 100644
--- a/calendar/gui/e-meeting-model.c
+++ b/calendar/gui/e-meeting-model.c
@@ -147,7 +147,7 @@ book_open_cb (EBook *book, EBookStatus status, gpointer data)
}
}
-static int
+static void
start_addressbook_server (EMeetingModel *im)
{
EMeetingModelPrivate *priv;
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 44bf54ec61..d220db17dd 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -35,11 +35,10 @@
#include <libgnome/gnome-util.h>
#include <libgnomeui/gnome-dialog.h>
#include <libgnomeui/gnome-dialog-util.h>
-#include <libgnomevfs/gnome-vfs-types.h>
-#include <libgnomevfs/gnome-vfs-uri.h>
#include <liboaf/liboaf.h>
#include <gal/e-paned/e-hpaned.h>
#include <gal/e-paned/e-vpaned.h>
+#include "e-util/e-url.h"
#include <cal-util/timeutil.h>
#include "widgets/menus/gal-view-menus.h"
#include "dialogs/event-editor.h"
@@ -1657,7 +1656,7 @@ gnome_calendar_open (GnomeCalendar *gcal, const char *str_uri)
GnomeCalendarPrivate *priv;
char *tasks_uri;
gboolean success;
- GnomeVFSURI *uri;
+ EUri *uri;
g_return_val_if_fail (gcal != NULL, FALSE);
g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), FALSE);
@@ -1682,7 +1681,7 @@ gnome_calendar_open (GnomeCalendar *gcal, const char *str_uri)
/* Open the appropriate Tasks folder to show in the TaskPad */
- uri = gnome_vfs_uri_new_private (str_uri, TRUE, TRUE, TRUE);
+ uri = e_uri_new (str_uri);
if (!uri) {
tasks_uri = g_strdup_printf ("%s/local/Tasks/tasks.ics", evolution_dir);
success = cal_client_open_calendar (priv->task_pad_client, tasks_uri, FALSE);
@@ -1691,7 +1690,7 @@ gnome_calendar_open (GnomeCalendar *gcal, const char *str_uri)
g_free (tasks_uri);
}
else {
- if (!g_strcasecmp (uri->method_string, "file")) {
+ if (!g_strncasecmp (uri->protocol, "file", 4)) {
tasks_uri = g_strdup_printf ("%s/local/Tasks/tasks.ics", evolution_dir);
success = cal_client_open_calendar (priv->task_pad_client, tasks_uri, FALSE);
@@ -1719,7 +1718,7 @@ gnome_calendar_open (GnomeCalendar *gcal, const char *str_uri)
success = TRUE;
}
- gnome_vfs_uri_unref (uri);
+ e_uri_free (uri);
}
if (!success) {
diff --git a/calendar/pcs/cal-backend-file.c b/calendar/pcs/cal-backend-file.c
index 3f0c73dc99..bb70686ce2 100644
--- a/calendar/pcs/cal-backend-file.c
+++ b/calendar/pcs/cal-backend-file.c
@@ -3,7 +3,8 @@
* Copyright (C) 2000 Ximian, Inc.
* Copyright (C) 2000 Ximian, Inc.
*
- * Author: Federico Mena-Quintero <federico@ximian.com>
+ * Authors: Federico Mena-Quintero <federico@ximian.com>
+ * Rodrigo Moya <rodrigo@ximian.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,6 +26,7 @@
#include <bonobo/bonobo-exception.h>
#include <bonobo/bonobo-moniker-util.h>
#include <bonobo-conf/bonobo-config-database.h>
+#include <libgnomevfs/gnome-vfs.h>
#include "e-util/e-dbhash.h"
#include "cal-util/cal-recur.h"
#include "cal-util/cal-util.h"
@@ -45,7 +47,7 @@ typedef struct {
/* Private part of the CalBackendFile structure */
struct _CalBackendFilePrivate {
/* URI where the calendar data is stored */
- GnomeVFSURI *uri;
+ char *uri;
/* List of Cal objects with their listeners */
GList *clients;
@@ -86,8 +88,9 @@ static void cal_backend_file_class_init (CalBackendFileClass *class);
static void cal_backend_file_init (CalBackendFile *cbfile);
static void cal_backend_file_destroy (GtkObject *object);
-static GnomeVFSURI *cal_backend_file_get_uri (CalBackend *backend);
-static CalBackendOpenStatus cal_backend_file_open (CalBackend *backend, GnomeVFSURI *uri,
+static const char *cal_backend_file_get_uri (CalBackend *backend);
+static CalBackendOpenStatus cal_backend_file_open (CalBackend *backend,
+ const char *uristr,
gboolean only_if_exists);
static gboolean cal_backend_file_is_loaded (CalBackend *backend);
@@ -254,6 +257,7 @@ static void
save (CalBackendFile *cbfile)
{
CalBackendFilePrivate *priv;
+ GnomeVFSURI *uri;
GnomeVFSHandle *handle = NULL;
GnomeVFSResult result;
GnomeVFSFileSize out;
@@ -264,8 +268,10 @@ save (CalBackendFile *cbfile)
g_assert (priv->uri != NULL);
g_assert (priv->icalcomp != NULL);
+ uri = gnome_vfs_uri_new (priv->uri);
+
/* Make a backup copy of the file if it exists */
- tmp = gnome_vfs_uri_to_string (priv->uri, GNOME_VFS_URI_HIDE_NONE);
+ tmp = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
if (tmp) {
GnomeVFSURI *backup_uri;
gchar *backup_uristr;
@@ -273,7 +279,7 @@ save (CalBackendFile *cbfile)
backup_uristr = g_strconcat (tmp, "~", NULL);
backup_uri = gnome_vfs_uri_new (backup_uristr);
- result = gnome_vfs_move_uri (priv->uri, backup_uri, TRUE);
+ result = gnome_vfs_move_uri (uri, backup_uri, TRUE);
gnome_vfs_uri_unref (backup_uri);
g_free (tmp);
@@ -281,7 +287,7 @@ save (CalBackendFile *cbfile)
}
/* Now write the new file out */
- result = gnome_vfs_create_uri (&handle, priv->uri,
+ result = gnome_vfs_create_uri (&handle, uri,
GNOME_VFS_OPEN_WRITE,
FALSE, 0666);
@@ -295,6 +301,7 @@ save (CalBackendFile *cbfile)
goto error;
gnome_vfs_close (handle);
+ gnome_vfs_uri_unref (uri);
return;
@@ -342,7 +349,7 @@ cal_backend_file_destroy (GtkObject *object)
/* Clean up */
if (priv->uri) {
- gnome_vfs_uri_unref (priv->uri);
+ g_free (priv->uri);
priv->uri = NULL;
}
@@ -404,7 +411,7 @@ lookup_component (CalBackendFile *cbfile, const char *uid)
/* Calendar backend methods */
/* Get_uri handler for the file backend */
-static GnomeVFSURI *
+static const char *
cal_backend_file_get_uri (CalBackend *backend)
{
CalBackendFile *cbfile;
@@ -416,7 +423,7 @@ cal_backend_file_get_uri (CalBackend *backend)
g_return_val_if_fail (priv->icalcomp != NULL, NULL);
g_assert (priv->uri != NULL);
- return priv->uri;
+ return (const char *) priv->uri;
}
/* Used from g_hash_table_foreach(), adds a category name to the sequence */
@@ -768,7 +775,7 @@ parse_file (FILE *file)
/* Parses an open iCalendar file and loads it into the backend */
static CalBackendOpenStatus
-open_cal (CalBackendFile *cbfile, GnomeVFSURI *uri, FILE *file)
+open_cal (CalBackendFile *cbfile, const char *uristr, FILE *file)
{
CalBackendFilePrivate *priv;
icalcomponent *icalcomp;
@@ -801,14 +808,13 @@ open_cal (CalBackendFile *cbfile, GnomeVFSURI *uri, FILE *file)
priv->comp_uid_hash = g_hash_table_new (g_str_hash, g_str_equal);
scan_vcalendar (cbfile);
- gnome_vfs_uri_ref (uri);
- priv->uri = uri;
+ priv->uri = g_strdup (uristr);
return CAL_BACKEND_OPEN_SUCCESS;
}
static CalBackendOpenStatus
-create_cal (CalBackendFile *cbfile, GnomeVFSURI *uri)
+create_cal (CalBackendFile *cbfile, const char *uristr)
{
CalBackendFilePrivate *priv;
@@ -820,8 +826,7 @@ create_cal (CalBackendFile *cbfile, GnomeVFSURI *uri)
/* Create our internal data */
priv->comp_uid_hash = g_hash_table_new (g_str_hash, g_str_equal);
- gnome_vfs_uri_ref (uri);
- priv->uri = uri;
+ priv->uri = g_strdup (uristr);
mark_dirty (cbfile);
@@ -830,12 +835,14 @@ create_cal (CalBackendFile *cbfile, GnomeVFSURI *uri)
/* Open handler for the file backend */
static CalBackendOpenStatus
-cal_backend_file_open (CalBackend *backend, GnomeVFSURI *uri, gboolean only_if_exists)
+cal_backend_file_open (CalBackend *backend, const char *uristr, gboolean only_if_exists)
{
CalBackendFile *cbfile;
CalBackendFilePrivate *priv;
- char *str_uri;
FILE *file;
+ char *str_uri;
+ GnomeVFSURI *uri;
+ CalBackendOpenStatus status;
cbfile = CAL_BACKEND_FILE (backend);
priv = cbfile->priv;
@@ -846,9 +853,15 @@ cal_backend_file_open (CalBackend *backend, GnomeVFSURI *uri, gboolean only_if_e
g_assert (priv->uri == NULL);
g_assert (priv->comp_uid_hash == NULL);
- if (!gnome_vfs_uri_is_local (uri))
+ uri = gnome_vfs_uri_new (uristr);
+ if (!uri)
return CAL_BACKEND_OPEN_ERROR;
+ if (!gnome_vfs_uri_is_local (uri)) {
+ gnome_vfs_uri_unref (uri);
+ return CAL_BACKEND_OPEN_ERROR;
+ }
+
str_uri = gnome_vfs_uri_to_string (uri,
(GNOME_VFS_URI_HIDE_USER_NAME
| GNOME_VFS_URI_HIDE_PASSWORD
@@ -858,16 +871,20 @@ cal_backend_file_open (CalBackend *backend, GnomeVFSURI *uri, gboolean only_if_e
/* Load! */
file = fopen (str_uri, "r");
- g_free (str_uri);
if (file)
- return open_cal (cbfile, uri, file);
+ status = open_cal (cbfile, str_uri, file);
else {
if (only_if_exists)
- return CAL_BACKEND_OPEN_NOT_FOUND;
-
- return create_cal (cbfile, uri);
+ status = CAL_BACKEND_OPEN_NOT_FOUND;
+ else
+ status = create_cal (cbfile, str_uri);
}
+
+ g_free (str_uri);
+ gnome_vfs_uri_unref (uri);
+
+ return status;
}
/* is_loaded handler for the file backend */
diff --git a/calendar/pcs/cal-backend.c b/calendar/pcs/cal-backend.c
index ae2bd328eb..d123f17ec6 100644
--- a/calendar/pcs/cal-backend.c
+++ b/calendar/pcs/cal-backend.c
@@ -171,7 +171,7 @@ cal_backend_class_init (CalBackendClass *class)
*
* Return value: The URI where the calendar is stored.
**/
-GnomeVFSURI *
+const char *
cal_backend_get_uri (CalBackend *backend)
{
g_return_val_if_fail (backend != NULL, NULL);
@@ -249,7 +249,7 @@ cal_backend_add_cal (CalBackend *backend, Cal *cal)
/**
* cal_backend_open:
* @backend: A calendar backend.
- * @uri: URI that contains the calendar data.
+ * @uristr: URI that contains the calendar data.
* @only_if_exists: Whether the calendar should be opened only if it already
* exists. If FALSE, a new calendar will be created when the specified @uri
* does not exist.
@@ -260,16 +260,16 @@ cal_backend_add_cal (CalBackend *backend, Cal *cal)
* Return value: An operation status code.
**/
CalBackendOpenStatus
-cal_backend_open (CalBackend *backend, GnomeVFSURI *uri, gboolean only_if_exists)
+cal_backend_open (CalBackend *backend, const char *uristr, gboolean only_if_exists)
{
CalBackendOpenStatus result;
g_return_val_if_fail (backend != NULL, CAL_BACKEND_OPEN_ERROR);
g_return_val_if_fail (IS_CAL_BACKEND (backend), CAL_BACKEND_OPEN_ERROR);
- g_return_val_if_fail (uri != NULL, CAL_BACKEND_OPEN_ERROR);
+ g_return_val_if_fail (uristr != NULL, CAL_BACKEND_OPEN_ERROR);
g_assert (CLASS (backend)->open != NULL);
- result = (* CLASS (backend)->open) (backend, uri, only_if_exists);
+ result = (* CLASS (backend)->open) (backend, uristr, only_if_exists);
return result;
}
diff --git a/calendar/pcs/cal-backend.h b/calendar/pcs/cal-backend.h
index ff5d31d0dd..669de43f8e 100644
--- a/calendar/pcs/cal-backend.h
+++ b/calendar/pcs/cal-backend.h
@@ -26,7 +26,6 @@
#define CAL_BACKEND_H
#include <libgnome/gnome-defs.h>
-#include <libgnomevfs/gnome-vfs.h>
#include <cal-util/cal-util.h>
#include <cal-util/cal-component.h>
#include "evolution-calendar.h"
@@ -75,9 +74,9 @@ struct _CalBackendClass {
void (* obj_removed) (CalBackend *backend, const char *uid);
/* Virtual methods */
- GnomeVFSURI *(* get_uri) (CalBackend *backend);
+ const char *(* get_uri) (CalBackend *backend);
- CalBackendOpenStatus (* open) (CalBackend *backend, GnomeVFSURI *uri,
+ CalBackendOpenStatus (* open) (CalBackend *backend, const char *uristr,
gboolean only_if_exists);
gboolean (* is_loaded) (CalBackend *backend);
@@ -118,11 +117,11 @@ struct _CalBackendClass {
GtkType cal_backend_get_type (void);
-GnomeVFSURI *cal_backend_get_uri (CalBackend *backend);
+const char *cal_backend_get_uri (CalBackend *backend);
void cal_backend_add_cal (CalBackend *backend, Cal *cal);
-CalBackendOpenStatus cal_backend_open (CalBackend *backend, GnomeVFSURI *uri,
+CalBackendOpenStatus cal_backend_open (CalBackend *backend, const char *uristr,
gboolean only_if_exists);
gboolean cal_backend_is_loaded (CalBackend *backend);
diff --git a/calendar/pcs/cal-factory.c b/calendar/pcs/cal-factory.c
index 32786861bd..9b4bc2fc67 100644
--- a/calendar/pcs/cal-factory.c
+++ b/calendar/pcs/cal-factory.c
@@ -25,6 +25,7 @@
#include <stdio.h>
#include <gtk/gtksignal.h>
#include <liboaf/liboaf.h>
+#include "e-util/e-url.h"
#include "evolution-calendar.h"
#include "cal.h"
#include "cal-backend.h"
@@ -84,13 +85,13 @@ free_method (gpointer key, gpointer value, gpointer data)
static void
free_backend (gpointer key, gpointer value, gpointer data)
{
- GnomeVFSURI *uri;
+ char *uri;
CalBackend *backend;
uri = key;
backend = value;
- gnome_vfs_uri_unref (uri);
+ g_free (uri);
gtk_object_unref (GTK_OBJECT (backend));
}
@@ -98,14 +99,14 @@ free_backend (gpointer key, gpointer value, gpointer data)
/* Looks up a calendar backend in a factory's hash table of uri->cal */
static CalBackend *
-lookup_backend (CalFactory *factory, GnomeVFSURI *uri)
+lookup_backend (CalFactory *factory, const char *uristr)
{
CalFactoryPrivate *priv;
CalBackend *backend;
priv = factory->priv;
- backend = g_hash_table_lookup (priv->backends, uri);
+ backend = g_hash_table_lookup (priv->backends, uristr);
return backend;
}
@@ -115,10 +116,10 @@ backend_last_client_gone_cb (CalBackend *backend, gpointer data)
{
CalFactory *factory;
CalFactoryPrivate *priv;
- GnomeVFSURI *uri;
+ const char *uristr;
gpointer orig_key;
gboolean result;
- GnomeVFSURI *orig_uri;
+ const char *orig_uristr;
fprintf (stderr, "backend_last_client_gone_cb() called!\n");
@@ -127,16 +128,16 @@ backend_last_client_gone_cb (CalBackend *backend, gpointer data)
/* Remove the backend from the hash table */
- uri = cal_backend_get_uri (backend);
- g_assert (uri != NULL);
+ uristr = cal_backend_get_uri (backend);
+ g_assert (uristr != NULL);
- result = g_hash_table_lookup_extended (priv->backends, uri, &orig_key, NULL);
+ result = g_hash_table_lookup_extended (priv->backends, uristr, &orig_key, NULL);
g_assert (result != FALSE);
- orig_uri = orig_key;
+ orig_uristr = orig_key;
- g_hash_table_remove (priv->backends, orig_uri);
- gnome_vfs_uri_unref (orig_uri);
+ g_hash_table_remove (priv->backends, orig_uristr);
+ g_free ((gpointer) orig_uristr);
gtk_object_unref (GTK_OBJECT (backend));
@@ -148,14 +149,13 @@ backend_last_client_gone_cb (CalBackend *backend, gpointer data)
/* Adds a backend to the calendar factory's hash table */
static void
-add_backend (CalFactory *factory, GnomeVFSURI *uri, CalBackend *backend)
+add_backend (CalFactory *factory, const char *uristr, CalBackend *backend)
{
CalFactoryPrivate *priv;
priv = factory->priv;
- gnome_vfs_uri_ref (uri);
- g_hash_table_insert (priv->backends, uri, backend);
+ g_hash_table_insert (priv->backends, g_strdup (uristr), backend);
gtk_signal_connect (GTK_OBJECT (backend), "last_client_gone",
GTK_SIGNAL_FUNC (backend_last_client_gone_cb),
@@ -167,17 +167,25 @@ add_backend (CalFactory *factory, GnomeVFSURI *uri, CalBackend *backend)
* MethodNotSupported error code.
*/
static CalBackend *
-launch_backend_for_uri (CalFactory *factory, GnomeVFSURI *uri, GNOME_Evolution_Calendar_Listener listener)
+launch_backend_for_uri (CalFactory *factory,
+ const char *uristr,
+ GNOME_Evolution_Calendar_Listener listener)
{
CalFactoryPrivate *priv;
const char *method;
GtkType *type;
CalBackend *backend;
+ EUri *uri;
priv = factory->priv;
- method = gnome_vfs_uri_get_scheme (uri);
+ uri = e_uri_new (uristr);
+ if (!uri)
+ return NULL;
+
+ method = uri->protocol;
type = g_hash_table_lookup (priv->methods, method);
+ e_uri_free (uri);
if (!type) {
CORBA_Environment ev;
@@ -205,7 +213,7 @@ launch_backend_for_uri (CalFactory *factory, GnomeVFSURI *uri, GNOME_Evolution_C
/* Opens a calendar backend and puts it in the factory's backend hash table */
static CalBackend *
-open_backend (CalFactory *factory, GnomeVFSURI *uri, gboolean only_if_exists,
+open_backend (CalFactory *factory, const char *uristr, gboolean only_if_exists,
GNOME_Evolution_Calendar_Listener listener)
{
CalFactoryPrivate *priv;
@@ -215,15 +223,15 @@ open_backend (CalFactory *factory, GnomeVFSURI *uri, gboolean only_if_exists,
priv = factory->priv;
- backend = launch_backend_for_uri (factory, uri, listener);
+ backend = launch_backend_for_uri (factory, uristr, listener);
if (!backend)
return NULL;
- status = cal_backend_open (backend, uri, only_if_exists);
+ status = cal_backend_open (backend, uristr, only_if_exists);
switch (status) {
case CAL_BACKEND_OPEN_SUCCESS:
- add_backend (factory, uri, backend);
+ add_backend (factory, uristr, backend);
return backend;
case CAL_BACKEND_OPEN_ERROR:
@@ -268,7 +276,9 @@ open_backend (CalFactory *factory, GnomeVFSURI *uri, gboolean only_if_exists,
* object.
*/
static void
-add_calendar_client (CalFactory *factory, CalBackend *backend, GNOME_Evolution_Calendar_Listener listener)
+add_calendar_client (CalFactory *factory,
+ CalBackend *backend,
+ GNOME_Evolution_Calendar_Listener listener)
{
Cal *cal;
CORBA_Environment ev;
@@ -316,21 +326,16 @@ add_uri (gpointer key, gpointer value, gpointer data)
GNOME_Evolution_Calendar_StringSeq *list = cfud->list;
GNOME_Evolution_Calendar_CalMode mode = cfud->mode;
char *uri_string = key;
- CalBackend *backend;
- GnomeVFSURI *uri;
+ CalBackend *backend;
switch (mode) {
case GNOME_Evolution_Calendar_MODE_LOCAL:
- uri = gnome_vfs_uri_new_private (uri_string, TRUE, TRUE, TRUE);
- backend = lookup_backend (factory, uri);
- gnome_vfs_uri_unref (uri);
+ backend = lookup_backend (factory, uri_string);
if (backend == NULL && cal_backend_get_mode (backend) == CAL_MODE_LOCAL)
return;
break;
case GNOME_Evolution_Calendar_MODE_REMOTE:
- uri = gnome_vfs_uri_new_private (uri_string, TRUE, TRUE, TRUE);
- backend = lookup_backend (factory, uri);
- gnome_vfs_uri_unref (uri);
+ backend = lookup_backend (factory, uri_string);
if (backend == NULL && cal_backend_get_mode (backend) == CAL_MODE_REMOTE)
return;
break;
@@ -356,18 +361,17 @@ open_fn (gpointer data)
{
OpenJobData *jd;
CalFactory *factory;
- GnomeVFSURI *uri;
gboolean only_if_exists;
GNOME_Evolution_Calendar_Listener listener;
CalBackend *backend;
CORBA_Environment ev;
+ char *uri_string;
jd = data;
g_assert (jd->uri != NULL);
/* Check the URI */
-
- uri = gnome_vfs_uri_new_private (jd->uri, TRUE, TRUE, TRUE);
+ uri_string = g_strdup (jd->uri);
g_free (jd->uri);
only_if_exists = jd->only_if_exists;
@@ -375,7 +379,7 @@ open_fn (gpointer data)
listener = jd->listener;
g_free (jd);
- if (!uri) {
+ if (!uri_string) {
CORBA_exception_init (&ev);
GNOME_Evolution_Calendar_Listener_notifyCalOpened (
listener,
@@ -392,12 +396,10 @@ open_fn (gpointer data)
/* Look up the backend and create it if needed */
- backend = lookup_backend (factory, uri);
+ backend = lookup_backend (factory, uri_string);
if (!backend)
- backend = open_backend (factory, uri, only_if_exists, listener);
-
- gnome_vfs_uri_unref (uri);
+ backend = open_backend (factory, uri_string, only_if_exists, listener);
if (backend)
add_calendar_client (factory, backend, listener);
@@ -428,16 +430,15 @@ impl_CalFactory_open (PortableServer_Servant servant,
gboolean result;
OpenJobData *jd;
GNOME_Evolution_Calendar_Listener listener_copy;
- GnomeVFSURI *uri;
- const char *method_str;
GtkType type;
+ EUri *uri;
factory = CAL_FACTORY (bonobo_object_from_servant (servant));
priv = factory->priv;
/* check URI to see if we support it */
- uri = gnome_vfs_uri_new_private (str_uri, TRUE, TRUE, TRUE);
+ uri = e_uri_new (str_uri);
if (!uri) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_GNOME_Evolution_Calendar_CalFactory_InvalidURI,
@@ -445,10 +446,9 @@ impl_CalFactory_open (PortableServer_Servant servant,
return;
}
- method_str = gnome_vfs_uri_get_scheme (uri);
- type = g_hash_table_lookup (priv->methods, method_str);
+ type = g_hash_table_lookup (priv->methods, uri->protocol);
- gnome_vfs_uri_unref (uri);
+ e_uri_free (uri);
if (!type) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_GNOME_Evolution_Calendar_CalFactory_UnsupportedMethod,
@@ -615,7 +615,7 @@ cal_factory_init (CalFactory *factory)
factory->priv = priv;
priv->methods = g_hash_table_new (g_str_hash, g_str_equal);
- priv->backends = g_hash_table_new (gnome_vfs_uri_hash, gnome_vfs_uri_hequal);
+ priv->backends = g_hash_table_new (g_str_hash, g_str_equal);
priv->registered = FALSE;
}
diff --git a/calendar/pcs/cal.c b/calendar/pcs/cal.c
index 7a21aed95e..973b6aa980 100644
--- a/calendar/pcs/cal.c
+++ b/calendar/pcs/cal.c
@@ -40,7 +40,7 @@ struct _CalPrivate {
/* Listener on the client we notify */
GNOME_Evolution_Calendar_Listener listener;
- /* and a reference to the WombatClient interface */
+ /* A reference to the WombatClient interface */
GNOME_Evolution_WombatClient wombat_client;
};
@@ -52,17 +52,14 @@ impl_Cal_get_uri (PortableServer_Servant servant,
{
Cal *cal;
CalPrivate *priv;
- GnomeVFSURI *uri;
char *str_uri;
CORBA_char *str_uri_copy;
cal = CAL (bonobo_object_from_servant (servant));
priv = cal->priv;
- uri = cal_backend_get_uri (priv->backend);
- str_uri = gnome_vfs_uri_to_string (uri, GNOME_VFS_URI_HIDE_NONE);
+ str_uri = cal_backend_get_uri (priv->backend);
str_uri_copy = CORBA_string_dup (str_uri);
- g_free (str_uri);
return str_uri_copy;
}