aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/gui')
-rw-r--r--calendar/gui/alarm-notify/GNOME_Evolution_Calendar_AlarmNotify.server.in.in10
-rw-r--r--calendar/gui/alarm-notify/alarm-notify.c99
-rw-r--r--calendar/gui/alarm-notify/alarm-notify.h13
-rw-r--r--calendar/gui/alarm-notify/notify-main.c30
-rw-r--r--calendar/gui/gnome-cal.c50
-rw-r--r--calendar/gui/main.c2
6 files changed, 54 insertions, 150 deletions
diff --git a/calendar/gui/alarm-notify/GNOME_Evolution_Calendar_AlarmNotify.server.in.in b/calendar/gui/alarm-notify/GNOME_Evolution_Calendar_AlarmNotify.server.in.in
index 4b34fbdc7b..24e5d88ed9 100644
--- a/calendar/gui/alarm-notify/GNOME_Evolution_Calendar_AlarmNotify.server.in.in
+++ b/calendar/gui/alarm-notify/GNOME_Evolution_Calendar_AlarmNotify.server.in.in
@@ -1,6 +1,6 @@
<oaf_info>
-<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_AlarmNotify_Factory"
+<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_AlarmNotify"
type="exe"
location="@LIBEXECDIR@/evolution-alarm-notify">
@@ -13,12 +13,4 @@
</oaf_server>
-<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_AlarmNotify"
- type="factory"
- location="OAFIID:GNOME_Evolution_Calendar_AlarmNotify_Factory">
-
- <oaf_attribute name="name" type="string"
- _value="Evolution Calendar alarm notification service"/>
-</oaf_server>
-
</oaf_info>
diff --git a/calendar/gui/alarm-notify/alarm-notify.c b/calendar/gui/alarm-notify/alarm-notify.c
index 267a1001ca..fa43e2bab6 100644
--- a/calendar/gui/alarm-notify/alarm-notify.c
+++ b/calendar/gui/alarm-notify/alarm-notify.c
@@ -43,22 +43,32 @@ static void alarm_notify_class_init (AlarmNotifyClass *klass);
static void alarm_notify_init (AlarmNotify *an, AlarmNotifyClass *klass);
static void alarm_notify_finalize (GObject *object);
-static void AlarmNotify_addCalendar (PortableServer_Servant servant,
- const CORBA_char *str_uri,
- CORBA_Environment *ev);
-static void AlarmNotify_removeCalendar (PortableServer_Servant servant,
- const CORBA_char *str_uri,
- CORBA_Environment *ev);
-
static BonoboObjectClass *parent_class;
-BONOBO_TYPE_FUNC_FULL (AlarmNotify,
- GNOME_Evolution_Calendar_AlarmNotify,
- BONOBO_TYPE_OBJECT,
- alarm_notify);
+GType
+alarm_notify_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type) {
+ static GTypeInfo info = {
+ sizeof (AlarmNotifyClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) alarm_notify_class_init,
+ NULL, NULL,
+ sizeof (AlarmNotify),
+ 0,
+ (GInstanceInitFunc) alarm_notify_init
+ };
+ type = g_type_register_static (G_TYPE_OBJECT, "AlarmNotify", &info, 0);
+ }
+
+ return type;
+}
/* Class initialization function for the alarm notify service */
static void
@@ -70,9 +80,6 @@ alarm_notify_class_init (AlarmNotifyClass *klass)
parent_class = g_type_class_peek_parent (klass);
- klass->epv.addCalendar = AlarmNotify_addCalendar;
- klass->epv.removeCalendar = AlarmNotify_removeCalendar;
-
object_class->finalize = alarm_notify_finalize;
}
@@ -122,8 +129,6 @@ alarm_notify_finalize (GObject *object)
-/* CORBA servant implementation */
-
/* Looks for a canonicalized URI inside an array of URIs; returns the index
* within the array or -1 if not found.
*/
@@ -228,41 +233,6 @@ remove_uri_to_load (const char *str_uri)
free_uris (loaded_uris);
}
-/* AlarmNotify::addCalendar method */
-static void
-AlarmNotify_addCalendar (PortableServer_Servant servant,
- const CORBA_char *str_uri,
- CORBA_Environment *ev)
-{
- AlarmNotify *an;
-
- an = ALARM_NOTIFY (bonobo_object_from_servant (servant));
- alarm_notify_add_calendar (an, str_uri, TRUE, ev);
-}
-
-/* AlarmNotify::removeCalendar method */
-static void
-AlarmNotify_removeCalendar (PortableServer_Servant servant,
- const CORBA_char *str_uri,
- CORBA_Environment *ev)
-{
- AlarmNotify *an;
- AlarmNotifyPrivate *priv;
- ECal *client;
-
- an = ALARM_NOTIFY (bonobo_object_from_servant (servant));
- priv = an->priv;
-
- client = g_hash_table_lookup (priv->uri_client_hash, str_uri);
- if (client) {
- alarm_queue_remove_client (client);
-
- g_hash_table_remove (priv->uri_client_hash, str_uri);
- }
-
- remove_uri_to_load (str_uri);
-}
-
/**
@@ -288,15 +258,13 @@ alarm_notify_new (void)
* @uri: URI of the calendar to load.
* @load_afterwards: Whether this calendar should be loaded in the future
* when the alarm daemon starts up.
- * @ev: CORBA environment for exceptions.
*
* Tells the alarm notification service to load a calendar and start monitoring
* its alarms. It can optionally be made to save the URI of this calendar so
* that it can be loaded in the future when the alarm daemon starts up.
**/
void
-alarm_notify_add_calendar (AlarmNotify *an, const char *str_uri, gboolean load_afterwards,
- CORBA_Environment *ev)
+alarm_notify_add_calendar (AlarmNotify *an, const char *str_uri, gboolean load_afterwards)
{
AlarmNotifyPrivate *priv;
ECal *client;
@@ -304,7 +272,6 @@ alarm_notify_add_calendar (AlarmNotify *an, const char *str_uri, gboolean load_a
g_return_if_fail (an != NULL);
g_return_if_fail (IS_ALARM_NOTIFY (an));
g_return_if_fail (str_uri != NULL);
- g_return_if_fail (ev != NULL);
priv = an->priv;
@@ -321,10 +288,22 @@ alarm_notify_add_calendar (AlarmNotify *an, const char *str_uri, gboolean load_a
g_hash_table_insert (priv->uri_client_hash,
g_strdup (str_uri), client);
}
- } else {
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
- ex_GNOME_Evolution_Calendar_AlarmNotify_BackendContactError,
- NULL);
- return;
}
}
+
+void
+alarm_notify_remove_calendar (AlarmNotify *an, const char *str_uri)
+{
+ AlarmNotifyPrivate *priv;
+ ECal *client;
+
+ priv = an->priv;
+
+ client = g_hash_table_lookup (priv->uri_client_hash, str_uri);
+ if (client) {
+ alarm_queue_remove_client (client);
+
+ g_hash_table_remove (priv->uri_client_hash, str_uri);
+ }
+ remove_uri_to_load (str_uri);
+}
diff --git a/calendar/gui/alarm-notify/alarm-notify.h b/calendar/gui/alarm-notify/alarm-notify.h
index f3157000c0..418ae23878 100644
--- a/calendar/gui/alarm-notify/alarm-notify.h
+++ b/calendar/gui/alarm-notify/alarm-notify.h
@@ -22,8 +22,7 @@
#ifndef ALARM_NOTIFY_H
#define ALARM_NOTIFY_H
-#include <bonobo/bonobo-object.h>
-#include "evolution-calendar.h"
+#include <glib-object.h>
@@ -40,24 +39,22 @@ typedef struct _AlarmNotifyClass AlarmNotifyClass;
typedef struct _AlarmNotifyPrivate AlarmNotifyPrivate;
struct _AlarmNotify {
- BonoboObject xobject;
+ GObject object;
/* Private data */
AlarmNotifyPrivate *priv;
};
struct _AlarmNotifyClass {
- BonoboObjectClass parent_class;
-
- POA_GNOME_Evolution_Calendar_AlarmNotify__epv epv;
+ GObjectClass parent_class;
};
GType alarm_notify_get_type (void);
AlarmNotify *alarm_notify_new (void);
-void alarm_notify_add_calendar (AlarmNotify *an, const char *str_uri, gboolean load_afterwards,
- CORBA_Environment *ev);
+void alarm_notify_add_calendar (AlarmNotify *an, const char *str_uri, gboolean load_afterwards);
+void alarm_notify_remove_calendar (AlarmNotify *an, const char *str_uri);
diff --git a/calendar/gui/alarm-notify/notify-main.c b/calendar/gui/alarm-notify/notify-main.c
index bed7de3653..8e492386fa 100644
--- a/calendar/gui/alarm-notify/notify-main.c
+++ b/calendar/gui/alarm-notify/notify-main.c
@@ -1,8 +1,10 @@
/* Evolution calendar - Alarm notification service main file
*
* Copyright (C) 2000 Ximian, Inc.
+ * Copyright (C) 2003 Novell, 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 version 2 of the GNU General Public
@@ -99,8 +101,7 @@ alarm_notify_factory_fn (BonoboGenericFactory *factory, const char *component_id
g_assert (alarm_notify_service != NULL);
}
- bonobo_object_ref (BONOBO_OBJECT (alarm_notify_service));
- return BONOBO_OBJECT (alarm_notify_service);
+ return NULL;
}
/* Loads the calendars that the alarm daemon has been told to load in the past */
@@ -126,29 +127,10 @@ load_calendars (gpointer user_data)
for (i = 0; i < uris->len; i++) {
char *uri;
- CORBA_Environment ev;
uri = uris->pdata[i];
- CORBA_exception_init (&ev);
- alarm_notify_add_calendar (alarm_notify_service, uri, FALSE, &ev);
-
- if (ev._major == CORBA_USER_EXCEPTION) {
- char *ex_id;
-
- ex_id = CORBA_exception_id (&ev);
- if (strcmp (ex_id, ex_GNOME_Evolution_Calendar_AlarmNotify_InvalidURI) == 0)
- g_message ("load_calendars(): Invalid URI `%s'; will not load "
- "that calendar.", uri);
- else if (strcmp (ex_id,
- ex_GNOME_Evolution_Calendar_AlarmNotify_BackendContactError)
- == 0)
- g_message ("load_calendars(): Could not contact the backend "
- "while trying to load `%s'", uri);
- } else if (ev._major != CORBA_NO_EXCEPTION)
- g_message ("load_calendars(): Exception while loading calendar `%s'", uri);
-
- CORBA_exception_free (&ev);
+ alarm_notify_add_calendar (alarm_notify_service, uri, FALSE);
g_free (uri);
}
@@ -178,7 +160,7 @@ main (int argc, char **argv)
gnome_sound_init ("localhost");
- factory = bonobo_generic_factory_new ("OAFIID:GNOME_Evolution_Calendar_AlarmNotify_Factory",
+ factory = bonobo_generic_factory_new ("OAFIID:GNOME_Evolution_Calendar_AlarmNotify",
(BonoboFactoryCallback) alarm_notify_factory_fn, NULL);
if (!factory)
g_error (_("Could not create the alarm notify service factory"));
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 3cc8e4e0cc..8c8f07f18c 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -4,10 +4,12 @@
* Copyright (C) 1998 The Free Software Foundation
* Copyright (C) 2000 Ximian, Inc.
* Copyright (C) 2001 Ximian, Inc.
+ * Copyright (C) 2003 Novell, Inc
*
* Authors: Miguel de Icaza <miguel@ximian.com>
* Federico Mena-Quintero <federico@ximian.com>
* Seth Alves <alves@hungry.com>
+ * Rodrigo Moya <rodrigo@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
@@ -203,7 +205,6 @@ static void gnome_calendar_on_date_navigator_selection_changed (ECalendarItem
GnomeCalendar *gcal);
static void gnome_calendar_notify_dates_shown_changed (GnomeCalendar *gcal);
-static void add_alarms (const char *uri);
static void update_query (GnomeCalendar *gcal);
@@ -1818,7 +1819,6 @@ client_cal_opened_cb (ECal *client, ECalendarStatus status, gpointer data)
}
g_free (msg);
- add_alarms (e_cal_get_uri (client));
break;
case E_CALENDAR_STATUS_OTHER_ERROR:
@@ -2135,52 +2135,6 @@ gnome_calendar_get_task_pad_e_cal (GnomeCalendar *gcal)
return priv->task_pad_client;
}
-/* Adds the specified URI to the alarm notification service */
-static void
-add_alarms (const char *uri)
-{
- CORBA_Environment ev;
- GNOME_Evolution_Calendar_AlarmNotify an;
-
- /* Activate the alarm notification service */
-
- CORBA_exception_init (&ev);
- an = bonobo_activation_activate_from_id ("OAFIID:GNOME_Evolution_Calendar_AlarmNotify", 0, NULL, &ev);
-
- if (BONOBO_EX (&ev)) {
- g_warning ("add_alarms(): Could not activate the alarm notification service: %s",
- CORBA_exception_id (&ev));
- CORBA_exception_free (&ev);
- return;
- }
- CORBA_exception_free (&ev);
-
- /* Ask the service to load the URI */
-
- CORBA_exception_init (&ev);
- GNOME_Evolution_Calendar_AlarmNotify_addCalendar (an, uri, &ev);
-
- if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_AlarmNotify_InvalidURI))
- g_message ("add_calendar(): Invalid URI reported from the "
- "alarm notification service");
- else if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_AlarmNotify_BackendContactError))
- g_message ("add_calendar(): The alarm notification service could "
- "not contact the backend");
- else if (BONOBO_EX (&ev))
- g_message ("add_calendar(): Could not issue the addCalendar request");
-
- CORBA_exception_free (&ev);
-
- /* Get rid of the service */
-
- CORBA_exception_init (&ev);
- bonobo_object_release_unref (an, &ev);
- if (BONOBO_EX (&ev))
- g_message ("add_alarms(): Could not unref the alarm notification service");
-
- CORBA_exception_free (&ev);
-}
-
/**
* gnome_calendar_add_event_uri:
* @gcal: A GnomeCalendar.
diff --git a/calendar/gui/main.c b/calendar/gui/main.c
index 73b3705b3c..4c9fa25ba6 100644
--- a/calendar/gui/main.c
+++ b/calendar/gui/main.c
@@ -90,7 +90,7 @@ static gboolean
launch_alarm_daemon_cb (gpointer data)
{
CORBA_Environment ev;
- GNOME_Evolution_Calendar_AlarmNotify an;
+ CORBA_Object an;
guint *idle_id = (guint *) data;
/* remove the idle function */