aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/pcs
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@ximian.com>2002-11-13 04:59:08 +0800
committerFederico Mena Quintero <federico@src.gnome.org>2002-11-13 04:59:08 +0800
commit6c988be90916e1928b48b8ac7a8feceaed9f5c57 (patch)
tree90b7d99837726700e4c7af57b2edec502770a3ba /calendar/pcs
parentaa55b24ba72f7674d547b3a1486d149603c1127d (diff)
downloadgsoc2013-evolution-6c988be90916e1928b48b8ac7a8feceaed9f5c57.tar
gsoc2013-evolution-6c988be90916e1928b48b8ac7a8feceaed9f5c57.tar.gz
gsoc2013-evolution-6c988be90916e1928b48b8ac7a8feceaed9f5c57.tar.bz2
gsoc2013-evolution-6c988be90916e1928b48b8ac7a8feceaed9f5c57.tar.lz
gsoc2013-evolution-6c988be90916e1928b48b8ac7a8feceaed9f5c57.tar.xz
gsoc2013-evolution-6c988be90916e1928b48b8ac7a8feceaed9f5c57.tar.zst
gsoc2013-evolution-6c988be90916e1928b48b8ac7a8feceaed9f5c57.zip
#include <string.h>
2002-11-12 Federico Mena Quintero <federico@ximian.com> * pcs/cal-backend-util.c: #include <string.h> * pcs/cal.c: Fixed prototypes of the CORBA method implementations. * pcs/cal-backend-file.c (cal_backend_file_dispose): Added a dispose method. (cal_backend_file_get_free_busy): Converted to use EConfigListener rather than BonoboConfigDatabase. * gui/alarm-notify/alarm-notify.c: #include <string.h>, fix use of g_hash_table_lookup_extended(). * gui/alarm-notify/alarm-notify-dialog.c: Substitute deprecated GTK+ functions for new ones. * gui/alarm-notify/alarm-queue.c: Likewise. * gui/alarm-notify/notify-main.c: #include <string.h>, <gtk/gtkmain.h>. * gui/alarm-notify/save.c: #include <string.h>. svn path=/trunk/; revision=18726
Diffstat (limited to 'calendar/pcs')
-rw-r--r--calendar/pcs/cal-backend-file.c94
-rw-r--r--calendar/pcs/cal-backend-util.c1
-rw-r--r--calendar/pcs/cal.c183
3 files changed, 141 insertions, 137 deletions
diff --git a/calendar/pcs/cal-backend-file.c b/calendar/pcs/cal-backend-file.c
index 3f457a0a57..595626f043 100644
--- a/calendar/pcs/cal-backend-file.c
+++ b/calendar/pcs/cal-backend-file.c
@@ -21,6 +21,7 @@
*/
#include <config.h>
+#include <string.h>
#include <bonobo/bonobo-exception.h>
#include <bonobo/bonobo-moniker-util.h>
#include <libgnomevfs/gnome-vfs.h>
@@ -73,7 +74,7 @@ struct _CalBackendFilePrivate {
GHashTable *removed_categories;
/* Config database handle for free/busy organizer information */
- Bonobo_ConfigDatabase db;
+ EConfigListener *config_listener;
/* Idle handler for saving the calendar when it is dirty */
guint idle_id;
@@ -87,6 +88,7 @@ struct _CalBackendFilePrivate {
static void cal_backend_file_class_init (CalBackendFileClass *class);
static void cal_backend_file_init (CalBackendFile *cbfile, CalBackendFileClass *class);
+static void cal_backend_file_dispose (GObject *object);
static void cal_backend_file_finalize (GObject *object);
static const char *cal_backend_file_get_uri (CalBackend *backend);
@@ -136,6 +138,7 @@ static gboolean cal_backend_file_set_default_timezone (CalBackend *backend,
const char *tzid);
static void notify_categories_changed (CalBackendFile *cbfile);
+static void notify_error (CalBackendFile *cbfile, const char *message);
static CalBackendClass *parent_class;
@@ -185,6 +188,7 @@ cal_backend_file_class_init (CalBackendFileClass *class)
parent_class = (CalBackendClass *) g_type_class_peek_parent (class);
+ object_class->dispose = cal_backend_file_dispose;
object_class->finalize = cal_backend_file_finalize;
backend_class->get_uri = cal_backend_file_get_uri;
@@ -214,24 +218,6 @@ cal_backend_file_class_init (CalBackendFileClass *class)
backend_class->set_default_timezone = cal_backend_file_set_default_timezone;
}
-static Bonobo_ConfigDatabase
-load_db (void)
-{
- Bonobo_ConfigDatabase db = CORBA_OBJECT_NIL;
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev);
-
- if (BONOBO_EX (&ev))
- db = CORBA_OBJECT_NIL;
-
- CORBA_exception_free (&ev);
-
- return db;
-}
-
static void
cal_added_cb (CalBackend *backend, gpointer user_data)
{
@@ -260,7 +246,7 @@ cal_backend_file_init (CalBackendFile *cbfile, CalBackendFileClass *class)
/* The timezone defaults to UTC. */
priv->default_zone = icaltimezone_get_utc_timezone ();
- priv->db = load_db ();
+ priv->config_listener = e_config_listener_new ();
g_signal_connect (G_OBJECT (cbfile), "cal_added",
G_CALLBACK (cal_added_cb), NULL);
@@ -358,23 +344,16 @@ free_category_cb (gpointer key, gpointer value, gpointer data)
g_free (c);
}
-/* Finalize handler for the file backend */
+/* Dispose handler for the file backend */
static void
-cal_backend_file_finalize (GObject *object)
+cal_backend_file_dispose (GObject *object)
{
CalBackendFile *cbfile;
CalBackendFilePrivate *priv;
- GList *clients;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_CAL_BACKEND_FILE (object));
cbfile = CAL_BACKEND_FILE (object);
priv = cbfile->priv;
- clients = CAL_BACKEND (cbfile)->clients;
- g_assert (clients == NULL);
-
/* Save if necessary */
if (priv->idle_id != 0) {
@@ -383,13 +362,6 @@ cal_backend_file_finalize (GObject *object)
priv->idle_id = 0;
}
- /* Clean up */
-
- if (priv->uri) {
- g_free (priv->uri);
- priv->uri = NULL;
- }
-
if (priv->comp_uid_hash) {
g_hash_table_foreach (priv->comp_uid_hash,
free_cal_component, NULL);
@@ -404,6 +376,44 @@ cal_backend_file_finalize (GObject *object)
priv->todos = NULL;
priv->journals = NULL;
+ if (priv->icalcomp) {
+ icalcomponent_free (priv->icalcomp);
+ priv->icalcomp = NULL;
+ }
+
+ if (priv->config_listener) {
+ g_object_unref (priv->config_listener);
+ priv->config_listener = NULL;
+ }
+
+ if (G_OBJECT_CLASS (parent_class)->dispose)
+ (* G_OBJECT_CLASS (parent_class)->dispose) (object);
+}
+
+/* Finalize handler for the file backend */
+static void
+cal_backend_file_finalize (GObject *object)
+{
+ CalBackendFile *cbfile;
+ CalBackendFilePrivate *priv;
+ GList *clients;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (IS_CAL_BACKEND_FILE (object));
+
+ cbfile = CAL_BACKEND_FILE (object);
+ priv = cbfile->priv;
+
+ clients = CAL_BACKEND (cbfile)->clients;
+ g_assert (clients == NULL);
+
+ /* Clean up */
+
+ if (priv->uri) {
+ g_free (priv->uri);
+ priv->uri = NULL;
+ }
+
g_hash_table_foreach (priv->categories, free_category_cb, NULL);
g_hash_table_destroy (priv->categories);
priv->categories = NULL;
@@ -412,14 +422,6 @@ cal_backend_file_finalize (GObject *object)
g_hash_table_destroy (priv->removed_categories);
priv->removed_categories = NULL;
- if (priv->icalcomp) {
- icalcomponent_free (priv->icalcomp);
- priv->icalcomp = NULL;
- }
-
- bonobo_object_release_unref (priv->db, NULL);
- priv->db = CORBA_OBJECT_NIL;
-
g_free (priv);
cbfile->priv = NULL;
@@ -1406,7 +1408,7 @@ cal_backend_file_get_free_busy (CalBackend *backend, GList *users, time_t start,
g_return_val_if_fail (start <= end, NULL);
if (users == NULL) {
- if (cal_backend_mail_account_get_default (priv->db, &address, &name)) {
+ if (cal_backend_mail_account_get_default (priv->config_listener, &address, &name)) {
vfb = create_user_free_busy (cbfile, address, name, start, end);
calobj = icalcomponent_as_ical_string (vfb);
obj_list = g_list_append (obj_list, g_strdup (calobj));
@@ -1417,7 +1419,7 @@ cal_backend_file_get_free_busy (CalBackend *backend, GList *users, time_t start,
} else {
for (l = users; l != NULL; l = l->next ) {
address = l->data;
- if (cal_backend_mail_account_is_valid (priv->db, address, &name)) {
+ if (cal_backend_mail_account_is_valid (priv->config_listener, address, &name)) {
vfb = create_user_free_busy (cbfile, address, name, start, end);
calobj = icalcomponent_as_ical_string (vfb);
obj_list = g_list_append (obj_list, g_strdup (calobj));
diff --git a/calendar/pcs/cal-backend-util.c b/calendar/pcs/cal-backend-util.c
index a63a2b319c..a5b6d1adc8 100644
--- a/calendar/pcs/cal-backend-util.c
+++ b/calendar/pcs/cal-backend-util.c
@@ -20,6 +20,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
+#include <string.h>
#include "cal-backend-util.h"
void
diff --git a/calendar/pcs/cal.c b/calendar/pcs/cal.c
index 20ec86eb28..0d089b5096 100644
--- a/calendar/pcs/cal.c
+++ b/calendar/pcs/cal.c
@@ -64,10 +64,10 @@ impl_Cal_get_uri (PortableServer_Servant servant,
return str_uri_copy;
}
-/* Cal::is_read_only method */
+/* Cal::isReadOnly method */
static CORBA_boolean
-impl_Cal_is_read_only (PortableServer_Servant servant,
- CORBA_Environment *ev)
+impl_Cal_isReadOnly (PortableServer_Servant servant,
+ CORBA_Environment *ev)
{
Cal *cal;
CalPrivate *priv;
@@ -78,10 +78,10 @@ impl_Cal_is_read_only (PortableServer_Servant servant,
return cal_backend_is_read_only (priv->backend);
}
-/* Cal::get_email_address method */
+/* Cal::getEmailAddress method */
static CORBA_char *
-impl_Cal_get_email_address (PortableServer_Servant servant,
- CORBA_Environment *ev)
+impl_Cal_getEmailAddress (PortableServer_Servant servant,
+ CORBA_Environment *ev)
{
Cal *cal;
CalPrivate *priv;
@@ -113,10 +113,11 @@ uncorba_obj_type (GNOME_Evolution_Calendar_CalObjType type)
| ((type & GNOME_Evolution_Calendar_TYPE_JOURNAL) ? CALOBJ_TYPE_JOURNAL : 0));
}
+/* Cal::setMode method */
static void
-impl_Cal_set_mode (PortableServer_Servant servant,
- GNOME_Evolution_Calendar_CalMode mode,
- CORBA_Environment *ev)
+impl_Cal_setMode (PortableServer_Servant servant,
+ GNOME_Evolution_Calendar_CalMode mode,
+ CORBA_Environment *ev)
{
Cal *cal;
CalPrivate *priv;
@@ -127,11 +128,11 @@ impl_Cal_set_mode (PortableServer_Servant servant,
cal_backend_set_mode (priv->backend, mode);
}
-/* Cal::get_n_objects method */
+/* Cal::countObjects method */
static CORBA_long
-impl_Cal_get_n_objects (PortableServer_Servant servant,
- GNOME_Evolution_Calendar_CalObjType type,
- CORBA_Environment *ev)
+impl_Cal_countObjects (PortableServer_Servant servant,
+ GNOME_Evolution_Calendar_CalObjType type,
+ CORBA_Environment *ev)
{
Cal *cal;
CalPrivate *priv;
@@ -146,11 +147,11 @@ impl_Cal_get_n_objects (PortableServer_Servant servant,
return n;
}
-/* Cal::get_object method */
+/* Cal::getObject method */
static GNOME_Evolution_Calendar_CalObj
-impl_Cal_get_object (PortableServer_Servant servant,
- const GNOME_Evolution_Calendar_CalObjUID uid,
- CORBA_Environment *ev)
+impl_Cal_getObject (PortableServer_Servant servant,
+ const CORBA_char *uid,
+ CORBA_Environment *ev)
{
Cal *cal;
CalPrivate *priv;
@@ -200,11 +201,11 @@ build_uid_seq (GList *uids)
return seq;
}
-/* Cal::get_uids method */
+/* Cal::getUIDs method */
static GNOME_Evolution_Calendar_CalObjUIDSeq *
-impl_Cal_get_uids (PortableServer_Servant servant,
- GNOME_Evolution_Calendar_CalObjType type,
- CORBA_Environment *ev)
+impl_Cal_getUIDs (PortableServer_Servant servant,
+ GNOME_Evolution_Calendar_CalObjType type,
+ CORBA_Environment *ev)
{
Cal *cal;
CalPrivate *priv;
@@ -225,12 +226,12 @@ impl_Cal_get_uids (PortableServer_Servant servant,
return seq;
}
-/* Cal::get_changes method */
+/* Cal::getChanges method */
static GNOME_Evolution_Calendar_CalObjChangeSeq *
-impl_Cal_get_changes (PortableServer_Servant servant,
- GNOME_Evolution_Calendar_CalObjType type,
- const CORBA_char *change_id,
- CORBA_Environment *ev)
+impl_Cal_getChanges (PortableServer_Servant servant,
+ GNOME_Evolution_Calendar_CalObjType type,
+ const CORBA_char *change_id,
+ CORBA_Environment *ev)
{
Cal *cal;
CalPrivate *priv;
@@ -244,13 +245,13 @@ impl_Cal_get_changes (PortableServer_Servant servant,
return cal_backend_get_changes (priv->backend, t, change_id);
}
-/* Cal::get_objects_in_range method */
+/* Cal::getObjectsInRange method */
static GNOME_Evolution_Calendar_CalObjUIDSeq *
-impl_Cal_get_objects_in_range (PortableServer_Servant servant,
- GNOME_Evolution_Calendar_CalObjType type,
- GNOME_Evolution_Calendar_Time_t start,
- GNOME_Evolution_Calendar_Time_t end,
- CORBA_Environment *ev)
+impl_Cal_getObjectsInRange (PortableServer_Servant servant,
+ GNOME_Evolution_Calendar_CalObjType type,
+ GNOME_Evolution_Calendar_Time_t start,
+ GNOME_Evolution_Calendar_Time_t end,
+ CORBA_Environment *ev)
{
Cal *cal;
CalPrivate *priv;
@@ -305,13 +306,13 @@ build_fb_seq (GList *obj_list)
return seq;
}
-/* Cal::get_free_busy method */
+/* Cal::getFreeBusy method */
static GNOME_Evolution_Calendar_CalObjSeq *
-impl_Cal_get_free_busy (PortableServer_Servant servant,
- const GNOME_Evolution_Calendar_UserList *user_list,
- const GNOME_Evolution_Calendar_Time_t start,
- const GNOME_Evolution_Calendar_Time_t end,
- CORBA_Environment *ev)
+impl_Cal_getFreeBusy (PortableServer_Servant servant,
+ const GNOME_Evolution_Calendar_UserList *user_list,
+ const GNOME_Evolution_Calendar_Time_t start,
+ const GNOME_Evolution_Calendar_Time_t end,
+ CORBA_Environment *ev)
{
Cal *cal;
CalPrivate *priv;
@@ -350,12 +351,12 @@ impl_Cal_get_free_busy (PortableServer_Servant servant,
return seq;
}
-/* Cal::get_alarms_in_range method */
+/* Cal::getAlarmsInRange method */
static GNOME_Evolution_Calendar_CalComponentAlarmsSeq *
-impl_Cal_get_alarms_in_range (PortableServer_Servant servant,
- GNOME_Evolution_Calendar_Time_t start,
- GNOME_Evolution_Calendar_Time_t end,
- CORBA_Environment *ev)
+impl_Cal_getAlarmsInRange (PortableServer_Servant servant,
+ GNOME_Evolution_Calendar_Time_t start,
+ GNOME_Evolution_Calendar_Time_t end,
+ CORBA_Environment *ev)
{
Cal *cal;
CalPrivate *priv;
@@ -383,13 +384,13 @@ impl_Cal_get_alarms_in_range (PortableServer_Servant servant,
return seq;
}
-/* Cal::get_alarms_for_object method */
+/* Cal::getAlarmsForObject method */
static GNOME_Evolution_Calendar_CalComponentAlarms *
-impl_Cal_get_alarms_for_object (PortableServer_Servant servant,
- const GNOME_Evolution_Calendar_CalObjUID uid,
- GNOME_Evolution_Calendar_Time_t start,
- GNOME_Evolution_Calendar_Time_t end,
- CORBA_Environment * ev)
+impl_Cal_getAlarmsForObject (PortableServer_Servant servant,
+ const CORBA_char *uid,
+ GNOME_Evolution_Calendar_Time_t start,
+ GNOME_Evolution_Calendar_Time_t end,
+ CORBA_Environment * ev)
{
Cal *cal;
CalPrivate *priv;
@@ -423,11 +424,11 @@ impl_Cal_get_alarms_for_object (PortableServer_Servant servant,
}
}
-/* Cal::update_objects method */
+/* Cal::updateObjects method */
static void
-impl_Cal_update_objects (PortableServer_Servant servant,
- const GNOME_Evolution_Calendar_CalObj calobj,
- CORBA_Environment *ev)
+impl_Cal_updateObjects (PortableServer_Servant servant,
+ const CORBA_char *calobj,
+ CORBA_Environment *ev)
{
Cal *cal;
CalPrivate *priv;
@@ -452,11 +453,11 @@ impl_Cal_update_objects (PortableServer_Servant servant,
}
}
-/* Cal::remove_object method */
+/* Cal::removeObject method */
static void
-impl_Cal_remove_object (PortableServer_Servant servant,
- const GNOME_Evolution_Calendar_CalObjUID uid,
- CORBA_Environment *ev)
+impl_Cal_removeObject (PortableServer_Servant servant,
+ const CORBA_char *uid,
+ CORBA_Environment *ev)
{
Cal *cal;
CalPrivate *priv;
@@ -481,12 +482,12 @@ impl_Cal_remove_object (PortableServer_Servant servant,
}
}
-/* Cal::send_object method */
+/* Cal::sendObject method */
static GNOME_Evolution_Calendar_CalObj
-impl_Cal_send_object (PortableServer_Servant servant,
- const GNOME_Evolution_Calendar_CalObj calobj,
- GNOME_Evolution_Calendar_UserList **user_list,
- CORBA_Environment *ev)
+impl_Cal_sendObject (PortableServer_Servant servant,
+ const CORBA_char *calobj,
+ GNOME_Evolution_Calendar_UserList **user_list,
+ CORBA_Environment *ev)
{
Cal *cal;
CalPrivate *priv;
@@ -530,10 +531,10 @@ impl_Cal_send_object (PortableServer_Servant servant,
/* Cal::getQuery implementation */
static GNOME_Evolution_Calendar_Query
-impl_Cal_get_query (PortableServer_Servant servant,
- const CORBA_char *sexp,
- GNOME_Evolution_Calendar_QueryListener ql,
- CORBA_Environment *ev)
+impl_Cal_getQuery (PortableServer_Servant servant,
+ const CORBA_char *sexp,
+ GNOME_Evolution_Calendar_QueryListener ql,
+ CORBA_Environment *ev)
{
Cal *cal;
CalPrivate *priv;
@@ -565,11 +566,11 @@ impl_Cal_get_query (PortableServer_Servant servant,
return query_copy;
}
-/* Cal::set_default_timezone method */
+/* Cal::setDefaultTimezone method */
static void
-impl_Cal_set_default_timezone (PortableServer_Servant servant,
- const GNOME_Evolution_Calendar_CalTimezoneObjUID tzid,
- CORBA_Environment *ev)
+impl_Cal_setDefaultTimezone (PortableServer_Servant servant,
+ const CORBA_char *tzid,
+ CORBA_Environment *ev)
{
Cal *cal;
CalPrivate *priv;
@@ -585,11 +586,11 @@ impl_Cal_set_default_timezone (PortableServer_Servant servant,
}
}
-/* Cal::get_timezone_object method */
+/* Cal::getTimezoneObject method */
static GNOME_Evolution_Calendar_CalObj
-impl_Cal_get_timezone_object (PortableServer_Servant servant,
- const GNOME_Evolution_Calendar_CalTimezoneObjUID tzid,
- CORBA_Environment *ev)
+impl_Cal_getTimezoneObject (PortableServer_Servant servant,
+ const CORBA_char *tzid,
+ CORBA_Environment *ev)
{
Cal *cal;
CalPrivate *priv;
@@ -746,23 +747,23 @@ cal_class_init (CalClass *klass)
/* Epv methods */
epv->_get_uri = impl_Cal_get_uri;
- epv->isReadOnly = impl_Cal_is_read_only;
- epv->getEmailAddress = impl_Cal_get_email_address;
- epv->setMode = impl_Cal_set_mode;
- epv->countObjects = impl_Cal_get_n_objects;
- epv->getObject = impl_Cal_get_object;
- epv->setDefaultTimezone = impl_Cal_set_default_timezone;
- epv->getTimezoneObject = impl_Cal_get_timezone_object;
- epv->getUIDs = impl_Cal_get_uids;
- epv->getChanges = impl_Cal_get_changes;
- epv->getObjectsInRange = impl_Cal_get_objects_in_range;
- epv->getFreeBusy = impl_Cal_get_free_busy;
- epv->getAlarmsInRange = impl_Cal_get_alarms_in_range;
- epv->getAlarmsForObject = impl_Cal_get_alarms_for_object;
- epv->updateObjects = impl_Cal_update_objects;
- epv->removeObject = impl_Cal_remove_object;
- epv->sendObject = impl_Cal_send_object;
- epv->getQuery = impl_Cal_get_query;
+ epv->isReadOnly = impl_Cal_isReadOnly;
+ epv->getEmailAddress = impl_Cal_getEmailAddress;
+ epv->setMode = impl_Cal_setMode;
+ epv->countObjects = impl_Cal_countObjects;
+ epv->getObject = impl_Cal_getObject;
+ epv->setDefaultTimezone = impl_Cal_setDefaultTimezone;
+ epv->getTimezoneObject = impl_Cal_getTimezoneObject;
+ epv->getUIDs = impl_Cal_getUIDs;
+ epv->getChanges = impl_Cal_getChanges;
+ epv->getObjectsInRange = impl_Cal_getObjectsInRange;
+ epv->getFreeBusy = impl_Cal_getFreeBusy;
+ epv->getAlarmsInRange = impl_Cal_getAlarmsInRange;
+ epv->getAlarmsForObject = impl_Cal_getAlarmsForObject;
+ epv->updateObjects = impl_Cal_updateObjects;
+ epv->removeObject = impl_Cal_removeObject;
+ epv->sendObject = impl_Cal_sendObject;
+ epv->getQuery = impl_Cal_getQuery;
}