diff options
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/GNOME_Evolution_Calendar.oaf.in | 25 | ||||
-rw-r--r-- | calendar/gui/GNOME_Evolution_Calendar.oafinfo | 89 | ||||
-rw-r--r-- | calendar/gui/GNOME_Evolution_Calendar_Control.oaf.in | 28 | ||||
-rw-r--r-- | calendar/gui/GNOME_Evolution_Calendar_Control.oafinfo | 28 | ||||
-rw-r--r-- | calendar/gui/GNOME_Evolution_Calendar_gnomecal.oaf.in | 27 | ||||
-rw-r--r-- | calendar/gui/GNOME_Evolution_Calendar_gnomecal.oafinfo | 27 | ||||
-rw-r--r-- | calendar/gui/Makefile.am | 8 | ||||
-rw-r--r-- | calendar/gui/alarm-notify/.cvsignore | 2 | ||||
-rw-r--r-- | calendar/gui/alarm-notify/GNOME_Evolution_Calendar_AlarmNotify.oaf.in | 24 | ||||
-rw-r--r-- | calendar/gui/alarm-notify/Makefile.am | 10 | ||||
-rw-r--r-- | calendar/gui/alarm-notify/alarm-notify.c | 107 | ||||
-rw-r--r-- | calendar/gui/alarm-notify/alarm-queue.c | 12 |
12 files changed, 157 insertions, 230 deletions
diff --git a/calendar/gui/GNOME_Evolution_Calendar.oaf.in b/calendar/gui/GNOME_Evolution_Calendar.oaf.in index e96e4b7c8a..0f74743a38 100644 --- a/calendar/gui/GNOME_Evolution_Calendar.oaf.in +++ b/calendar/gui/GNOME_Evolution_Calendar.oaf.in @@ -86,4 +86,29 @@ _value="Evolution calendar executive summary component."/> </oaf_server> +<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_ControlFactory" + type="exe" + location="evolution-calendar"> + + <oaf_attribute name="repo_ids" type="stringv"> + <item value="IDL:GNOME/ObjectFactory:1.0"/> + </oaf_attribute> + + <oaf_attribute name="description" type="string" + _value="Factory for the sample Calendar control"/> +</oaf_server> + +<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_Control" + type="factory" + location="OAFIID:GNOME_Evolution_Calendar_ControlFactory"> + + <oaf_attribute name="repo_ids" type="stringv"> + <item value="IDL:BonoboControl/calendar-control:1.0"/> + <item value="IDL:Bonobo/Control:1.0"/> + </oaf_attribute> + + <oaf_attribute name="description" type="string" + _value="A sample Bonobo control which displays an calendar."/> +</oaf_server> + </oaf_info> diff --git a/calendar/gui/GNOME_Evolution_Calendar.oafinfo b/calendar/gui/GNOME_Evolution_Calendar.oafinfo deleted file mode 100644 index 75aa4a6b0f..0000000000 --- a/calendar/gui/GNOME_Evolution_Calendar.oafinfo +++ /dev/null @@ -1,89 +0,0 @@ -<oaf_info> - -<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_iTip_ControlFactory" - type="exe" - location="evolution-calendar"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/ObjectFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="Factory for the calendar iTip view control"/> - -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_iTip_Control" - type="factory" - location="OAFIID:GNOME_Evolution_Calendar_iTip_ControlFactory"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:Bonobo/Control:1.0"/> - <item value="IDL:Bonobo/PersistStream:1.0"/> - </oaf_attribute> - - <oaf_attribute name="bonobo:supported_mime_types" type="stringv"> - <item value="text/calendar"/> - <item value="text/x-calendar"/> - </oaf_attribute> - - <oaf_attribute name="name" type="string" - value="Evolution calendar iTip/iMip viewer"/> - <oaf_attribute name="description" type="string" - value="Factory for the calendar iTip view control"/> - -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_ShellComponentFactory" - type="exe" - location="evolution-calendar"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/ObjectFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="Factory for the Evolution calendar component."/> - -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_ShellComponent" - type="factory" - location="OAFIID:GNOME_Evolution_Calendar_ShellComponentFactory"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/Evolution/ShellComponent:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="Evolution component for handling the calendar."/> - - <oaf_attribute name="evolution:shell-component-icon" type="string" - value="evolution-calendar.png"/> -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_Summary_ComponentFactory" - type="exe" - location="evolution-calendar"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME:GenericFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="Factory for the Calendar Summary component."/> -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_Summary_Component" - type="factory" - location="OAFIID:GNOME_Evolution_Calendar_Summary_ComponentFactory"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/Evolution:Summary:ComponentFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="Evolution calendar executive summary component."/> -</oaf_server> - -</oaf_info> diff --git a/calendar/gui/GNOME_Evolution_Calendar_Control.oaf.in b/calendar/gui/GNOME_Evolution_Calendar_Control.oaf.in deleted file mode 100644 index d241806784..0000000000 --- a/calendar/gui/GNOME_Evolution_Calendar_Control.oaf.in +++ /dev/null @@ -1,28 +0,0 @@ -<oaf_info> - -<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_ControlFactory" - type="exe" - location="evolution-calendar"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/ObjectFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="Factory for the sample Calendar control"/> -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_Control" - type="factory" - location="OAFIID:GNOME_Evolution_Calendar_ControlFactory"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:BonoboControl/calendar-control:1.0"/> - <item value="IDL:Bonobo/Control:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="A sample Bonobo control which displays an calendar."/> -</oaf_server> - -</oaf_info> diff --git a/calendar/gui/GNOME_Evolution_Calendar_Control.oafinfo b/calendar/gui/GNOME_Evolution_Calendar_Control.oafinfo deleted file mode 100644 index 48cbfa7cbb..0000000000 --- a/calendar/gui/GNOME_Evolution_Calendar_Control.oafinfo +++ /dev/null @@ -1,28 +0,0 @@ -<oaf_info> - -<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_ControlFactory" - type="exe" - location="evolution-calendar"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/ObjectFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="Factory for the sample Calendar control"/> -</oaf_server> - -<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_Control" - type="factory" - location="OAFIID:GNOME_Evolution_Calendar_ControlFactory"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:BonoboControl/calendar-control:1.0"/> - <item value="IDL:Bonobo/Control:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="A sample Bonobo control which displays an calendar."/> -</oaf_server> - -</oaf_info> diff --git a/calendar/gui/GNOME_Evolution_Calendar_gnomecal.oaf.in b/calendar/gui/GNOME_Evolution_Calendar_gnomecal.oaf.in deleted file mode 100644 index 3719ba618b..0000000000 --- a/calendar/gui/GNOME_Evolution_Calendar_gnomecal.oaf.in +++ /dev/null @@ -1,27 +0,0 @@ -<oaf_info> - -<oaf_server iid="OAFIID:IDL:GNOME:Calendar:Repository:1.0:56989bb6-65a1-430c-86a8-81bbe64bf7ab" - type="factory" - location="OAFIID:IDL:GNOME:Calendar:RepositoryLocator:1.0:83b25bb0-b68b-4c6b-86e7-c303e9897c21"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:Gnome/Calendar/Repository:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="Calendar Repository"/> -</oaf_server> - -<oaf_server iid="OAFIID:IDL:GNOME:Calendar:RepositoryLocator:1.0:83b25bb0-b68b-4c6b-86e7-c303e9897c21" - type="exe" - location="gnomecal"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/GenericFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - _value="Calendar Server"/> -</oaf_server> - -</oaf_info> diff --git a/calendar/gui/GNOME_Evolution_Calendar_gnomecal.oafinfo b/calendar/gui/GNOME_Evolution_Calendar_gnomecal.oafinfo deleted file mode 100644 index c4b91b9dd8..0000000000 --- a/calendar/gui/GNOME_Evolution_Calendar_gnomecal.oafinfo +++ /dev/null @@ -1,27 +0,0 @@ -<oaf_info> - -<oaf_server iid="OAFIID:IDL:GNOME:Calendar:Repository:1.0:56989bb6-65a1-430c-86a8-81bbe64bf7ab" - type="factory" - location="OAFIID:IDL:GNOME:Calendar:RepositoryLocator:1.0:83b25bb0-b68b-4c6b-86e7-c303e9897c21"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:Gnome/Calendar/Repository:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="Calendar Repository"/> -</oaf_server> - -<oaf_server iid="OAFIID:IDL:GNOME:Calendar:RepositoryLocator:1.0:83b25bb0-b68b-4c6b-86e7-c303e9897c21" - type="exe" - location="gnomecal"> - - <oaf_attribute name="repo_ids" type="stringv"> - <item value="IDL:GNOME/GenericFactory:1.0"/> - </oaf_attribute> - - <oaf_attribute name="description" type="string" - value="Calendar Server"/> -</oaf_server> - -</oaf_info> diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am index 432acf0676..d6b7e6edea 100644 --- a/calendar/gui/Makefile.am +++ b/calendar/gui/Makefile.am @@ -13,8 +13,8 @@ $(IDL_GENERATED): $(IDLS) $(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl `$(GNOME_CONFIG) --cflags idl` \ $(srcdir)/../../composer/Evolution-Composer.idl -#SUBDIRS = alarm-notify dialogs -SUBDIRS = dialogs +SUBDIRS = alarm-notify dialogs +#SUBDIRS = dialogs help_base = $(datadir)/gnome/help/cal @@ -134,9 +134,7 @@ evolution_calendar_LDADD = \ oafdir = $(datadir)/oaf oaf_in_files = \ - GNOME_Evolution_Calendar_Control.oaf.in \ - GNOME_Evolution_Calendar.oaf.in \ - GNOME_Evolution_Calendar_gnomecal.oaf.in + GNOME_Evolution_Calendar.oaf.in oaf_DATA = $(oaf_in_files:.oaf.in=.oaf) diff --git a/calendar/gui/alarm-notify/.cvsignore b/calendar/gui/alarm-notify/.cvsignore index fa1c1f7c87..1f2b546c7c 100644 --- a/calendar/gui/alarm-notify/.cvsignore +++ b/calendar/gui/alarm-notify/.cvsignore @@ -6,3 +6,5 @@ evolution-calendar-stubs.c evolution-calendar-skels.c evolution-calendar-common.c evolution-calendar.h +evolution-alarm-notify +GNOME_Evolution_Calendar_AlarmNotify.oaf diff --git a/calendar/gui/alarm-notify/GNOME_Evolution_Calendar_AlarmNotify.oaf.in b/calendar/gui/alarm-notify/GNOME_Evolution_Calendar_AlarmNotify.oaf.in new file mode 100644 index 0000000000..86f5c71493 --- /dev/null +++ b/calendar/gui/alarm-notify/GNOME_Evolution_Calendar_AlarmNotify.oaf.in @@ -0,0 +1,24 @@ +<oaf_info> + +<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_AlarmNotify_Factory" + type="exe" + location="evolution-alarm-notify"> + + <oaf_attribute name="repo_ids" type="stringv"> + <item value="IDL:GNOME/ObjectFactory:1.0"/> + </oaf_attribute> + + <oaf_attribute name="description" type="string" + _value="Factory for the alarm notification service"/> + +</oaf_server> + +<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_AlarmNotify" + type="factory" + location="OAFIID:GNOME_Evolution_Calendar_AlarmNotify_Factory"> + + <oaf_attribute name="description" type="string" + _value="Alarm notification service"/> +</oaf_server> + +</oaf_info> diff --git a/calendar/gui/alarm-notify/Makefile.am b/calendar/gui/alarm-notify/Makefile.am index 5df0b3c234..3201f062f6 100644 --- a/calendar/gui/alarm-notify/Makefile.am +++ b/calendar/gui/alarm-notify/Makefile.am @@ -47,10 +47,16 @@ evolution_alarm_notify_LDADD = \ $(INTLLIBS) oafdir = $(datadir)/oaf -oaf_DATA = GNOME_Evolution_Calendar_AlarmNotify.oafinfo +oaf_in_files = \ + GNOME_Evolution_Calendar_AlarmNotify.oaf.in + +oaf_DATA = $(oaf_in_files:.oaf.in=.oaf) + +@XML_I18N_MERGE_OAF_RULE@ EXTRA_DIST = \ - $(oaf_DATA) + $(oaf_DATA) \ + $(oaf_in_files) BUILT_SOURCES = $(CORBA_GENERATED) CLEANFILES += $(BUILT_SOURCES) diff --git a/calendar/gui/alarm-notify/alarm-notify.c b/calendar/gui/alarm-notify/alarm-notify.c index 9d64bfd4a8..fa70a1d236 100644 --- a/calendar/gui/alarm-notify/alarm-notify.c +++ b/calendar/gui/alarm-notify/alarm-notify.c @@ -27,12 +27,29 @@ #include <libgnomevfs/gnome-vfs.h> #include <cal-client/cal-client.h> #include "alarm-notify.h" +#include "alarm-queue.h" +/* A loaded client */ +typedef struct { + /* The actual client */ + CalClient *client; + + /* The URI of the client in gnome-vfs's format. This *is* the key that + * is stored in the uri_client_hash hash table below. + */ + GnomeVFSURI *uri; + + /* Number of times clients have requested this URI to be added to the + * alarm notification system. + */ + int refcount; +} LoadedClient; + /* Private part of the AlarmNotify structure */ struct _AlarmNotifyPrivate { - /* Mapping from GnomeVFSURIs to loaded clients */ + /* Mapping from GnomeVFSURIs to LoadedClient structures */ GHashTable *uri_client_hash; }; @@ -114,6 +131,19 @@ alarm_notify_init (AlarmNotify *an) priv->uri_client_hash = g_hash_table_new (gnome_vfs_uri_hash, gnome_vfs_uri_hequal); } +/* Callback used from g_hash-table_forach(), used to destroy a loade client */ +static void +destroy_loaded_client_cb (gpointer key, gpointer value, gpointer data) +{ + LoadedClient *lc; + + lc = value; + + gtk_object_unref (GTK_OBJECT (lc->client)); + gnome_vfs_uri_unref (lc->uri); + g_free (lc); +} + /* Destroy handler for the alarm notify system */ static void alarm_notify_destroy (GtkObject *object) @@ -127,7 +157,7 @@ alarm_notify_destroy (GtkObject *object) an = ALARM_NOTIFY (object); priv = an->priv; - /* FIXME */ + g_hash_table_foreach (priv->uri_client_hash, destroy_loaded_client_cb, NULL); g_hash_table_destroy (priv->uri_client_hash); priv->uri_client_hash = NULL; @@ -153,6 +183,7 @@ AlarmNotify_addCalendar (PortableServer_Servant servant, AlarmNotifyPrivate *priv; GnomeVFSURI *uri; CalClient *client; + LoadedClient *lc; an = ALARM_NOTIFY (bonobo_object_from_servant (servant)); priv = an->priv; @@ -165,26 +196,33 @@ AlarmNotify_addCalendar (PortableServer_Servant servant, return; } - client = g_hash_table_lookup (priv->uri_client_hash, uri); + lc = g_hash_table_lookup (priv->uri_client_hash, uri); - if (client) { + if (lc) { gnome_vfs_uri_unref (uri); - - gtk_object_ref (GTK_OBJECT (client)); + g_assert (lc->refcount > 0); + lc->refcount++; return; } client = cal_client_new (); if (client) { - g_hash_table_insert (priv->uri_client_hash, uri); - alarm_queue_add_client (client); - - if (!cal_client_open_calendar (client, str_uri, FALSE)) { + if (cal_client_open_calendar (client, str_uri, FALSE)) { + lc = g_new (LoadedClient, 1); + lc->client = client; + lc->uri = uri; + lc->refcount = 1; + g_hash_table_insert (priv->uri_client_hash, uri, lc); + + alarm_queue_add_client (client); + } else { gtk_object_unref (GTK_OBJECT (client)); client = NULL; } - } else { + } + + if (!client) { gnome_vfs_uri_unref (uri); CORBA_exception_set (ev, CORBA_USER_EXCEPTION, @@ -197,26 +235,59 @@ AlarmNotify_addCalendar (PortableServer_Servant servant, /* AlarmNotify::removeCalendar method */ static void AlarmNotify_removeCalendar (PortableServer_Servant servant, - const CORBA_char *uri, + const CORBA_char *str_uri, CORBA_Environment *ev) { AlarmNotify *an; AlarmNotifyPrivate *priv; - CalClient *client; - char *orig_uri; + LoadedClient *lc; + GnomeVFSURI *uri; an = ALARM_NOTIFY (bonobo_object_from_servant (servant)); priv = an->priv; - if (!g_hash_table_lookup_extended (priv->uri_client_hash, uri, &orig_uri, &client)) { + uri = gnome_vfs_uri_new (str_uri); + if (!uri) { CORBA_exception_set (ev, CORBA_USER_EXCEPTION, - ex_GNOME_Evolution_Calendar_AlarmNotify_NotFound); + ex_GNOME_Evolution_Calendar_AlarmNotify_InvalidURI, + NULL); return; } - gtk_object_unref (client); + lc = g_hash_table_lookup (priv->uri_client_hash, uri); + gnome_vfs_uri_unref (uri); + + if (!lc) { + CORBA_exception_set (ev, CORBA_USER_EXCEPTION, + ex_GNOME_Evolution_Calendar_AlarmNotify_NotFound, + NULL); + return; + } - /* FIXME: do we need to do anything else? */ + g_assert (lc->refcount > 0); + + lc->refcount--; + if (lc->refcount > 0) + return; + + g_hash_table_remove (priv->uri_client_hash, lc->uri); + + gtk_object_unref (GTK_OBJECT (lc->client)); + gnome_vfs_uri_unref (lc->uri); + g_free (lc); +} + +static void +AlarmNotify_die (PortableServer_Servant servant, + CORBA_Environment *ev) +{ + AlarmNotify *an; + AlarmNotifyPrivate *priv; + + an = ALARM_NOTIFY (bonobo_object_from_servant (servant)); + priv = an->priv; + + /* FIXME */ } /** diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c index e2f2ae88db..1e235c116d 100644 --- a/calendar/gui/alarm-notify/alarm-queue.c +++ b/calendar/gui/alarm-notify/alarm-queue.c @@ -286,13 +286,13 @@ load_alarms (ClientAlarms *ca) /* Called when a calendar client finished loading; we load its alarms */ static void -cal_loaded_cb (CalClient *client, CalClientLoadStatus status, gpointer data) +cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer data) { ClientAlarms *ca; ca = data; - if (status != CAL_CLIENT_LOAD_SUCCESS) + if (status != CAL_CLIENT_OPEN_SUCCESS) return; load_alarms (ca); @@ -463,16 +463,16 @@ alarm_queue_add_client (CalClient *client) ca->uid_alarms_hash = g_hash_table_new (g_str_hash, g_str_equal); - if (!cal_client_is_loaded (client)) - gtk_signal_connect (GTK_OBJECT (client), "cal_loaded", - GTK_SIGNAL_FUNC (cal_loaded_cb), ca); + if (cal_client_get_load_state (client) != CAL_CLIENT_LOAD_LOADED) + gtk_signal_connect (GTK_OBJECT (client), "cal_opened", + GTK_SIGNAL_FUNC (cal_opened_cb), ca); gtk_signal_connect (GTK_OBJECT (client), "obj_updated", GTK_SIGNAL_FUNC (obj_updated_cb), ca); gtk_signal_connect (GTK_OBJECT (client), "obj_removed", GTK_SIGNAL_FUNC (obj_removed_cb), ca); - if (cal_client_is_loaded (client)) + if (cal_client_get_load_state (client) == CAL_CLIENT_LOAD_LOADED) load_alarms (ca); } |