fixed copy/paste typo. (e_cal_backend_groupwise_remove,
authorRodrigo Moya <rodrigo@ximian.com>
Sat, 10 Jan 2004 19:24:38 +0000 (19:24 +0000)
committerRodrigo Moya <rodrigo@src.gnome.org>
Sat, 10 Jan 2004 19:24:38 +0000 (19:24 +0000)
2004-01-10  Rodrigo Moya <rodrigo@ximian.com>

* backends/groupwise/e-cal-backend-groupwise.c
(e_cal_backend_groupwise_get_timezone): fixed copy/paste typo.
(e_cal_backend_groupwise_remove, e_cal_backend_groupwise_add_timezone,
e_cal_backend_groupwise_set_default_timezone,
e_cal_backend_groupwise_get_object_list,
e_cal_backend_groupwise_get_free_busy,
e_cal_backend_groupwise_get_changes,
e_cal_backend_groupwise_discard_alarm,
e_cal_backend_groupwise_modify_object,
e_cal_backend_groupwise_remove_object,
e_cal_backend_groupwise_receive_objects,
e_cal_backend_groupwise_send_objects):
fixed compilation warnings.

* backends/groupwise/Makefile.am:
* backends/groupwise/groupwise-config-listener.c: removed unused file.

calendar/ChangeLog
calendar/backends/groupwise/Makefile.am
calendar/backends/groupwise/e-cal-backend-groupwise.c
calendar/backends/groupwise/groupwise-config-listener.c [deleted file]

index 87a29b0..215ae91 100644 (file)
@@ -1,11 +1,31 @@
-2004-01-09 Harish K <kharish@novell.com>
-        * backends/groupwise/e-cal-backend-groupwise.c
+2004-01-10  Rodrigo Moya <rodrigo@ximian.com>
+
+       * backends/groupwise/e-cal-backend-groupwise.c
+       (e_cal_backend_groupwise_get_timezone): fixed copy/paste typo.
+       (e_cal_backend_groupwise_remove, e_cal_backend_groupwise_add_timezone,
+       e_cal_backend_groupwise_set_default_timezone,
+       e_cal_backend_groupwise_get_object_list,
+       e_cal_backend_groupwise_get_free_busy,
+       e_cal_backend_groupwise_get_changes,
+       e_cal_backend_groupwise_discard_alarm,
+       e_cal_backend_groupwise_modify_object,
+       e_cal_backend_groupwise_remove_object,
+       e_cal_backend_groupwise_receive_objects,
+       e_cal_backend_groupwise_send_objects):
+       fixed compilation warnings.
+
+       * backends/groupwise/Makefile.am:
+       * backends/groupwise/groupwise-config-listener.c: removed unused file.
+
+2004-01-09  Harish K <kharish@novell.com>
+
+       * backends/groupwise/e-cal-backend-groupwise.c
         (populate_cache): implemented.
 
-        * backends/groupwise/e-gw-connection.h:
+       * backends/groupwise/e-gw-connection.h:
         added declaration for e_gw_connection_get_items.
-        
-        * backends/groupwise/e-gw-connection.c:
+
+       * backends/groupwise/e-gw-connection.c:
         (e-gw-connection-get-items) :implementation to obtain 
         calendar data from GW using SOAP.
 
index ebd1016..4cc4bf1 100644 (file)
@@ -35,11 +35,7 @@ libecalbackendgroupwise_la_SOURCES =         \
        e-gw-connection.c                       \
        e-gw-connection.h                       \
        e-gw-message.c                          \
-       e-gw-message.h                          \
-       groupwise-config-listener.c             \
-       groupwise-config-listener.h             
-       
-                                      
+       e-gw-message.h
 
 libecalbackendgroupwise_la_LIBADD =                                    \
        $(top_builddir)/calendar/libedata-cal/libedata-cal.la           \
index f1da78b..80d5f69 100644 (file)
@@ -291,6 +291,8 @@ e_cal_backend_groupwise_remove (ECalBackendSync *backend, EDataCal *cal)
        
        cbgw = E_CAL_BACKEND_GROUPWISE (backend);
        priv = cbgw->priv;
+
+       return GNOME_Evolution_Calendar_OtherError;
 }
 
 /* is_loaded handler for the file backend */
