From 356697e42c851abc93a60534246e92b245e35d8a Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Wed, 4 Feb 2004 12:36:13 +0000 Subject: Fixes #52970 2004-02-04 Rodrigo Moya Fixes #52970 * idl/evolution-calendar.idl: added back the AlarmNotify interface. * gui/alarm-notify/GNOME_Evolution_Calendar_AlarmNotify.server.in.in: changed to have the AlarmNotify component be created via a factory. * gui/alarm-notify/alarm-notify.[ch]: converted to implement the AlarmNotify interface. * gui/alarm-notify/notify-main.c (main): register the factory with bonobo_generic_factory_new, not the object itself. Removed redundant call to bonobo_object_unref. Call e_passwords_shutdown on exit. * gui/alarm-notify/config-data.c (config_data_get_calendars_to_load): get only the selected calendars/task lists. svn path=/trunk/; revision=24613 --- calendar/ChangeLog | 19 ++++++++++ ...OME_Evolution_Calendar_AlarmNotify.server.in.in | 14 ++++++- calendar/gui/alarm-notify/alarm-notify.c | 27 +++----------- calendar/gui/alarm-notify/alarm-notify.h | 8 ++-- calendar/gui/alarm-notify/config-data.c | 43 ++++++++++++++-------- calendar/gui/alarm-notify/notify-main.c | 11 +++--- calendar/gui/calendar-component.c | 2 +- calendar/gui/e-day-view.c | 4 +- calendar/idl/evolution-calendar.idl | 3 ++ 9 files changed, 82 insertions(+), 49 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 9f08b44ef8..e029c3a4ce 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,22 @@ +2004-02-04 Rodrigo Moya + + Fixes #52970 + + * idl/evolution-calendar.idl: added back the AlarmNotify interface. + + * gui/alarm-notify/GNOME_Evolution_Calendar_AlarmNotify.server.in.in: + changed to have the AlarmNotify component be created via a factory. + + * gui/alarm-notify/alarm-notify.[ch]: converted to implement the + AlarmNotify interface. + + * gui/alarm-notify/notify-main.c (main): register the factory with + bonobo_generic_factory_new, not the object itself. Removed redundant + call to bonobo_object_unref. Call e_passwords_shutdown on exit. + + * gui/alarm-notify/config-data.c (config_data_get_calendars_to_load): + get only the selected calendars/task lists. + 2004-02-04 Rodrigo Moya * gui/gnome-cal.c (gnome_calendar_add_event_source): don't update the 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 3c43c4ca54..1ae54c3736 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 @@ - @@ -13,4 +13,16 @@ + + + + + + + + + + diff --git a/calendar/gui/alarm-notify/alarm-notify.c b/calendar/gui/alarm-notify/alarm-notify.c index 4b956ec93c..84159e562c 100644 --- a/calendar/gui/alarm-notify/alarm-notify.c +++ b/calendar/gui/alarm-notify/alarm-notify.c @@ -23,6 +23,7 @@ #endif #include +#include #include #include "alarm-notify.h" #include "alarm-queue.h" @@ -48,27 +49,7 @@ static BonoboObjectClass *parent_class; -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; -} +BONOBO_TYPE_FUNC_FULL(AlarmNotify, GNOME_Evolution_Calendar_AlarmNotify, BONOBO_TYPE_OBJECT, alarm_notify) /* Class initialization function for the alarm notify service */ static void @@ -142,7 +123,9 @@ alarm_notify_new (void) { AlarmNotify *an; - an = g_object_new (TYPE_ALARM_NOTIFY, NULL); + an = g_object_new (TYPE_ALARM_NOTIFY, + "poa", bonobo_poa_get_threaded (ORBIT_THREAD_HINT_PER_REQUEST, NULL), + NULL); return an; } diff --git a/calendar/gui/alarm-notify/alarm-notify.h b/calendar/gui/alarm-notify/alarm-notify.h index 418ae23878..c4a351d818 100644 --- a/calendar/gui/alarm-notify/alarm-notify.h +++ b/calendar/gui/alarm-notify/alarm-notify.h @@ -22,7 +22,8 @@ #ifndef ALARM_NOTIFY_H #define ALARM_NOTIFY_H -#include +#include +#include "evolution-calendar.h" @@ -39,14 +40,15 @@ typedef struct _AlarmNotifyClass AlarmNotifyClass; typedef struct _AlarmNotifyPrivate AlarmNotifyPrivate; struct _AlarmNotify { - GObject object; + BonoboObject object; /* Private data */ AlarmNotifyPrivate *priv; }; struct _AlarmNotifyClass { - GObjectClass parent_class; + BonoboObjectClass parent_class; + POA_GNOME_Evolution_Calendar_AlarmNotify__epv epv; }; GType alarm_notify_get_type (void); diff --git a/calendar/gui/alarm-notify/config-data.c b/calendar/gui/alarm-notify/config-data.c index afa8a8f7f4..bbc508577b 100644 --- a/calendar/gui/alarm-notify/config-data.c +++ b/calendar/gui/alarm-notify/config-data.c @@ -142,31 +142,44 @@ GPtrArray * config_data_get_calendars_to_load (void) { GPtrArray *cals; - GSList *groups, *gl, *sources, *sl; + GSList *uids_selected, *l; + ESource *source; ensure_inited (); /* create the array to be returned */ cals = g_ptr_array_new (); - /* process calendar sources */ - groups = e_source_list_peek_groups (calendar_source_list); - for (gl = groups; gl != NULL; gl = gl->next) { - sources = e_source_group_peek_sources (E_SOURCE_GROUP (gl->data)); - for (sl = sources; sl != NULL; sl = sl->next) { - g_ptr_array_add (cals, sl->data); - } + /* get selected calendars */ + uids_selected = gconf_client_get_list (conf_client, "/apps/evolution/calendar/display/selected_calendars", + GCONF_VALUE_STRING, NULL); + for (l = uids_selected; l != NULL; l = l->next) { + char *uid = l->data; + + source = e_source_list_peek_source_by_uid (calendar_source_list, uid); + if (source) + g_ptr_array_add (cals, source); + + g_free (uid); } - /* process tasks sources */ - groups = e_source_list_peek_groups (tasks_source_list); - for (gl = groups; gl != NULL; gl = gl->next) { - sources = e_source_group_peek_sources (E_SOURCE_GROUP (gl->data)); - for (sl = sources; sl != NULL; sl = sl->next) { - g_ptr_array_add (cals, sl->data); - } + g_slist_free (uids_selected); + + /* get selected tasks */ + uids_selected = gconf_client_get_list (conf_client, "/apps/evolution/calendar/tasks/selected_tasks", + GCONF_VALUE_STRING, NULL); + for (l = uids_selected; l != NULL; l = l->next) { + char *uid = l->data; + + source = e_source_list_peek_source_by_uid (calendar_source_list, uid); + if (source) + g_ptr_array_add (cals, source); + + g_free (uid); } + g_slist_free (uids_selected); + return cals; } diff --git a/calendar/gui/alarm-notify/notify-main.c b/calendar/gui/alarm-notify/notify-main.c index f9bae936fa..0fcee80d1c 100644 --- a/calendar/gui/alarm-notify/notify-main.c +++ b/calendar/gui/alarm-notify/notify-main.c @@ -38,6 +38,7 @@ #include #include #include +#include "e-util/e-passwords.h" #include "alarm.h" #include "alarm-queue.h" #include "alarm-notify.h" @@ -153,9 +154,9 @@ main (int argc, char **argv) textdomain (GETTEXT_PACKAGE); gnome_program_init ("evolution-alarm-notify", VERSION, LIBGNOMEUI_MODULE, argc, argv, NULL); - gtk_init (&argc, &argv); - if (bonobo_init (&argc, argv) == FALSE) + if (bonobo_init_full (&argc, argv, bonobo_activation_orb_get (), + CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE) g_error (_("Could not initialize Bonobo")); if (!gnome_vfs_init ()) @@ -165,11 +166,12 @@ main (int argc, char **argv) gnome_sound_init ("localhost"); - factory = bonobo_generic_factory_new ("OAFIID:GNOME_Evolution_Calendar_AlarmNotify:" BASE_VERSION, + factory = bonobo_generic_factory_new ("OAFIID:GNOME_Evolution_Calendar_AlarmNotify_Factory:" BASE_VERSION, (BonoboFactoryCallback) alarm_notify_factory_fn, NULL); if (!factory) g_error (_("Could not create the alarm notify service factory")); + g_object_set (G_OBJECT (factory), "poa", bonobo_poa_get_threaded (ORBIT_THREAD_HINT_PER_REQUEST, NULL), NULL); set_session_parameters (argv); g_idle_add ((GSourceFunc) load_calendars, NULL); @@ -179,14 +181,13 @@ main (int argc, char **argv) bonobo_object_unref (BONOBO_OBJECT (factory)); factory = NULL; - bonobo_object_unref (BONOBO_OBJECT (alarm_notify_service)); - alarm_queue_done (); alarm_done (); if (alarm_notify_service) bonobo_object_unref (BONOBO_OBJECT (alarm_notify_service)); + e_passwords_shutdown (); gnome_sound_shutdown (); gnome_vfs_shutdown (); diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c index 647a66f3a3..fbbee6d377 100644 --- a/calendar/gui/calendar-component.c +++ b/calendar/gui/calendar-component.c @@ -577,7 +577,7 @@ impl_createControls (PortableServer_Servant servant, not = calendar_config_add_notification_primary_calendar (config_primary_selection_changed_cb, calendar_component); priv->notifications = g_list_prepend (priv->notifications, GUINT_TO_POINTER (not)); - + /* Return the controls */ *corba_sidebar_control = CORBA_Object_duplicate (BONOBO_OBJREF (sidebar_control), ev); *corba_view_control = CORBA_Object_duplicate (BONOBO_OBJREF (priv->view_control), ev); diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index d7ab97144d..e1f7179973 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -3076,10 +3076,10 @@ e_day_view_show_popup_menu (EDayView *day_view, gint event_num) { GtkMenu *popup; - + day_view->popup_event_day = day; day_view->popup_event_num = event_num; - + popup = e_calendar_view_create_popup_menu (E_CALENDAR_VIEW (day_view)); e_popup_menu (popup, gdk_event); } diff --git a/calendar/idl/evolution-calendar.idl b/calendar/idl/evolution-calendar.idl index 66f4eb8939..2ead68220b 100644 --- a/calendar/idl/evolution-calendar.idl +++ b/calendar/idl/evolution-calendar.idl @@ -40,6 +40,9 @@ module Calendar { void editNew (in string uri, in CompEditorMode mode) raises (InvalidURI, BackendContactError, UnsupportedType); }; + + interface AlarmNotify : Bonobo::Unknown { + }; }; }; -- cgit v1.2.3