Re: [evolution-patches] "component.migration" event for calendar component



Ok, here's the updated version with the comment, documentation builder
entry and changelog. I've tried to explain in the comment the reasoning
behind this event.

-David

On Tue, 2005-01-04 at 11:09 +0800, Not Zed wrote:
> 
> Looks fine.  Seems a bizarre thing to need an event for though.
> Should it just be a component-started event?  But maybe there's other
> reasons for it, so i'm just speculating.
> 
> One thing you should do is add a documentation comment for the event.
> I have some documentation extraction code which looks for certain
> headers, and i've been trying to add those where needed, the format
> may not be finalised, but at least if the code is marked appropriately
> it can be found later on if it needs changing.
> 
> i.e. for the 'message.reading' event, it just has this comment: 
>         /** @Event: message.reading
>          * @Title: Viewing a message
>          * @Target: EMEventTargetMessage
>          * 
>          * message.reading is emitted whenever a user views a message.
>          */
> 
> The comment needs to start with
> "/** @Event: "
> all content lines need to start with "* "
> and it needs to end with "*/"
> 
> doc/devel/build-eplugin-manual.pl has some docbook extraction code in
> it and needs all of the files listed, but its a bit
> messy/undocumented, so only try updating that if you're feeling keen
> (it will need to generate a new xml file and the entity will need to
> be added to the base document).
> 
> Cheers,
> Michael
> 
> On Mon, 2005-01-03 at 15:36 -0700, David Trowbridge wrote: 
> > This adds a new event that is triggered at the calendar migration step
> > (which occurs every time evolution starts). This allows plugins to
> > supply their own source groups.
> > 
> > -David
> -- 
> 
> Michael Zucchi <notzed ximian com>
> "Ride, Work, Sleep. Beer."
> Novell's Evolution and Free
> Software Developer
? calendar/gui/e-cal-event.c
? calendar/gui/e-cal-event.h
Index: calendar/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2599
diff -u -r1.2599 ChangeLog
--- calendar/ChangeLog	31 Dec 2004 16:59:18 -0000	1.2599
+++ calendar/ChangeLog	4 Jan 2005 07:38:20 -0000
@@ -1,3 +1,9 @@
+2005-01-04  David Trowbridge  <trowbrds cs colorado edu>
+
+	* gui/e-cal-event[hc]: initial import of ECalEvent targets
+
+	* gui/migration.c (migrate_calendars): add component.migration event
+
 2004-12-31  JP Rosevear  <jpr novell com>
 
 	* gui/dialogs/schedule-page.c: add necessary include
Index: calendar/gui/Makefile.am
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/Makefile.am,v
retrieving revision 1.301
diff -u -r1.301 Makefile.am
--- calendar/gui/Makefile.am	23 Dec 2004 02:42:11 -0000	1.301
+++ calendar/gui/Makefile.am	4 Jan 2005 07:38:20 -0000
@@ -105,6 +105,8 @@
 	e-cal-component-preview.h		\
 	e-cal-config.c				\
 	e-cal-config.h				\
+	e-cal-event.c				\
+	e-cal-event.h				\
 	e-cal-menu.c				\
 	e-cal-menu.h				\
 	e-cal-model-calendar.h			\
Index: calendar/gui/main.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/main.c,v
retrieving revision 1.171
diff -u -r1.171 main.c
--- calendar/gui/main.c	31 Dec 2004 16:59:18 -0000	1.171
+++ calendar/gui/main.c	4 Jan 2005 07:38:21 -0000
@@ -49,6 +49,7 @@
 #include "e-cal-config.h"
 #include "e-cal-popup.h"
 #include "e-cal-menu.h"
+#include "e-cal-event.h"
 
 #define FACTORY_ID "OAFIID:GNOME_Evolution_Calendar_Factory:" BASE_VERSION
 
@@ -146,6 +147,7 @@
 	e_plugin_hook_register_type (e_cal_popup_hook_get_type());
 	e_plugin_hook_register_type (e_cal_menu_hook_get_type());
 	e_plugin_hook_register_type (e_cal_config_hook_get_type ());
+	e_plugin_hook_register_type (e_cal_event_hook_get_type ());
 }
 
 
Index: calendar/gui/migration.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/migration.c,v
retrieving revision 1.32
diff -u -r1.32 migration.c
--- calendar/gui/migration.c	7 Oct 2004 21:03:36 -0000	1.32
+++ calendar/gui/migration.c	4 Jan 2005 07:38:21 -0000
@@ -47,6 +47,7 @@
 #include <libedataserver/e-xml-hash-utils.h>
 #include "calendar-config.h"
 #include "calendar-config-keys.h"
+#include "e-cal-event.h"
 #include "migration.h"
 
 static e_gconf_map_t calendar_display_map[] = {
@@ -700,6 +701,8 @@
 {
 	ESourceGroup *on_this_computer = NULL, *on_the_web = NULL, *contacts = NULL;
 	ESource *personal_source = NULL;
+	ECalEvent *ece;
+	ECalEventTargetComponent *target;
 	gboolean retval = FALSE;
 
 	/* we call this unconditionally now - create_groups either
@@ -833,6 +836,21 @@
 	}
 
 	e_source_list_sync (calendar_component_peek_source_list (component), NULL);
+
+	/** @Event: component.migration
+	 * @Title: Migration step in component initialization
+	 * @Target: ECalEventTargetComponent
+	 * 
+	 * component.migration is emitted during the calendar component
+	 * initialization process. This allows new calendar backend types
+	 * to be distributed as an e-d-s backend and a plugin without
+	 * reaching their grubby little fingers into migration.c
+	 */
+	/* Fire off migration event */
+	ece = e_cal_event_peek ();
+	target = e_cal_event_target_new_component (ece, calendar_component_peek (), 0);
+	e_event_emit ((EEvent *) ece, "component.migration", (EEventTarget *) target);
+
 	retval = TRUE;
 fail:
 	if (on_this_computer)
Index: doc/devel/build-eplugin-manual.pl
===================================================================
RCS file: /cvs/gnome/evolution/doc/devel/build-eplugin-manual.pl,v
retrieving revision 1.3
diff -u -r1.3 build-eplugin-manual.pl
--- doc/devel/build-eplugin-manual.pl	28 Oct 2004 09:30:28 -0000	1.3
+++ doc/devel/build-eplugin-manual.pl	4 Jan 2005 07:38:24 -0000
@@ -240,6 +240,10 @@
 	    { 'type' => 'HookPoint-EMPopup',
 	      'files' => [ 'em-folder-tree.c', 'em-folder-view.c', 'em-format-html-display.c', '../composer/e-msg-composer-attachment-bar.c' ],
 	      'module' => 'mail' },
+	   'ecal-events.xml' =>
+	    { 'type' => 'Event',
+	      'files' => [ 'gui/migration.c' ],
+	      'module' => 'calendar' },
 	   'ecal-popups.xml' =>
 	    { 'type' => 'HookPoint-ECalPopup',
 	      'files' => [ 'gui/e-calendar-view.c', 'gui/calendar-component.c', 'gui/e-calendar-view.c', 'gui/tasks-component.c' ],

Attachment: e-cal-event.tar.gz
Description: application/compressed-tar



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]