@@ -326,7 +328,6 @@ e_cal_backend_groupwise_set_mode (ECalBackend *backend, CalMode mode)
        GnomeVFSURI *vuri;
        char *real_uri;
        EGwConnectionStatus status;
-       ECalBackendSyncStatus result;
        ECalBackendGroupwise *cbgw;
        ECalBackendGroupwisePrivate *priv;
 
@@ -384,9 +385,10 @@ e_cal_backend_groupwise_set_mode (ECalBackend *backend, CalMode mode)
                                        e_cal_backend_notify_mode (backend, GNOME_Evolution_Calendar_CalListener_MODE_SET,
                                                                   GNOME_Evolution_Calendar_MODE_REMOTE);
                                }
-                       } else
+                       } else {
                                e_cal_backend_notify_mode (backend, GNOME_Evolution_Calendar_CalListener_MODE_NOT_SET,
                                                           GNOME_Evolution_Calendar_MODE_REMOTE);
+                       }
                }
                break;
        case CAL_MODE_LOCAL : /* go offline */
@@ -491,17 +493,20 @@ e_cal_backend_groupwise_get_timezone (ECalBackendSync *backend, EDataCal *cal, c
 static ECalBackendSyncStatus
 e_cal_backend_groupwise_add_timezone (ECalBackendSync *backend, EDataCal *cal, const char *tzobj)
 {
+       return GNOME_Evolution_Calendar_OtherError;
 }
 
 static ECalBackendSyncStatus
 e_cal_backend_groupwise_set_default_timezone (ECalBackendSync *backend, EDataCal *cal, const char *tzid)
 {
+       return GNOME_Evolution_Calendar_OtherError;
 }
 
 /* Get_objects_in_range handler for the groupwise backend */
 static ECalBackendSyncStatus
 e_cal_backend_groupwise_get_object_list (ECalBackendSync *backend, EDataCal *cal, const char *sexp, GList **objects)
 {
+       return GNOME_Evolution_Calendar_OtherError;
 }
 
 /* get_query handler for the groupwise backend */
@@ -515,30 +520,62 @@ static ECalBackendSyncStatus
 e_cal_backend_groupwise_get_free_busy (ECalBackendSync *backend, EDataCal *cal, GList *users,
                                time_t start, time_t end, GList **freebusy)
 {
+       return GNOME_Evolution_Calendar_OtherError;
 }
 
 /* Get_changes handler for the file backend */
 static ECalBackendSyncStatus
 e_cal_backend_groupwise_get_changes (ECalBackendSync *backend, EDataCal *cal, const char *change_id,
-                             GList **adds, GList **modifies, GList **deletes)
+                                    GList **adds, GList **modifies, GList **deletes)
 {
+       return GNOME_Evolution_Calendar_OtherError;
 }
 
 /* Discard_alarm handler for the file backend */
 static ECalBackendSyncStatus
 e_cal_backend_groupwise_discard_alarm (ECalBackendSync *backend, EDataCal *cal, const char *uid, const char *auid)
 {
+       return GNOME_Evolution_Calendar_OtherError;
 }
 
 static ECalBackendSyncStatus
 e_cal_backend_groupwise_create_object (ECalBackendSync *backend, EDataCal *cal, const char *calobj, char **uid)
 {
+       ECalBackendGroupwise *cbgw;
+        ECalBackendGroupwisePrivate *priv;
+       icalcomponent *icalcomp;
+
+       cbgw = E_CAL_BACKEND_GROUPWISE (backend);
+       priv = cbgw->priv;
+
+       g_return_val_if_fail (E_IS_CAL_BACKEND_GROUPWISE (cbgw), GNOME_Evolution_Calendar_InvalidObject);
+       g_return_val_if_fail (calobj != NULL, GNOME_Evolution_Calendar_InvalidObject);
+
+       /* check the component for validity */
+       icalcomp = icalparser_parse_string (calobj);
+       if (!icalcomp)
+               return GNOME_Evolution_Calendar_InvalidObject;
+
+       /* check if the object exists */
+       switch (priv->mode) {
+       case CAL_MODE_LOCAL :
+               /* in offline mode, we just update the cache */
+               break;
+       case CAL_MODE_ANY :
+       case CAL_MODE_REMOTE :
+               break;
+       default :
+               break;
+       }
+
+       return GNOME_Evolution_Calendar_InvalidObject;
 }
 
 static ECalBackendSyncStatus
 e_cal_backend_groupwise_modify_object (ECalBackendSync *backend, EDataCal *cal, const char *calobj, 
                                CalObjModType mod, char **old_object)
 {
+       return GNOME_Evolution_Calendar_OtherError;
 }
 
 /* Remove_object handler for the file backend */
@@ -547,17 +584,20 @@ e_cal_backend_groupwise_remove_object (ECalBackendSync *backend, EDataCal *cal,
                                const char *uid, const char *rid,
                                CalObjModType mod, char **object)
 {
+       return GNOME_Evolution_Calendar_OtherError;
 }
 
 /* Update_objects handler for the file backend. */
 static ECalBackendSyncStatus
 e_cal_backend_groupwise_receive_objects (ECalBackendSync *backend, EDataCal *cal, const char *calobj)
 {
+       return GNOME_Evolution_Calendar_OtherError;
 }
 
 static ECalBackendSyncStatus
 e_cal_backend_groupwise_send_objects (ECalBackendSync *backend, EDataCal *cal, const char *calobj)
 {
+       return GNOME_Evolution_Calendar_OtherError;
 }
 
 
diff --git a/calendar/backends/groupwise/groupwise-config-listener.c b/calendar/backends/groupwise/groupwise-config-listener.c
deleted file mode 100644 (file)
index 334ac6b..0000000
+++ /dev/null
@@ -1,467 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors :
- *  
- *  Sivaiah Nallagatla <snallagatla@novell.com>
- *
- * Copyright 2003, Novell, Inc.
- *
- * 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
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-                                                                                                                             
-#include "groupwise-config-listener.h"
-#include <string.h>
-
-/*stores some info about all currently existing groupwise accounts 
-  list of GwAccountInfo structures */
-
-static         GList *groupwise_accounts = NULL;
-
-struct _GroupwiseConfigListenerPrivate {
-       GConfClient *gconf_client;
-       /* we get notification about mail account changes form this object */
-       EAccountList *account_list;
-                  
-};
-
-struct _GwAccountInfo {
-       char *uid;
-       char *name;
-       char *source_url;
-};
-
-typedef struct _GwAccountInfo GwAccountInfo;
-
-#define GROUPWISE_URI_PREFIX   "groupwise://" 
-#define GROUPWISE_PREFIX_LENGTH 12
-
-#define PARENT_TYPE G_TYPE_OBJECT
-
-static GObjectClass *parent_class = NULL;
-                                                                                                                             
-static void dispose (GObject *object);
-static void finalize (GObject *object);
-                                                                                                                             
-
-static void 
-groupwise_config_listener_class_init (GroupwiseConfigListenerClass *class)
-{
-       GObjectClass *object_class;
-       
-       parent_class =  g_type_class_ref (PARENT_TYPE);
-       object_class = G_OBJECT_CLASS (class);
-       
-       /* virtual method override */
-       object_class->dispose = dispose;
-       object_class->finalize = finalize;
-
-}
-
-static void 
-groupwise_config_listener_init (GroupwiseConfigListener *config_listener,  GroupwiseConfigListenerClass *class)
-{
-       config_listener->priv = g_new0 (GroupwiseConfigListenerPrivate, 1);
-       
-}
-
-static void 
-dispose (GObject *object)
-{
-       GroupwiseConfigListener *config_listener = GROUPWISE_CONFIG_LISTENER (object);
-       
-       g_object_unref (config_listener->priv->gconf_client);
-       g_object_unref (config_listener->priv->account_list);
-
-       G_OBJECT_CLASS (parent_class)->dispose (object);
-
-}
-
-static void 
-finalize (GObject *object)
-{
-       GroupwiseConfigListener *config_listener = GROUPWISE_CONFIG_LISTENER (object);
-       GList *list;
-       GwAccountInfo *info;
-
-       if (config_listener->priv) {
-               g_free (config_listener->priv);
-       }
-
-       for ( list = g_list_first (groupwise_accounts); list ; list = g_list_next (list) ) {
-              
-               info = (GwAccountInfo *) (list->data);
-
-               if (info) {
-                       
-                       g_free (info->uid);
-                       g_free (info->name);
-                       g_free (info->source_url);
-                       g_free (info);
-               }
-       }
-       
-       g_list_free (groupwise_accounts);
-
-}
-
-/*determines whehter the passed in account is groupwise or not by looking at source url */
-
-static gboolean
-is_groupwise_account (EAccount *account)
-{
-       return (strncmp (account->source->url,  GROUPWISE_URI_PREFIX, GROUPWISE_PREFIX_LENGTH ) == 0);
-}
-
-
-/* looks up for an existing groupwise account info in the groupwise_accounts list based on uid */
-
-static GwAccountInfo* 
-lookup_account_info (const char *key)
-{
-       GList *list;
-        GwAccountInfo *info ;
-       int found = 0;
-                                                                      
-        if (!key)
-                return NULL;
-
-       info = NULL;
-
-        for (list = g_list_first (groupwise_accounts);  list;  list = g_list_next (list)) {
-                                                                                                                                      
-                info = (GwAccountInfo *) (list->data);
-                found = strcmp (info->uid, key) == 0;
-               if (found)
-                       break;
-                                                                                                                       
-       }
-                                                                                                                                    
-       return info;
-}
-
-
-static void
-add_esource (const char *conf_key, const char *group_name,  const char* source_name, const char* relative_uri)
-{
-       ESourceList *source_list;
-       ESourceGroup *group;
-       ESource *source;
-       
-       source_list = e_source_list_new_for_gconf (gconf_client_get_default (), conf_key);
-
-       group = e_source_group_new (group_name,  GROUPWISE_URI_PREFIX);
-       if ( !e_source_list_add_group (source_list, group, -1))
-               return;
-
-       source = e_source_new (source_name, relative_uri);
-       e_source_group_add_source (group, source, -1);
-
-       e_source_list_sync (source_list, NULL);
-
-       g_object_unref (source);
-       g_object_unref (group);
-       g_object_unref (source_list);
-}
-
-
-static void 
-remove_esource (const char *conf_key, const char *group_name, char* source_name, const char* relative_uri)
-{
-       ESourceList *list;
-        ESourceGroup *group;
-        ESource *source;
-        GSList *groups;                                                                                                                     
-       GSList *sources;
-        list = e_source_list_new_for_gconf (gconf_client_get_default (), conf_key);
-       groups = e_source_list_peek_groups (list); 
-       
-       for ( ; groups != NULL; groups = g_slist_next (groups)) {
-
-               group = E_SOURCE_GROUP (groups->data);
-               
-               if (strcmp (e_source_group_peek_name (group), group_name) == 0 && 
-                  strcmp (e_source_group_peek_base_uri (group), GROUPWISE_URI_PREFIX ) == 0) {
-
-                       sources = e_source_group_peek_sources (group);
-                       
-                       for( ; sources != NULL; sources = g_slist_next (sources)) {
-                               
-                               source = E_SOURCE (sources->data);
-                               
-                               if (strcmp (e_source_peek_relative_uri (source), relative_uri) == 0) {
-                                       
-                                       e_source_list_remove_group (list, group);
-                                       e_source_list_sync (list, NULL);        
-                                       break;
-                                       
-                               }
-                       }
-
-               }
-       }
-
-       g_object_unref (list);
-                       
-       
-}
-
-/* looks up for e-source with having same info as old_account_info and changes its values passed in new values */
-
-static void 
-modify_esource (const char* conf_key, GwAccountInfo *old_account_info, const char* new_group_name, const char* new_relative_uri)
-{
-       ESourceList *list;
-        ESourceGroup *group;
-        ESource *source;
-        GSList *groups;
-       GSList *sources;
-       char *old_relative_uri;
-       EUri *uri;
-
-       uri = e_uri_new (old_account_info->source_url);
-       old_relative_uri =  g_strdup_printf ("%s@%s", uri->user, uri->host);
-
-        list = e_source_list_new_for_gconf (gconf_client_get_default (), conf_key);
-       groups = e_source_list_peek_groups (list); 
-       
-       for ( ; groups != NULL; groups = g_slist_next (groups)) {
-
-               group = E_SOURCE_GROUP (groups->data);
-               
-               if (strcmp (e_source_group_peek_name (group), old_account_info->name) == 0 && 
-                  strcmp (e_source_group_peek_base_uri (group), GROUPWISE_URI_PREFIX) == 0) {
-                       
-                       sources = e_source_group_peek_sources (group);
-                       
-                       for ( ; sources != NULL; sources = g_slist_next (sources)) {
-                               
-                               source = E_SOURCE (sources->data);
-                               
-                               if (strcmp (e_source_peek_relative_uri (source), old_relative_uri) == 0) {
-                                       
-                                       e_source_group_set_name (group, new_group_name);
-                                       e_source_set_relative_uri (source, new_relative_uri);
-                                       e_source_list_sync (list, NULL);        
-                                       break;
-                               }
-                       }
-               }
-       }
-
-       g_object_unref (list);
-       e_uri_free (uri);
-       g_free (old_relative_uri);
-       
-}
-/* add sources for calendar and tasks if the account added is groupwise account
-   adds the new account info to  groupwise_accounts list */
-
-static void 
-add_calendar_tasks_sources (GwAccountInfo *info)
-{
-       EUri *uri;
-       char *relative_uri;
-       
-       uri = e_uri_new (info->source_url);
-       relative_uri =  g_strdup_printf ("%s@%s", uri->user, uri->host);
-       add_esource ("/apps/evolution/calendar/sources", info->name,  "Default", relative_uri);
-       add_esource ("/apps/evolution/tasks/sources", info->name,  "Default", relative_uri);
-       
-       groupwise_accounts = g_list_append (groupwise_accounts, info);
-       
-       e_uri_free (uri);
-       g_free (relative_uri);
-
-}
-
-/* removes calendar and tasks sources if the account removed is groupwise account 
-   removes the the account info from groupwise_account list */
-
-static void 
-remove_calendar_tasks_sources (GwAccountInfo *info)
-{
-       EUri *uri;
-       char *relative_uri;
-       
-       uri = e_uri_new (info->source_url);
-       relative_uri =  g_strdup_printf ("%s@%s", uri->user, uri->host);
-
-       remove_esource ("/apps/evolution/calendar/sources", info->name,  "Default", relative_uri);
-       remove_esource ("/apps/evolution/tasks/sources", info->name,  "Default", relative_uri);
-       
-       g_free (info->uid);
-       g_free (info->name);
-       g_free (info->source_url);
-       groupwise_accounts = g_list_remove (groupwise_accounts, info);
-       g_free (info);
-       e_uri_free (uri);
-       g_free (relative_uri);
-
-}
-
-static void 
-account_added (EAccountList *account_listener, EAccount *account)
-{
-       EUri *uri;
-       GwAccountInfo *info;
-
-       if (!is_groupwise_account (account))
-               return;
-
-       uri = e_uri_new (account->source->url);
-       
-       info = g_new0 (GwAccountInfo, 1);
-       info->uid = g_strdup (account->uid);
-       info->name = g_strdup (account->name);
-       info->source_url = g_strdup (account->source->url);
-       
-       add_calendar_tasks_sources (info);
-       
-}
-
-
-
-static void
-account_changed (EAccountList *account_listener, EAccount *account)
-{
-       gboolean is_gw_account;
-       EUri *uri;
-       char *relative_uri;
-
-       GwAccountInfo *existing_account_info;
-       is_gw_account = is_groupwise_account (account);
-       existing_account_info = lookup_account_info (account->uid);
-               
-       if (existing_account_info == NULL && is_gw_account) {
-               /* some account of other type is changed to Groupwise */
-               account_added (account_listener, account);
-
-       } else if ( existing_account_info != NULL && !is_gw_account) {
-
-               /*Groupwise account is changed to some other type */
-
-               remove_calendar_tasks_sources ( existing_account_info);
-
-       } else if ( existing_account_info != NULL && is_gw_account ) {
-
-               /* some info of groupwise account is changed . update the sources with new info if required */
-               if (strcmp (existing_account_info->name, account->name) != 0 || strcmp (existing_account_info->source_url, account->source->url) != 0) {
-                       
-                       uri = e_uri_new (account->source->url);
-                       relative_uri =  g_strdup_printf ("%s@%s", uri->user, uri->host);
-                       modify_esource ("/apps/evolution/calendar/sources", existing_account_info, account->name, relative_uri);
-                       modify_esource ("/apps/evolution/tasks/sources", existing_account_info, account->name, relative_uri);
-                       g_free (existing_account_info->name);
-                       g_free (existing_account_info->source_url);
-                       existing_account_info->name = g_strdup (account->name);
-                       existing_account_info->source_url = g_strdup (account->source->url);
-                       e_uri_free (uri);
-               }
-               
-       }
-               
-       
-} 
-
-static void 
-account_removed (EAccountList *account_listener, EAccount *account)
-{
-               GwAccountInfo *info;
-       
-       if (!is_groupwise_account (account))
-               return;
-       
-       info = lookup_account_info (account->uid);
-       if (info == NULL) {
-               return;
-       }
-
-       remove_calendar_tasks_sources (info);
-
-}
-
-static void
-groupwise_config_listener_construct (GroupwiseConfigListener * config_listener)
-{
-       EIterator *iter;
-       EAccount *account;
-       GwAccountInfo *info ;
-       
-               config_listener->priv->account_list = e_account_list_new (config_listener->priv->gconf_client);
-
-       for ( iter = e_list_get_iterator (E_LIST ( config_listener->priv->account_list) ) ; e_iterator_is_valid (iter); e_iterator_next (iter) ) {
-               
-               account = E_ACCOUNT (e_iterator_get (iter));
-               if ( is_groupwise_account (account)) {
-                       
-                       info = g_new0 (GwAccountInfo, 1);
-                       info->uid = g_strdup (account->uid);
-                       info->name = g_strdup (account->name);
-                       info->source_url = g_strdup (account->source->url);
-                       groupwise_accounts = g_list_append (groupwise_accounts, info);
-                       
-               }
-                       
-       }
-       g_signal_connect (config_listener->priv->account_list, "account_added", G_CALLBACK (account_added), NULL);
-       g_signal_connect (config_listener->priv->account_list, "account_changed", G_CALLBACK (account_changed), NULL);
-       g_signal_connect (config_listener->priv->account_list, "account_removed", G_CALLBACK (account_removed), NULL);
-       
-       
-}
-
-GType
-groupwise_config_listener_get_type (void)
-{
-       static GType groupwise_config_listener_type  = 0;
-
-       if (!groupwise_config_listener_type) {
-               static GTypeInfo info = {
-                        sizeof (GroupwiseConfigListenerClass),
-                        (GBaseInitFunc) NULL,
-                        (GBaseFinalizeFunc) NULL,
-                        (GClassInitFunc) groupwise_config_listener_class_init,
-                        NULL, NULL,
-                        sizeof (GroupwiseConfigListener),
-                        0,
-                        (GInstanceInitFunc)groupwise_config_listener_init
-                };
-               groupwise_config_listener_type = g_type_register_static (PARENT_TYPE, "GroupwiseConfigListener", &info, 0);
-       }
-
-       return groupwise_config_listener_type;
-}
-
-GroupwiseConfigListener*
-groupwise_config_listener_new (GConfClient * client)
-{
-       GroupwiseConfigListener *config_listener;
-       
-       config_listener = g_object_new (GROUPWISE_TYPE_CONFIG_LISTENER, NULL);
-       config_listener->priv->gconf_client = client;
-       g_object_ref (client);
-       
-       groupwise_config_listener_construct (config_listener);
-
-       return config_listener;
-
-}
-
-